forked from Minki/linux
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: Hannes Reinecke <hare@suse.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
33ec3e53e7
commit
31cb1d64da
@ -1406,20 +1406,27 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev,
|
||||
*/
|
||||
int revalidate_disk(struct gendisk *disk)
|
||||
{
|
||||
struct block_device *bdev;
|
||||
int ret = 0;
|
||||
|
||||
if (disk->fops->revalidate_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);
|
||||
bdev->bd_invalidated = 0;
|
||||
mutex_unlock(&bdev->bd_mutex);
|
||||
bdput(bdev);
|
||||
/*
|
||||
* Hidden disks don't have associated bdev so there's no point in
|
||||
* revalidating it.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
EXPORT_SYMBOL(revalidate_disk);
|
||||
|
Loading…
Reference in New Issue
Block a user