Skip to content

Commit 89515d0

Browse files
msolsonkonradwilk
authored andcommitted
blkfront: add uevent for size change
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 <[email protected]> Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
1 parent a2c9790 commit 89515d0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/block/xen-blkfront.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,6 +2345,7 @@ static void blkfront_connect(struct blkfront_info *info)
23452345
unsigned long sector_size;
23462346
unsigned int physical_sector_size;
23472347
unsigned int binfo;
2348+
char *envp[] = { "RESIZE=1", NULL };
23482349
int err, i;
23492350

23502351
switch (info->connected) {
@@ -2361,6 +2362,8 @@ static void blkfront_connect(struct blkfront_info *info)
23612362
sectors);
23622363
set_capacity(info->gd, sectors);
23632364
revalidate_disk(info->gd);
2365+
kobject_uevent_env(&disk_to_dev(info->gd)->kobj,
2366+
KOBJ_CHANGE, envp);
23642367

23652368
return;
23662369
case BLKIF_STATE_SUSPENDED:

0 commit comments

Comments
 (0)