FAILED: patch "[PATCH] io_uring/poll: fix multishot recv missing EOF on wakeup race" failed to apply to 6.1-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.1-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]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x a68ed2df72131447d131531a08fe4dfcf4fa4653
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026032057-septic-boogeyman-daef@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a68ed2df72131447d131531a08fe4dfcf4fa4653 Mon Sep 17 00:00:00 2001
From: Jens Axboe <[email protected]>
Date: Sun, 15 Mar 2026 09:03:03 -0600
Subject: [PATCH] io_uring/poll: fix multishot recv missing EOF on wakeup race
When a socket send and shutdown() happen back-to-back, both fire wake-ups before the receiver's task_work has a chance to run. The first wake gets poll ownership (poll_refs=1), and the second bumps it to 2. When io_poll_check_events() runs, it calls io_poll_issue() which does a recv that reads the data and returns IOU_RETRY. The loop then drains all accumulated refs (atomic_sub_return(2) -> 0) and exits, even though only the first event was consumed. Since the shutdown is a persistent state change, no further wakeups will happen, and the multishot recv can hang forever.
Check specifically for HUP in the poll loop, and ensure that another loop is done to check for status if more than a single poll activation is pending. This ensures we don't lose the shutdown event.
io_uring/poll.c +7 -2
@@ -272,6 +272,7 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)atomic_andnot (IO_POLL_RETRY_FLAG , &req->poll_refs); v &= ~IO_POLL_RETRY_FLAG ; } + v &=IO_POLL_REF_MASK ; }/* the mask was stashed in __io_poll_execute */
@@ -304,8 +305,13 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)return IOU_POLL_REMOVE_POLL_USE_RES ; } }else { -int ret =io_poll_issue (req, tw); +int ret; +/* multiple refs and HUP, ensure we loop once more */ +if ((req->cqe.res & (POLLHUP |POLLRDHUP )) && v !=1 ) + v--; + + ret =io_poll_issue (req, tw);if (ret ==IOU_COMPLETE )return IOU_POLL_REMOVE_POLL_USE_RES ;else if (ret ==IOU_REQUEUE )
@@ -321,7 +327,6 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)* Release all references, retry if someone tried to restart * task_work while we were executing it. */ - v &=IO_POLL_REF_MASK ; }while (atomic_sub_return (v, &req->poll_refs) &IO_POLL_REF_MASK );io_napi_add (req);
Jens Axboe
maintainerQuoted 5 lines · On 3/20/26 11:33 AM, [email protected] wrote:
The patch below does not apply to the 6.1-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]>.
Since this only triggers after the AF_UNIX inq addition in 6.17, we can drop it for 6.1/6/12. I should've done a better job with the Fixes tag.
Signature · 1 line
Jens Axboe
Greg KH
maintainerQuoted 10 lines · Jens Axboe
Quoted 5 lines · On 3/20/26 11:33 AM, [email protected] wrote:
The patch below does not apply to the 6.1-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]>.Since this only triggers after the
AF_UNIXinq addition in 6.17, we can drop it for 6.1/6/12. I should've done a better job with the Fixes tag.
Not a problem, thanks for letting us know for this, and the other FAILED patch.
greg k-h