Skip to content

Commit 6540fbf

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: don't clear bd_invalidated in check_disk_size_change
bd_invalidated is set by check_disk_change or in add_disk to initiate a partition scan. Move it from check_disk_size_change which is called from both revalidate_disk() and bdev_disk_changed() to only the latter, as that is what is called from the block device open code (and nbd) to deal with the bd_invalidated event. revalidate_disk() on the other hand is mostly used to propagate a size update from the gendisk to the block device, which is entirely unrelated. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 653cd53 commit 6540fbf

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎fs/block_dev.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,6 @@ static void check_disk_size_change(struct gendisk *disk,
13021302
}
13031303
i_size_write(bdev->bd_inode, disk_size);
13041304
}
1305-
bdev->bd_invalidated = 0;
13061305
spin_unlock(&bdev->bd_size_lock);
13071306

13081307
if (bdev_size > disk_size) {
@@ -1391,6 +1390,8 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate)
13911390

13921391
lockdep_assert_held(&bdev->bd_mutex);
13931392

1393+
bdev->bd_invalidated = 0;
1394+
13941395
rescan:
13951396
ret = blk_drop_partitions(bdev);
13961397
if (ret)

0 commit comments

Comments
 (0)