From: Ming Lei <ming.lei@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-kernel@vger.kernel.org,
Pavel Begunkov <asml.silence@gmail.com>,
linux-block@vger.kernel.org
Subject: Re: [PATCH] block: clear iocb->private in blkdev_bio_end_io_async()
Date: Tue, 22 Feb 2022 09:43:04 +0800 [thread overview]
Message-ID: <YhQ/qM6S34TwVCSq@T590> (raw)
In-Reply-To: <20220211090136.44471-1-sgarzare@redhat.com>
On Fri, Feb 11, 2022 at 10:01:36AM +0100, Stefano Garzarella wrote:
> iocb_bio_iopoll() expects iocb->private to be cleared before
> releasing the bio.
>
> We already do this in blkdev_bio_end_io(), but we forgot in the
But also iomap_dio_bio_end_io().
> recently added blkdev_bio_end_io_async().
>
> Fixes: 54a88eb838d3 ("block: add single bio async direct IO helper")
> Cc: asml.silence@gmail.com
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
> I haven't seen a failure, I was just reading the code to understand iopoll,
> so IIUC we should clean iocb->private in blkdev_bio_end_io_async().
>
> Thanks,
> Stefano
> ---
> block/fops.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/block/fops.c b/block/fops.c
> index 4f59e0f5bf30..a18e7fbd97b8 100644
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -289,6 +289,8 @@ static void blkdev_bio_end_io_async(struct bio *bio)
> struct kiocb *iocb = dio->iocb;
> ssize_t ret;
>
> + WRITE_ONCE(iocb->private, NULL);
It might cause race in case of concurrent polling on same queue without
clearing iocb->private, so looks fine:
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
next prev parent reply other threads:[~2022-02-22 1:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 9:01 [PATCH] block: clear iocb->private in blkdev_bio_end_io_async() Stefano Garzarella
2022-02-21 11:49 ` Stefano Garzarella
2022-02-22 1:43 ` Ming Lei [this message]
2022-02-22 8:21 ` Christoph Hellwig
2022-02-22 14:00 ` Jens Axboe
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=YhQ/qM6S34TwVCSq@T590 \
--to=ming.lei@redhat.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sgarzare@redhat.com \
/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