FAILED: patch "[PATCH] io_uring: don't use poll handler if file can't be nonblocking" failed to apply to 5.8-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.8-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9dab14b81807a40dab8e464ec87043935c562c2c Mon Sep 17 00:00:00 2001
From: Jens Axboe <[email protected]>
Date: Tue, 25 Aug 2020 12:27:50 -0600
Subject: [PATCH] io_uring: don't use poll handler if file can't be nonblocking
read/written
There's no point in using the poll handler if we can't do a nonblocking IO attempt of the operation, since we'll need to go async anyway. In fact this is actively harmful, as reading from eg pipes won't return 0 to indicate EOF.
fs/io_uring.c +9 -1
@@ -4889,12 +4889,20 @@ static bool io_arm_poll_handler(struct io_kiocb *req)struct async_poll *apoll;struct io_poll_table ipt;__poll_t mask, ret; +int rw;if (!req->file || !file_can_poll (req->file))return false;if (req->flags &REQ_F_POLLED )return false; -if (!def->pollin && !def->pollout) +if (def->pollin) + rw =READ ; +else if (def->pollout) + rw =WRITE ; +else +return false; +/* if we can't nonblock try, then no point in arming a poll handler */ +if (!io_file_supports_async (req->file, rw))return false; apoll =kmalloc (sizeof (*apoll),GFP_ATOMIC );
Quoted 5 lines · On 8/31/20 3:58 AM, [email protected] wrote:
The patch below does not apply to the 5.8-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Here's a backport:
From 84f81565a00f353c503d5b5bd98c77625af73b60 Mon Sep 17 00:00:00 2001
From: Jens Axboe <[email protected]>
Date: Tue, 25 Aug 2020 12:27:50 -0600
Subject: [PATCH 2/3] io_uring: don't use poll handler if file can't be
nonblocking read/written
There's no point in using the poll handler if we can't do a nonblocking IO attempt of the operation, since we'll need to go async anyway. In fact this is actively harmful, as reading from eg pipes won't return 0 to indicate EOF.
--- fs/io_uring.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/io_uring.c +9 -1
@@ -4503,12 +4503,20 @@ static bool io_arm_poll_handler(struct io_kiocb *req)struct async_poll *apoll;struct io_poll_table ipt;__poll_t mask, ret; +int rw;if (!req->file || !file_can_poll (req->file))return false;if (req->flags & (REQ_F_MUST_PUNT |REQ_F_POLLED ))return false; -if (!def->pollin && !def->pollout) +if (def->pollin) + rw =READ ; +else if (def->pollout) + rw =WRITE ; +else +return false; +/* if we can't nonblock try, then no point in arming a poll handler */ +if (!io_file_supports_async (req->file, rw))return false; apoll =kmalloc (sizeof (*apoll),GFP_ATOMIC );
Signature · 5 lines
2.28.0 -- Jens Axboe