Skip to contentSkip to conversation

virtio-blk: Call revalidate_disk() upon online disk resize

PATCH In review Vivek Goyal 2 participants 2 messages Mar 28, 2012 – Mar 29, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-blk: Call revalidate_disk() upon online disk resize

If a virtio disk is open in guest and a disk resize operation is done, (virsh blockresize), new size is not visible to tools like "fdisk -l". This seems to be happening as we update only part->nr_sects and not bdev->bd_inode size.

Call revalidate_disk() which should take care of it. I tested growing disk size of already open disk and it works for me.

---
 drivers/block/virtio_blk.c |    1 +
 1 file changed, 1 insertion(+)
drivers/block/virtio_blk.c +1 -0
Index: linux-2.6/drivers/block/virtio_blk.c
===================================================================
@@ -351,6 +351,7 @@ static void virtblk_config_changed_work(
 		  cap_str_10, cap_str_2);
 
 	set_capacity(vblk->disk, capacity);
+	revalidate_disk(vblk->disk);
 done:
 	mutex_unlock(&vblk->config_lock);
 }
maintainer
#1 lore raw
Quoted 7 lines · Vivek Goyal

If a virtio disk is open in guest and a disk resize operation is done, (virsh blockresize), new size is not visible to tools like "fdisk -l". This seems to be happening as we update only part->nr_sects and not bdev->bd_inode size.

Call revalidate_disk() which should take care of it. I tested growing disk size of already open disk and it works for me.

Thanks, obviously right. Applied.

Signature · 1 line
Jens Axboe