net: make socket read/write_iter() honor IOCB_NOWAIT
[ Upstream commit ebfcd8955c ]
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: netdev@vger.kernel.org
Acked-by: David Miller <davem@davemloft.net>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fbff45d241
commit
f42504ab0a
+2
-2
@@ -891,7 +891,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)
|
||||
@@ -916,7 +916,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)
|
||||
|
||||
Reference in New Issue
Block a user