Commit 31cb1d64 authored by Jan Kara's avatar Jan Kara Committed by Jens Axboe

block: Don't revalidate bdev of hidden gendisk

When hidden gendisk is revalidated, there's no point in revalidating
associated block device as there's none. We would thus just create new
bdev inode, report "detected capacity change from 0 to XXX" message and
evict the bdev inode again. Avoid this pointless dance and confusing
message in the kernel log.
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 33ec3e53
...@@ -1406,20 +1406,27 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev, ...@@ -1406,20 +1406,27 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev,
*/ */
int revalidate_disk(struct gendisk *disk) int revalidate_disk(struct gendisk *disk)
{ {
struct block_device *bdev;
int ret = 0; int ret = 0;
if (disk->fops->revalidate_disk) if (disk->fops->revalidate_disk)
ret = disk->fops->revalidate_disk(disk); ret = disk->fops->revalidate_disk(disk);
bdev = bdget_disk(disk, 0);
if (!bdev)
return ret;
mutex_lock(&bdev->bd_mutex); /*
check_disk_size_change(disk, bdev, ret == 0); * Hidden disks don't have associated bdev so there's no point in
bdev->bd_invalidated = 0; * revalidating it.
mutex_unlock(&bdev->bd_mutex); */
bdput(bdev); if (!(disk->flags & GENHD_FL_HIDDEN)) {
struct block_device *bdev = bdget_disk(disk, 0);
if (!bdev)
return ret;
mutex_lock(&bdev->bd_mutex);
check_disk_size_change(disk, bdev, ret == 0);
bdev->bd_invalidated = 0;
mutex_unlock(&bdev->bd_mutex);
bdput(bdev);
}
return ret; return ret;
} }
EXPORT_SYMBOL(revalidate_disk); EXPORT_SYMBOL(revalidate_disk);
......
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