block: clear iocb->private in blkdev_bio_end_io_async()
PATCH 1/1 block: clear iocb->private in blkdev_bio_end_io_async()
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 recently added blkdev_bio_end_io_async().
---
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(+)
block/fops.c +2 -0
@@ -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 ); +if (likely (!bio->bi_status)) { ret = dio->size; iocb->ki_pos += ret;
Signature · 1 line
2.34.1
Gentle ping :-)
Quoted 36 lines · Stefano Garzarella
iocb_bio_iopoll()expectsiocb->privateto be cleared before releasing the bio.We already do this in
blkdev_bio_end_io(), but we forgot in the recently addedblkdev_bio_end_io_async().Fixes 54a88eb838d3 ("block: add single bio async direct IO helper")Signed-off-by Stefano Garzarella <[email protected]>---
I haven't seen a failure, I was just reading the code to understand iopoll, so IIUC we should cleaniocb->privateinblkdev_bio_end_io_async().Thanks,
Stefano--- block/fops.c | 2 ++ 1 file changed, 2 insertions(+)block/fops.c +2
-1@@ -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 ); +if (likely (!bio->bi_status)) { ret = dio->size; iocb->ki_pos += ret; --2.34.1
Quoted 4 lines · Stefano Garzarella
iocb_bio_iopoll()expectsiocb->privateto 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().
Quoted 20 lines
recently added
blkdev_bio_end_io_async().Fixes 54a88eb838d3 ("block: add single bio async direct IO helper")Signed-off-by Stefano Garzarella <[email protected]>---
I haven't seen a failure, I was just reading the code to understand iopoll, so IIUC we should cleaniocb->privateinblkdev_bio_end_io_async().Thanks,
Stefano--- block/fops.c | 2 ++ 1 file changed, 2 insertions(+)block/fops.c +0
-0
block/fops.c static void blkdev_bio_end_io_async(struct bio *bio) · line 292
Quoted 4 lines
block/fops.c +1
-0@@ -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:
Thanks,
Ming
Looks good,
Quoted 8 lines · Stefano Garzarella
iocb_bio_iopoll()expectsiocb->privateto be cleared before releasing the bio.We already do this in
blkdev_bio_end_io(), but we forgot in the recently addedblkdev_bio_end_io_async().[...]
Applied, thanks!
[1/1] block: clear iocb->private in blkdev_bio_end_io_async()
commit: bb49c6fa8b845591b317b0d7afea4ae60ec7f3aa
Best regards,
Signature · 1 line
Jens Axboe