Skip to content

Commit

Permalink
block: sync part's ->bd_has_submit_bio with disk's
Browse files Browse the repository at this point in the history
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: 9f4107b ("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]>
  • Loading branch information
Ming Lei authored and axboe committed Apr 25, 2023
1 parent 8379436 commit 38c8e3d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion block/bdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 38c8e3d

Please sign in to comment.