please backport to -stable the fix for online resizing virtio disks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fix is needed to be able to resize the disk of a running KVM guest 
without having to reboot it.

(I specifically care about stable 3.2.x, since this is what Debian uses.)

The patch has been merged in RHEL as an errata since kernel 
2.6.32-358.el6 (see BZ#693940).

http://kernel.opensuse.org/cgit/kernel/commit/?id=e9986f303dc0f285401de28cf96f42f4dd23a4a1

>From e9986f303dc0f285401de28cf96f42f4dd23a4a1 Mon Sep 17 00:00:00 2001
From: Vivek Goyal <vgoyal@xxxxxxxxxx>
Date: Thu, 29 Mar 2012 08:09:44 +0000
Subject: 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.

Signed-off-by: Vivek Goyal <vgoyal@xxxxxxxxxx>
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index c4a60ba..0e4ef3d 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -351,6 +351,7 @@ static void virtblk_config_changed_work(struct work_struct *work)
 		  cap_str_10, cap_str_2);
 
 	set_capacity(vblk->disk, capacity);
+	revalidate_disk(vblk->disk);
 done:
 	mutex_unlock(&vblk->config_lock);
 }
--
cgit v0.9

-- 
ciao,
Marco
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]