From: Jens Axboe <axboe@kernel.dk>
To: stable <stable@vger.kernel.org>
Cc: "song@kernel.org" <song@kernel.org>
Subject: 5.19 and 5.15 stable patches
Date: Thu, 25 Aug 2022 10:21:38 -0600 [thread overview]
Message-ID: <a603cfc5-9ba5-20c3-3fec-2c4eec4350f7@kernel.dk> (raw)
[-- Attachment #1: Type: text/plain, Size: 115 bytes --]
Hi,
Backport of fix that went into 6.0-rc1 for 5.19-stable and
5.15-stable. Please apply, thanks!
--
Jens Axboe
[-- Attachment #2: 5.15-0001-io_uring-fix-issue-with-io_write-not-always-undoing-.patch --]
[-- Type: text/x-patch, Size: 1241 bytes --]
From 952c7ac49a59eb115790d1ec55974303c9d2f0fd Mon Sep 17 00:00:00 2001
From: Jens Axboe <axboe@kernel.dk>
Date: Thu, 25 Aug 2022 10:19:08 -0600
Subject: [PATCH] io_uring: fix issue with io_write() not always undoing
sb_start_write()
commit e053aaf4da56cbf0afb33a0fda4a62188e2c0637 upstream.
This is actually an older issue, but we never used to hit the -EAGAIN
path before having done sb_start_write(). Make sure that we always call
kiocb_end_write() if we need to retry the write, so that we keep the
calls to sb_start_write() etc balanced.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
fs/io_uring.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index a7097495b433..ccf9bd808273 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3720,7 +3720,12 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
copy_iov:
iov_iter_restore(iter, state);
ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
- return ret ?: -EAGAIN;
+ if (!ret) {
+ if (kiocb->ki_flags & IOCB_WRITE)
+ kiocb_end_write(req);
+ return -EAGAIN;
+ }
+ return ret;
}
out_free:
/* it's reportedly faster than delegating the null check to kfree() */
--
2.35.1
[-- Attachment #3: 5.19-0001-io_uring-fix-issue-with-io_write-not-always-undoing-.patch --]
[-- Type: text/x-patch, Size: 1268 bytes --]
From e6ab6c526bab6020869d6d97eb46bec06b4fd287 Mon Sep 17 00:00:00 2001
From: Jens Axboe <axboe@kernel.dk>
Date: Thu, 25 Aug 2022 10:17:25 -0600
Subject: [PATCH] io_uring: fix issue with io_write() not always undoing
sb_start_write()
commit e053aaf4da56cbf0afb33a0fda4a62188e2c0637 upstream.
This is actually an older issue, but we never used to hit the -EAGAIN
path before having done sb_start_write(). Make sure that we always call
kiocb_end_write() if we need to retry the write, so that we keep the
calls to sb_start_write() etc balanced.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/io_uring.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 6a67dbf5195f..cd155b7e1346 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -4331,7 +4331,12 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
copy_iov:
iov_iter_restore(&s->iter, &s->iter_state);
ret = io_setup_async_rw(req, iovec, s, false);
- return ret ?: -EAGAIN;
+ if (!ret) {
+ if (kiocb->ki_flags & IOCB_WRITE)
+ kiocb_end_write(req);
+ return -EAGAIN;
+ }
+ return ret;
}
out_free:
/* it's reportedly faster than delegating the null check to kfree() */
--
2.35.1
next reply other threads:[~2022-08-25 16:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 16:21 Jens Axboe [this message]
2022-08-29 8:01 ` 5.19 and 5.15 stable patches Greg KH
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=a603cfc5-9ba5-20c3-3fec-2c4eec4350f7@kernel.dk \
--to=axboe@kernel.dk \
--cc=song@kernel.org \
--cc=stable@vger.kernel.org \
/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