]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
blkfront: add uevent for size change
authorMarc Olson <marcolso@amazon.com>
Tue, 11 Apr 2017 19:24:09 +0000 (12:24 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Wed, 13 Sep 2017 04:37:57 +0000 (21:37 -0700)
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.

With this patch you get these udev

KERNEL[577.206230] change   /devices/vbd-51728/block/xvdb (block)
UDEV  [577.226218] change   /devices/vbd-51728/block/xvdb (block)

Signed-off-by: Marc Olson <marcolso@amazon.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
OraBug: 26662731

(cherry picked from commit 89515d0255c918e08aa4085956c79bf17615fda5)
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
drivers/block/xen-blkfront.c

index 3e4576854364d3a379d1a82e818487e0122aad2c..d824ef13c82d0990ec845bfbaf6e6b80de8bb251 100644 (file)
@@ -2594,6 +2594,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, i;
 
        switch (info->connected) {
@@ -2610,6 +2611,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: