lkml.org 
[lkml]   [2022]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] block: clear iocb->private in blkdev_bio_end_io_async()
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

\
 
 \ /
  Last update: 2022-02-22 02:45    [W:0.050 / U:1.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site