diff options
| author | Ming Lei <[email protected]> | 2023-04-25 11:41:54 +0800 |
|---|---|---|
| committer | Jens Axboe <[email protected]> | 2023-04-25 07:36:02 -0600 |
| commit | 38c8e3dfb2a1be863b7f5aad7755d5e9727da8a5 (patch) | |
| tree | 930d91b6701d2c75013186514796cdde87534bef | |
| parent | 83794367dcc6749662b17a1e4b8ec085023fc53b (diff) | |
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.
Reported-by: Changhui Zhong <[email protected]>
Link: https://lore.kernel.org/linux-block/[email protected]/T/#t
Fixes: 9f4107b07b17 ("block: store bdev->bd_disk->fops->submit_bio state in bdev")
Signed-off-by: Ming Lei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
| -rw-r--r-- | block/bdev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/block/bdev.c b/block/bdev.c index 717089a5726f..21c63bfef323 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -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; |