diff mbox

[aws] UBUNTU: SAUCE: blkfront: add uevent for size change

Message ID 1492537827-20968-2-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa April 18, 2017, 5:50 p.m. UTC
From: Marc Olson <marcolso@amazon.com>

BugLink: https://bugs.launchpad.net/bugs/1683878

When a blkfront device is resized from dom0, emit a KOBJ_CHANGE uevent to
notify the guest about the change. This allows for custom udev rules, such
as automatically resizing a filesystem, when an event occurs.

Signed-off-by: Marc Olson <marcolso@amazon.com>
Reference: https://lkml.org/lkml/2017/4/11/736
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/xen-blkfront.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stefan Bader April 20, 2017, 11:09 a.m. UTC | #1
Applied to aws branch while re-spinning.
diff mbox

Patch

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 2fee2ee..66abf9c 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1996,6 +1996,7 @@  static void blkfront_connect(struct blkfront_info *info)
 	unsigned long sector_size;
 	unsigned int physical_sector_size;
 	unsigned int binfo;
+	char *envp[] = { "RESIZE=1", NULL };
 	int err;
 
 	switch (info->connected) {
@@ -2012,6 +2013,8 @@  static void blkfront_connect(struct blkfront_info *info)
 		       sectors);
 		set_capacity(info->gd, sectors);
 		revalidate_disk(info->gd);
+		kobject_uevent_env(&disk_to_dev(info->gd)->kobj,
+				   KOBJ_CHANGE, envp);
 
 		return;
 	case BLKIF_STATE_SUSPENDED: