* [PATCH 10/11] net: make socket read/write_iter() honor IOCB_NOWAIT [not found] <20191210155742.5844-1-axboe@kernel.dk> @ 2019-12-10 15:57 ` Jens Axboe 2019-12-10 19:37 ` David Miller 0 siblings, 1 reply; 3+ messages in thread From: Jens Axboe @ 2019-12-10 15:57 UTC (permalink / raw) To: io-uring; +Cc: Jens Axboe, David Miller, netdev The socket read/write helpers only look at the file O_NONBLOCK. not the iocb IOCB_NOWAIT flag. This breaks users like preadv2/pwritev2 and io_uring that rely on not having the file itself marked nonblocking, but rather the iocb itself. Cc: David Miller <davem@davemloft.net> Cc: netdev@vger.kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk> --- net/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/socket.c b/net/socket.c index b343db1489bd..b116e58d6438 100644 --- a/net/socket.c +++ b/net/socket.c @@ -957,7 +957,7 @@ static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to) .msg_iocb = iocb}; ssize_t res; - if (file->f_flags & O_NONBLOCK) + if (file->f_flags & O_NONBLOCK || (iocb->ki_flags & IOCB_NOWAIT)) msg.msg_flags = MSG_DONTWAIT; if (iocb->ki_pos != 0) @@ -982,7 +982,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from) if (iocb->ki_pos != 0) return -ESPIPE; - if (file->f_flags & O_NONBLOCK) + if (file->f_flags & O_NONBLOCK || (iocb->ki_flags & IOCB_NOWAIT)) msg.msg_flags = MSG_DONTWAIT; if (sock->type == SOCK_SEQPACKET) -- 2.24.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 10/11] net: make socket read/write_iter() honor IOCB_NOWAIT 2019-12-10 15:57 ` [PATCH 10/11] net: make socket read/write_iter() honor IOCB_NOWAIT Jens Axboe @ 2019-12-10 19:37 ` David Miller 2019-12-10 20:43 ` Jens Axboe 0 siblings, 1 reply; 3+ messages in thread From: David Miller @ 2019-12-10 19:37 UTC (permalink / raw) To: axboe; +Cc: io-uring, netdev From: Jens Axboe <axboe@kernel.dk> Date: Tue, 10 Dec 2019 08:57:41 -0700 > The socket read/write helpers only look at the file O_NONBLOCK. not > the iocb IOCB_NOWAIT flag. This breaks users like preadv2/pwritev2 > and io_uring that rely on not having the file itself marked nonblocking, > but rather the iocb itself. > > Cc: David Miller <davem@davemloft.net> > Cc: netdev@vger.kernel.org > Signed-off-by: Jens Axboe <axboe@kernel.dk> I guess this should be OK: Acked-by: David S. Miller <davem@davemloft.net> ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 10/11] net: make socket read/write_iter() honor IOCB_NOWAIT 2019-12-10 19:37 ` David Miller @ 2019-12-10 20:43 ` Jens Axboe 0 siblings, 0 replies; 3+ messages in thread From: Jens Axboe @ 2019-12-10 20:43 UTC (permalink / raw) To: David Miller; +Cc: io-uring, netdev On 12/10/19 12:37 PM, David Miller wrote: > From: Jens Axboe <axboe@kernel.dk> > Date: Tue, 10 Dec 2019 08:57:41 -0700 > >> The socket read/write helpers only look at the file O_NONBLOCK. not >> the iocb IOCB_NOWAIT flag. This breaks users like preadv2/pwritev2 >> and io_uring that rely on not having the file itself marked nonblocking, >> but rather the iocb itself. >> >> Cc: David Miller <davem@davemloft.net> >> Cc: netdev@vger.kernel.org >> Signed-off-by: Jens Axboe <axboe@kernel.dk> > > I guess this should be OK: > > Acked-by: David S. Miller <davem@davemloft.net> Thanks for reviewing! -- Jens Axboe ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-10 20:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20191210155742.5844-1-axboe@kernel.dk>
2019-12-10 15:57 ` [PATCH 10/11] net: make socket read/write_iter() honor IOCB_NOWAIT Jens Axboe
2019-12-10 19:37 ` David Miller
2019-12-10 20:43 ` Jens Axboe
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).