@@ -616,9 +616,15 @@ static inline void io_recv_prep_retry(struct io_kiocb *req)
616
616
* again (for multishot).
617
617
*/
618
618
static inline bool io_recv_finish (struct io_kiocb * req , int * ret ,
619
- unsigned int cflags , bool mshot_finished ,
619
+ struct msghdr * msg , bool mshot_finished ,
620
620
unsigned issue_flags )
621
621
{
622
+ unsigned int cflags ;
623
+
624
+ cflags = io_put_kbuf (req , issue_flags );
625
+ if (msg -> msg_inq && msg -> msg_inq != -1U )
626
+ cflags |= IORING_CQE_F_SOCK_NONEMPTY ;
627
+
622
628
if (!(req -> flags & REQ_F_APOLL_MULTISHOT )) {
623
629
io_req_set_res (req , * ret , cflags );
624
630
* ret = IOU_OK ;
@@ -732,7 +738,6 @@ int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
732
738
struct io_sr_msg * sr = io_kiocb_to_cmd (req , struct io_sr_msg );
733
739
struct io_async_msghdr iomsg , * kmsg ;
734
740
struct socket * sock ;
735
- unsigned int cflags ;
736
741
unsigned flags ;
737
742
int ret , min_ret = 0 ;
738
743
bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK ;
@@ -821,11 +826,7 @@ int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
821
826
else
822
827
io_kbuf_recycle (req , issue_flags );
823
828
824
- cflags = io_put_kbuf (req , issue_flags );
825
- if (kmsg -> msg .msg_inq && kmsg -> msg .msg_inq != -1U )
826
- cflags |= IORING_CQE_F_SOCK_NONEMPTY ;
827
-
828
- if (!io_recv_finish (req , & ret , cflags , mshot_finished , issue_flags ))
829
+ if (!io_recv_finish (req , & ret , & kmsg -> msg , mshot_finished , issue_flags ))
829
830
goto retry_multishot ;
830
831
831
832
if (mshot_finished ) {
@@ -844,7 +845,6 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
844
845
struct io_sr_msg * sr = io_kiocb_to_cmd (req , struct io_sr_msg );
845
846
struct msghdr msg ;
846
847
struct socket * sock ;
847
- unsigned int cflags ;
848
848
unsigned flags ;
849
849
int ret , min_ret = 0 ;
850
850
bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK ;
@@ -924,11 +924,7 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
924
924
else
925
925
io_kbuf_recycle (req , issue_flags );
926
926
927
- cflags = io_put_kbuf (req , issue_flags );
928
- if (msg .msg_inq && msg .msg_inq != -1U )
929
- cflags |= IORING_CQE_F_SOCK_NONEMPTY ;
930
-
931
- if (!io_recv_finish (req , & ret , cflags , ret <= 0 , issue_flags ))
927
+ if (!io_recv_finish (req , & ret , & msg , ret <= 0 , issue_flags ))
932
928
goto retry_multishot ;
933
929
934
930
return ret ;
0 commit comments