Commit 9bc3ffbf authored by Andrew Patterson's avatar Andrew Patterson Committed by Jens Axboe

Check for device resize when rescanning partitions

Check for device resize in the rescan_partitions() routine. If the device
has been resized, the bdev size is set to match. The rescan_partitions()
routine is called when opening the device and when calling the
BLKRRPART ioctl.
Signed-off-by: default avatarAndrew Patterson <andrew.patterson@hp.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent c3279d14
...@@ -504,7 +504,6 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) ...@@ -504,7 +504,6 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
res = invalidate_partition(disk, 0); res = invalidate_partition(disk, 0);
if (res) if (res)
return res; return res;
bdev->bd_invalidated = 0;
disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
while ((part = disk_part_iter_next(&piter))) while ((part = disk_part_iter_next(&piter)))
...@@ -513,6 +512,8 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) ...@@ -513,6 +512,8 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
if (disk->fops->revalidate_disk) if (disk->fops->revalidate_disk)
disk->fops->revalidate_disk(disk); disk->fops->revalidate_disk(disk);
check_disk_size_change(disk, bdev);
bdev->bd_invalidated = 0;
if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
return 0; return 0;
if (IS_ERR(state)) /* I/O error reading the partition table */ if (IS_ERR(state)) /* I/O error reading the partition table */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment