From: "Stefan Bühler" <source@stbuehler.de>
To: Jens Axboe <axboe@kernel.dk>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/5] tcp: handle SPLICE_F_NONBLOCK in tcp_splice_read
Date: Sat, 11 May 2019 18:57:24 +0200 [thread overview]
Message-ID: <20190511165727.31599-2-source@stbuehler.de> (raw)
In-Reply-To: <20190511165727.31599-1-source@stbuehler.de>
Now both O_NONBLOCK and SPLICE_F_NONBLOCK will trigger non-blocking
behavior.
The spice man page is unclear about the exact semantics:
First it says splice may still block if SPLICE_F_NONBLOCK is set but
O_NONBLOCK isn't.
Then it says it might return EAGAIN if one or the other is set (and on
my debian system it says EAGAIN can only be returned if
SPLICE_F_NONBLOCK was set).
Signed-off-by: Stefan Bühler <source@stbuehler.de>
---
net/ipv4/tcp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 6baa6dc1b13b..65f9917ed8ca 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -784,6 +784,8 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
long timeo;
ssize_t spliced;
int ret;
+ bool noblock = (sock->file->f_flags & O_NONBLOCK) ||
+ (flags & SPLICE_F_NONBLOCK);
sock_rps_record_flow(sk);
/*
@@ -796,7 +798,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
lock_sock(sk);
- timeo = sock_rcvtimeo(sk, sock->file->f_flags & O_NONBLOCK);
+ timeo = sock_rcvtimeo(sk, noblock);
while (tss.len) {
ret = __tcp_splice_read(sk, &tss);
if (ret < 0)
--
2.20.1
next prev parent reply other threads:[~2019-05-11 16:57 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 19:06 io_uring: not good enough for release Stefan Bühler
2019-04-23 20:31 ` Jens Axboe
2019-04-23 22:07 ` Jens Axboe
2019-04-24 16:09 ` Jens Axboe
2019-04-27 16:05 ` io_uring: RWF_NOWAIT support Stefan Bühler
2019-04-27 18:34 ` [PATCH v1 1/1] [io_uring] fix handling SQEs requesting NOWAIT Stefan Bühler
2019-04-30 15:40 ` Jens Axboe
2019-04-27 15:50 ` io_uring: submission error handling Stefan Bühler
2019-04-30 16:02 ` Jens Axboe
2019-04-30 16:15 ` Jens Axboe
2019-04-30 18:15 ` Stefan Bühler
2019-04-30 18:42 ` Jens Axboe
2019-05-01 11:49 ` [PATCH v1 1/1] [io_uring] don't stall on submission errors Stefan Bühler
2019-05-01 12:43 ` Jens Axboe
2019-04-27 21:07 ` io_uring: closing / release Stefan Bühler
2019-05-11 16:26 ` Stefan Bühler
2019-04-28 15:54 ` io_uring: O_NONBLOCK/IOCB_NOWAIT/RWF_NOWAIT mess Stefan Bühler
2019-05-11 16:34 ` Stefan Bühler
2019-05-11 16:57 ` [PATCH 1/5] fs: RWF flags override default IOCB flags from file flags Stefan Bühler
2019-05-11 16:57 ` Stefan Bühler [this message]
2019-05-11 16:57 ` [PATCH 3/5] pipe: use IOCB_NOWAIT instead of O_NONBLOCK Stefan Bühler
2019-05-11 16:57 ` [PATCH 4/5] socket: " Stefan Bühler
2019-05-11 16:57 ` [PATCH 5/5] io_uring: use FMODE_NOWAIT to detect files supporting IOCB_NOWAIT Stefan Bühler
2019-05-03 9:47 ` [PATCH 1/2] io_uring: restructure io_{read,write} control flow Stefan Bühler
2019-05-03 9:47 ` [PATCH 2/2] io_uring: punt to workers if file doesn't support async Stefan Bühler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190511165727.31599-2-source@stbuehler.de \
--to=source@stbuehler.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).