@@ -45,40 +45,28 @@ static inline bool __io_fill_cqe_req(struct io_ring_ctx *ctx,
4545 req -> cqe .res , req -> cqe .flags ,
4646 (req -> flags & REQ_F_CQE32_INIT ) ? req -> extra1 : 0 ,
4747 (req -> flags & REQ_F_CQE32_INIT ) ? req -> extra2 : 0 );
48+ /*
49+ * If we can't get a cq entry, userspace overflowed the
50+ * submission (by quite a lot). Increment the overflow count in
51+ * the ring.
52+ */
53+ cqe = io_get_cqe (ctx );
54+ if (unlikely (!cqe ))
55+ return io_req_cqe_overflow (req );
56+ memcpy (cqe , & req -> cqe , sizeof (* cqe ));
4857
49- if (!(ctx -> flags & IORING_SETUP_CQE32 )) {
50- /*
51- * If we can't get a cq entry, userspace overflowed the
52- * submission (by quite a lot). Increment the overflow count in
53- * the ring.
54- */
55- cqe = io_get_cqe (ctx );
56- if (likely (cqe )) {
57- memcpy (cqe , & req -> cqe , sizeof (* cqe ));
58- return true;
59- }
60- } else {
58+ if (ctx -> flags & IORING_SETUP_CQE32 ) {
6159 u64 extra1 = 0 , extra2 = 0 ;
6260
6361 if (req -> flags & REQ_F_CQE32_INIT ) {
6462 extra1 = req -> extra1 ;
6563 extra2 = req -> extra2 ;
6664 }
6765
68- /*
69- * If we can't get a cq entry, userspace overflowed the
70- * submission (by quite a lot). Increment the overflow count in
71- * the ring.
72- */
73- cqe = io_get_cqe (ctx );
74- if (likely (cqe )) {
75- memcpy (cqe , & req -> cqe , sizeof (struct io_uring_cqe ));
76- WRITE_ONCE (cqe -> big_cqe [0 ], extra1 );
77- WRITE_ONCE (cqe -> big_cqe [1 ], extra2 );
78- return true;
79- }
66+ WRITE_ONCE (cqe -> big_cqe [0 ], extra1 );
67+ WRITE_ONCE (cqe -> big_cqe [1 ], extra2 );
8068 }
81- return io_req_cqe_overflow ( req ) ;
69+ return true ;
8270}
8371
8472static inline void req_set_fail (struct io_kiocb * req )
0 commit comments