Skip to contentSkip to conversation

block: sync part's ->bd_has_submit_bio with disk's

PATCH Applied Ming Lei 2 participants 2 messages Apr 25, 2023 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: sync part's ->bd_has_submit_bio with disk's

submit_bio() always uses bio->bi_bdev->bd_has_submit_bio to decide if disk's ->submit_bio() is called, and bio->bi_bdev could point to one partition device.

So we have to sync part bdev's ->bd_has_submit_bio with disk's.

Fixes 9f4107b07b17 ("block: store bdev->bd_disk->fops->submit_bio state in bdev")
---
 block/bdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
block/bdev.c +4 -1
index 850852fe4b78..f1aee35ca266 100644
@@ -418,8 +418,11 @@ struct block_device *bdev_alloc(struct gendisk *disk, u8 partno)
 	bdev->bd_partno = partno;
 	bdev->bd_inode = inode;
 	bdev->bd_queue = disk->queue;
+	if (partno)
+		bdev->bd_has_submit_bio = disk->part0->bd_has_submit_bio;
+	else
+		bdev->bd_has_submit_bio = false;
 	bdev->bd_stats = alloc_percpu(struct disk_stats);
-	bdev->bd_has_submit_bio = false;
 	if (!bdev->bd_stats) {
 		iput(inode);
 		return NULL;
Signature · 1 line
2.40.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Ming Lei

submit_bio() always uses bio->bi_bdev->bd_has_submit_bio to decide if disk's ->submit_bio() is called, and bio->bi_bdev could point to one partition device.

So we have to sync part bdev's ->bd_has_submit_bio with disk's.

[...]

Applied, thanks!

[1/1] block: sync part's ->bd_has_submit_bio with disk's
(no commit info)

Best regards,

Signature · 1 line
Jens Axboe