* FAILED: patch "[PATCH] io_uring: fix provided buffer import" failed to apply to 5.18-stable tree @ 2022-07-04 13:24 gregkh 2022-07-05 14:36 ` Dylan Yudaken 0 siblings, 1 reply; 4+ messages in thread From: gregkh @ 2022-07-04 13:24 UTC (permalink / raw) To: dylany, axboe; +Cc: stable The patch below does not apply to the 5.18-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 <stable@vger.kernel.org>. thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 09007af2b627f0f195c6c53c4829b285cc3990ec Mon Sep 17 00:00:00 2001 From: Dylan Yudaken <dylany@fb.com> Date: Thu, 30 Jun 2022 06:20:06 -0700 Subject: [PATCH] io_uring: fix provided buffer import io_import_iovec uses the s pointer, but this was changed immediately after the iovec was re-imported and so it was imported into the wrong place. Change the ordering. Fixes: 2be2eb02e2f5 ("io_uring: ensure reads re-import for selected buffers") Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220630132006.2825668-1-dylany@fb.com [axboe: ensure we don't half-import as well] Signed-off-by: Jens Axboe <axboe@kernel.dk> diff --git a/fs/io_uring.c b/fs/io_uring.c index aeb042ba5cc5..0d491ad15b66 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4318,18 +4318,19 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags) if (unlikely(ret < 0)) return ret; } else { + rw = req->async_data; + s = &rw->s; + /* * Safe and required to re-import if we're using provided * buffers, as we dropped the selected one before retry. */ - if (req->flags & REQ_F_BUFFER_SELECT) { + if (io_do_buffer_select(req)) { ret = io_import_iovec(READ, req, &iovec, s, issue_flags); if (unlikely(ret < 0)) return ret; } - rw = req->async_data; - s = &rw->s; /* * We come here from an earlier attempt, restore our state to * match in case it doesn't. It's cheap enough that we don't ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: fix provided buffer import" failed to apply to 5.18-stable tree 2022-07-04 13:24 FAILED: patch "[PATCH] io_uring: fix provided buffer import" failed to apply to 5.18-stable tree gregkh @ 2022-07-05 14:36 ` Dylan Yudaken 2022-07-05 14:38 ` Jens Axboe 0 siblings, 1 reply; 4+ messages in thread From: Dylan Yudaken @ 2022-07-05 14:36 UTC (permalink / raw) To: gregkh, axboe; +Cc: stable [-- Attachment #1: Type: text/plain, Size: 2708 bytes --] On Mon, 2022-07-04 at 15:24 +0200, gregkh@linuxfoundation.org wrote: > > The patch below does not apply to the 5.18-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 <stable@vger.kernel.org>. > > thanks, > > greg k-h > > ------------------ original commit in Linus's tree ------------------ > > From 09007af2b627f0f195c6c53c4829b285cc3990ec Mon Sep 17 00:00:00 > 2001 > From: Dylan Yudaken <dylany@fb.com> > Date: Thu, 30 Jun 2022 06:20:06 -0700 > Subject: [PATCH] io_uring: fix provided buffer import > > io_import_iovec uses the s pointer, but this was changed immediately > after the iovec was re-imported and so it was imported into the wrong > place. > > Change the ordering. > > Fixes: 2be2eb02e2f5 ("io_uring: ensure reads re-import for selected > buffers") > Signed-off-by: Dylan Yudaken <dylany@fb.com> > Link: > https://lore.kernel.org/r/20220630132006.2825668-1-dylany@fb.com > [axboe: ensure we don't half-import as well] > Signed-off-by: Jens Axboe <axboe@kernel.dk> > > diff --git a/fs/io_uring.c b/fs/io_uring.c > index aeb042ba5cc5..0d491ad15b66 100644 > --- a/fs/io_uring.c > +++ b/fs/io_uring.c > @@ -4318,18 +4318,19 @@ static int io_read(struct io_kiocb *req, > unsigned int issue_flags) > if (unlikely(ret < 0)) > return ret; > } else { > + rw = req->async_data; > + s = &rw->s; > + > /* > * Safe and required to re-import if we're using > provided > * buffers, as we dropped the selected one before > retry. > */ > - if (req->flags & REQ_F_BUFFER_SELECT) { > + if (io_do_buffer_select(req)) { > ret = io_import_iovec(READ, req, &iovec, s, > issue_flags); > if (unlikely(ret < 0)) > return ret; > } > > - rw = req->async_data; > - s = &rw->s; > /* > * We come here from an earlier attempt, restore our > state to > * match in case it doesn't. It's cheap enough that > we don't > Hi, I have attached a fixed patch which fixes the problem on 5.18 Thanks, Dylan [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-io_uring-fix-provided-buffer-import.patch --] [-- Type: text/x-patch; name="0001-io_uring-fix-provided-buffer-import.patch", Size: 2159 bytes --] From 48e76e81093dc2e4e7f2fd2d95f0a39c1078e7bd Mon Sep 17 00:00:00 2001 From: Dylan Yudaken <dylany@fb.com> Date: Thu, 30 Jun 2022 06:20:06 -0700 Subject: [PATCH] io_uring: fix provided buffer import commit 09007af2b627f0f195c6c53c4829b285cc3990ec upstream. io_import_iovec uses the s pointer, but this was changed immediately after the iovec was re-imported and so it was imported into the wrong place. Change the ordering. Fixes: 2be2eb02e2f5 ("io_uring: ensure reads re-import for selected buffers") Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220630132006.2825668-1-dylany@fb.com [axboe: ensure we don't half-import as well] Signed-off-by: Jens Axboe <axboe@kernel.dk> --- fs/io_uring.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 7c190e885340..4d488ffb297c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3495,6 +3495,13 @@ static ssize_t io_iov_buffer_select(struct io_kiocb *req, struct iovec *iov, return __io_iov_buffer_select(req, iov, issue_flags); } +static inline bool io_do_buffer_select(struct io_kiocb *req) +{ + if (!(req->flags & REQ_F_BUFFER_SELECT)) + return false; + return !(req->flags & REQ_F_BUFFER_SELECTED); +} + static struct iovec *__io_import_iovec(int rw, struct io_kiocb *req, struct io_rw_state *s, unsigned int issue_flags) @@ -3854,18 +3861,19 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags) if (unlikely(ret < 0)) return ret; } else { + rw = req->async_data; + s = &rw->s; + /* * Safe and required to re-import if we're using provided * buffers, as we dropped the selected one before retry. */ - if (req->flags & REQ_F_BUFFER_SELECT) { + if (io_do_buffer_select(req)) { ret = io_import_iovec(READ, req, &iovec, s, issue_flags); if (unlikely(ret < 0)) return ret; } - rw = req->async_data; - s = &rw->s; /* * We come here from an earlier attempt, restore our state to * match in case it doesn't. It's cheap enough that we don't base-commit: 64ef7e725db41552c219a155ab8c1f6caf2e7cb4 -- 2.30.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: fix provided buffer import" failed to apply to 5.18-stable tree 2022-07-05 14:36 ` Dylan Yudaken @ 2022-07-05 14:38 ` Jens Axboe 2022-07-07 18:06 ` gregkh 0 siblings, 1 reply; 4+ messages in thread From: Jens Axboe @ 2022-07-05 14:38 UTC (permalink / raw) To: Dylan Yudaken, gregkh; +Cc: stable On 7/5/22 8:36 AM, Dylan Yudaken wrote: > On Mon, 2022-07-04 at 15:24 +0200, gregkh@linuxfoundation.org wrote: >> >> The patch below does not apply to the 5.18-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 <stable@vger.kernel.org>. >> >> thanks, >> >> greg k-h >> >> ------------------ original commit in Linus's tree ------------------ >> >> From 09007af2b627f0f195c6c53c4829b285cc3990ec Mon Sep 17 00:00:00 >> 2001 >> From: Dylan Yudaken <dylany@fb.com> >> Date: Thu, 30 Jun 2022 06:20:06 -0700 >> Subject: [PATCH] io_uring: fix provided buffer import >> >> io_import_iovec uses the s pointer, but this was changed immediately >> after the iovec was re-imported and so it was imported into the wrong >> place. >> >> Change the ordering. >> >> Fixes: 2be2eb02e2f5 ("io_uring: ensure reads re-import for selected >> buffers") >> Signed-off-by: Dylan Yudaken <dylany@fb.com> >> Link: >> https://lore.kernel.org/r/20220630132006.2825668-1-dylany@fb.com >> [axboe: ensure we don't half-import as well] >> Signed-off-by: Jens Axboe <axboe@kernel.dk> >> >> diff --git a/fs/io_uring.c b/fs/io_uring.c >> index aeb042ba5cc5..0d491ad15b66 100644 >> --- a/fs/io_uring.c >> +++ b/fs/io_uring.c >> @@ -4318,18 +4318,19 @@ static int io_read(struct io_kiocb *req, >> unsigned int issue_flags) >> if (unlikely(ret < 0)) >> return ret; >> } else { >> + rw = req->async_data; >> + s = &rw->s; >> + >> /* >> * Safe and required to re-import if we're using >> provided >> * buffers, as we dropped the selected one before >> retry. >> */ >> - if (req->flags & REQ_F_BUFFER_SELECT) { >> + if (io_do_buffer_select(req)) { >> ret = io_import_iovec(READ, req, &iovec, s, >> issue_flags); >> if (unlikely(ret < 0)) >> return ret; >> } >> >> - rw = req->async_data; >> - s = &rw->s; >> /* >> * We come here from an earlier attempt, restore our >> state to >> * match in case it doesn't. It's cheap enough that >> we don't >> > > Hi, > > I have attached a fixed patch which fixes the problem on 5.18 Looks good to me, thanks Dylan! -- Jens Axboe ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: fix provided buffer import" failed to apply to 5.18-stable tree 2022-07-05 14:38 ` Jens Axboe @ 2022-07-07 18:06 ` gregkh 0 siblings, 0 replies; 4+ messages in thread From: gregkh @ 2022-07-07 18:06 UTC (permalink / raw) To: Jens Axboe; +Cc: Dylan Yudaken, stable On Tue, Jul 05, 2022 at 08:38:19AM -0600, Jens Axboe wrote: > On 7/5/22 8:36 AM, Dylan Yudaken wrote: > > On Mon, 2022-07-04 at 15:24 +0200, gregkh@linuxfoundation.org wrote: > >> > >> The patch below does not apply to the 5.18-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 <stable@vger.kernel.org>. > >> > >> thanks, > >> > >> greg k-h > >> > >> ------------------ original commit in Linus's tree ------------------ > >> > >> From 09007af2b627f0f195c6c53c4829b285cc3990ec Mon Sep 17 00:00:00 > >> 2001 > >> From: Dylan Yudaken <dylany@fb.com> > >> Date: Thu, 30 Jun 2022 06:20:06 -0700 > >> Subject: [PATCH] io_uring: fix provided buffer import > >> > >> io_import_iovec uses the s pointer, but this was changed immediately > >> after the iovec was re-imported and so it was imported into the wrong > >> place. > >> > >> Change the ordering. > >> > >> Fixes: 2be2eb02e2f5 ("io_uring: ensure reads re-import for selected > >> buffers") > >> Signed-off-by: Dylan Yudaken <dylany@fb.com> > >> Link: > >> https://lore.kernel.org/r/20220630132006.2825668-1-dylany@fb.com > >> [axboe: ensure we don't half-import as well] > >> Signed-off-by: Jens Axboe <axboe@kernel.dk> > >> > >> diff --git a/fs/io_uring.c b/fs/io_uring.c > >> index aeb042ba5cc5..0d491ad15b66 100644 > >> --- a/fs/io_uring.c > >> +++ b/fs/io_uring.c > >> @@ -4318,18 +4318,19 @@ static int io_read(struct io_kiocb *req, > >> unsigned int issue_flags) > >> if (unlikely(ret < 0)) > >> return ret; > >> } else { > >> + rw = req->async_data; > >> + s = &rw->s; > >> + > >> /* > >> * Safe and required to re-import if we're using > >> provided > >> * buffers, as we dropped the selected one before > >> retry. > >> */ > >> - if (req->flags & REQ_F_BUFFER_SELECT) { > >> + if (io_do_buffer_select(req)) { > >> ret = io_import_iovec(READ, req, &iovec, s, > >> issue_flags); > >> if (unlikely(ret < 0)) > >> return ret; > >> } > >> > >> - rw = req->async_data; > >> - s = &rw->s; > >> /* > >> * We come here from an earlier attempt, restore our > >> state to > >> * match in case it doesn't. It's cheap enough that > >> we don't > >> > > > > Hi, > > > > I have attached a fixed patch which fixes the problem on 5.18 > > Looks good to me, thanks Dylan! Now queued up, thanks. greg k-h ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-07 18:06 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-07-04 13:24 FAILED: patch "[PATCH] io_uring: fix provided buffer import" failed to apply to 5.18-stable tree gregkh 2022-07-05 14:36 ` Dylan Yudaken 2022-07-05 14:38 ` Jens Axboe 2022-07-07 18:06 ` gregkh
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.