FAILED: patch "[PATCH] io_uring/rw: fix missing ERESTARTSYS conversion in read paths" failed to apply to 6.12-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.12-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.12.y
git checkout FETCH_HEAD
git cherry-pick -x ab05caca123c6d0b41850b7c05b246e4dca4a770
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072912-manpower-thrift-f2fd@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ab05caca123c6d0b41850b7c05b246e4dca4a770 Mon Sep 17 00:00:00 2001
From: Yitang Yang <[email protected]>
Date: Wed, 22 Jul 2026 20:45:51 +0800
Subject: [PATCH] io_uring/rw: fix missing ERESTARTSYS conversion in read paths
Both read and write may receive internal restart error codes from the filesystem layer and should be converted to -EINTR. However, when multishot read support was added, the error code normalization was lost for both io_read() and io_read_mshot().
Extract the conversion into io_fixup_restart_res() and apply it in all three locations: io_rw_done(), io_read(), and io_read_mshot().
io_uring/rw.c +25 -17
@@ -615,6 +615,24 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res)smp_store_release (&req->iopoll_completed,1 ); } +static inline ssize_t io_fixup_restart_res (ssize_t ret) +{ +switch (ret) { +case -ERESTARTSYS : +case -ERESTARTNOINTR : +case -ERESTARTNOHAND : +case -ERESTART_RESTARTBLOCK : +/* +* We can't just restart the syscall, since previously +* submitted sqes may already be in progress. Just fail +* this IO with EINTR. +*/ +return -EINTR ; +default : +return ret; + } +} +static inline void io_rw_done (struct io_kiocb *req,ssize_t ret) { struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
@@ -624,21 +642,8 @@ static inline void io_rw_done(struct io_kiocb *req, ssize_t ret)return ;/* transform internal restart error codes */ -if (unlikely (ret <0 )) { -switch (ret) { -case -ERESTARTSYS : -case -ERESTARTNOINTR : -case -ERESTARTNOHAND : -case -ERESTART_RESTARTBLOCK : -/* -* We can't just restart the syscall, since previously -* submitted sqes may already be in progress. Just fail -* this IO with EINTR. -*/ - ret = -EINTR ; -break ; - } - } +if (unlikely (ret <0 )) + ret =io_fixup_restart_res (ret);if (req->flags &REQ_F_IOPOLL )io_complete_rw_iopoll (&rw->kiocb, ret);
@@ -1034,7 +1039,8 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)if (req->flags &REQ_F_BUFFERS_COMMIT )io_kbuf_recycle (req, sel.buf_list, issue_flags); -return ret; + +return io_fixup_restart_res (ret); }int io_read_mshot (struct io_kiocb *req,unsigned int issue_flags)
@@ -1068,8 +1074,10 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags)return IOU_RETRY ; }else if (ret <=0 ) {io_kbuf_recycle (req, sel.buf_list, issue_flags); -if (ret <0 ) +if (ret <0 ) { + ret =io_fixup_restart_res (ret);req_set_fail (req); + } }else if (!(req->flags &REQ_F_APOLL_MULTISHOT )) { cflags =io_put_kbuf (req, ret, sel.buf_list); }else {
Jens Axboe
maintainerQuoted 6 lines · On 7/29/26 7:50 AM, [email protected] wrote:
The patch below does not apply to the 6.12-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]>.
Quoted 8 lines
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.12.y
git checkoutFETCH_HEAD
git cherry-pick -xab05caca123c6d0b41850b7c05b246e4dca4a770
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072912-manpower-thrift-f2fd@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Seems that's already in 6.12-stable?
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 9 lines · Jens Axboe
Quoted 8 lines · On 7/29/26 7:50 AM, [email protected] wrote:
The patch below does not apply to the 6.12-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:
Quoted 8 lines
Quoted 6 lines
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkoutFETCH_HEAD
git cherry-pick -xab05caca123c6d0b41850b7c05b246e4dca4a770
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072912-manpower-thrift-f2fd@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'Seems that's already in 6.12-stable?
No sorry, I'm blind. I'll take care of this and the 6.6 one.
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 17 lines · Jens Axboe
Quoted 16 lines · Jens Axboe
Quoted 14 lines · On 7/29/26 7:50 AM, [email protected] wrote:
The patch below does not apply to the 6.12-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.12.y
git checkoutFETCH_HEAD
git cherry-pick -xab05caca123c6d0b41850b7c05b246e4dca4a770
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072912-manpower-thrift-f2fd@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Quoted 3 lines
Quoted 1 line
Seems that's already in 6.12-stable?
No sorry, I'm blind. I'll take care of this and the 6.6 one.
Here's the 6.12-stable one, sorry for the mixed emails.
Signature · 1 line
Jens Axboe
From 694056a4170df694f0689aa62d413f8728638c9b Mon Sep 17 00:00:00 2001
From: Yitang Yang <[email protected]>
Date: Wed, 22 Jul 2026 20:45:51 +0800
Subject: [PATCH] io_uring/rw: fix missing ERESTARTSYS conversion in read paths
Commit ab05caca123c6d0b41850b7c05b246e4dca4a770 upstream.
Both read and write may receive internal restart error codes from the filesystem layer and should be converted to -EINTR. However, when multishot read support was added, the error code normalization was lost for both io_read() and io_read_mshot().
Extract the conversion into io_fixup_restart_res() and apply it in all three locations: io_rw_done(), io_read(), and io_read_mshot().
--- io_uring/rw.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-)
io_uring/rw.c +25 -17
@@ -560,6 +560,24 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res)smp_store_release (&req->iopoll_completed,1 ); } +static inline ssize_t io_fixup_restart_res (ssize_t ret) +{ +switch (ret) { +case -ERESTARTSYS : +case -ERESTARTNOINTR : +case -ERESTARTNOHAND : +case -ERESTART_RESTARTBLOCK : +/* +* We can't just restart the syscall, since previously +* submitted sqes may already be in progress. Just fail +* this IO with EINTR. +*/ +return -EINTR ; +default : +return ret; + } +} +static inline void io_rw_done (struct kiocb *kiocb,ssize_t ret) {/* IO was queued async, completion will happen later */
@@ -567,21 +585,8 @@ static inline void io_rw_done(struct kiocb *kiocb, ssize_t ret)return ;/* transform internal restart error codes */ -if (unlikely (ret <0 )) { -switch (ret) { -case -ERESTARTSYS : -case -ERESTARTNOINTR : -case -ERESTARTNOHAND : -case -ERESTART_RESTARTBLOCK : -/* -* We can't just restart the syscall, since previously -* submitted sqes may already be in progress. Just fail -* this IO with EINTR. -*/ - ret = -EINTR ; -break ; - } - } +if (unlikely (ret <0 )) + ret =io_fixup_restart_res (ret);INDIRECT_CALL_2 (kiocb->ki_complete, io_complete_rw_iopoll, io_complete_rw, kiocb, ret);
@@ -961,7 +966,8 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)if (req->flags &REQ_F_BUFFERS_COMMIT )io_kbuf_recycle (req, sel.buf_list, issue_flags); -return ret; + +return io_fixup_restart_res (ret); }int io_read_mshot (struct io_kiocb *req,unsigned int issue_flags)
@@ -995,8 +1001,10 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags)return -EAGAIN ; }else if (ret <=0 ) {io_kbuf_recycle (req, sel.buf_list, issue_flags); -if (ret <0 ) +if (ret <0 ) { + ret =io_fixup_restart_res (ret);req_set_fail (req); + } }else if (!(req->flags &REQ_F_APOLL_MULTISHOT )) { cflags =io_put_kbuf (req, ret, sel.buf_list); }else {
Signature · 1 line
2.53.0
Sasha Levin
maintainerQuoted 1 line · Jens Axboe
Seems that's already in 6.12-stable?
Not quite - stable/linux-6.12.y has no io_fixup_restart_res() at all.
What 6.12 does already have is the older inline ERESTART* -> -EINTR switch inside io_rw_done(), which is the code ab05caca123c refactors rather than the fix itself. The actual bug is still there: io_read() ends with a bare "return ret;" after __io_read(), and io_read_mshot()'s "ret <= 0" branch only does req_set_fail(), so an -ERESTARTSYS coming out of __io_read() reaches userspace as -512 unconverted.
Signature · 2 lines
Thanks, Sasha
Jens Axboe
maintainerQuoted 11 lines · Sasha Levin
Quoted 1 line · Jens Axboe
Seems that's already in 6.12-stable?
Not quite - stable/linux-6.12.y has no
io_fixup_restart_res()at all.What 6.12 does already have is the older inline ERESTART* ->
-EINTRswitch insideio_rw_done(), which is the codeab05caca123crefactors rather than the fix itself. The actual bug is still there:io_read()ends with a bare "return ret;" after__io_read(), and io_read_mshot()'s "ret <= 0" branch only doesreq_set_fail(), so an-ERESTARTSYScoming out of__io_read()reaches userspace as -512 unconverted.
Right, this original email was superseded by the later ones. As long as the sent out patches got queued up, we should be fine.
Signature · 1 line
Jens Axboe
Sasha Levin
maintainerQuoted 2 lines · Jens Axboe
Right, this original email was superseded by the later ones. As long as the sent out patches got queued up, we should be fine.
They did - "io_uring/rw: fix missing ERESTARTSYS conversion in read paths" is queued for 6.12 (and for 6.1 as well).
Signature · 2 lines
Thanks, Sasha