* [PATCH] blkfront: add uevent for size change
@ 2017-04-11 19:24 Marc Olson
0 siblings, 0 replies; 6+ messages in thread
From: Marc Olson @ 2017-04-11 19:24 UTC (permalink / raw)
To: xen-devel
Cc: linux-kernel, Boris Ostrovsky, Roger Pau Monné, David Vrabel
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>
---
drivers/block/xen-blkfront.c | 3 +++
1 file changed, 3 insertions(+)
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:
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] blkfront: add uevent for size change
2017-04-11 20:04 ` Konrad Rzeszutek Wilk
2017-04-12 0:05 ` Marc Olson
@ 2017-04-12 0:05 ` Marc Olson
1 sibling, 0 replies; 6+ messages in thread
From: Marc Olson @ 2017-04-12 0:05 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: xen-devel, Roger Pau Monné,
Boris Ostrovsky, David Vrabel, linux-kernel
On Tue, Apr 11, 2017 at 04:04:59PM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Apr 11, 2017 at 12:24:09PM -0700, Marc Olson wrote:
> > 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.
>
> Looks pretty reasonable.
>
> Could you confirm what the udevadm --monitor --kernel --udev emits when this happens?
Relevant output:
KERNEL[577.206230] change /devices/vbd-51728/block/xvdb (block)
UDEV [577.226218] change /devices/vbd-51728/block/xvdb (block)
Of course, this is missing without the patch.
/marc
>
> Thanks!
>
> >
> > Signed-off-by: Marc Olson <marcolso@amazon.com>
> > ---
> > drivers/block/xen-blkfront.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > 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:
> > --
> > 2.7.4
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] blkfront: add uevent for size change
2017-04-11 20:04 ` Konrad Rzeszutek Wilk
@ 2017-04-12 0:05 ` Marc Olson
2017-04-12 0:05 ` Marc Olson
1 sibling, 0 replies; 6+ messages in thread
From: Marc Olson @ 2017-04-12 0:05 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: xen-devel, Boris Ostrovsky, David Vrabel, linux-kernel,
Roger Pau Monné
On Tue, Apr 11, 2017 at 04:04:59PM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Apr 11, 2017 at 12:24:09PM -0700, Marc Olson wrote:
> > 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.
>
> Looks pretty reasonable.
>
> Could you confirm what the udevadm --monitor --kernel --udev emits when this happens?
Relevant output:
KERNEL[577.206230] change /devices/vbd-51728/block/xvdb (block)
UDEV [577.226218] change /devices/vbd-51728/block/xvdb (block)
Of course, this is missing without the patch.
/marc
>
> Thanks!
>
> >
> > Signed-off-by: Marc Olson <marcolso@amazon.com>
> > ---
> > drivers/block/xen-blkfront.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > 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:
> > --
> > 2.7.4
> >
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] blkfront: add uevent for size change
2017-04-11 19:24 Marc Olson
@ 2017-04-11 20:04 ` Konrad Rzeszutek Wilk
2017-04-12 0:05 ` Marc Olson
2017-04-12 0:05 ` Marc Olson
2017-04-11 20:04 ` Konrad Rzeszutek Wilk
1 sibling, 2 replies; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-04-11 20:04 UTC (permalink / raw)
To: Marc Olson
Cc: xen-devel, Roger Pau Monné,
Boris Ostrovsky, David Vrabel, linux-kernel
On Tue, Apr 11, 2017 at 12:24:09PM -0700, Marc Olson wrote:
> 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.
Looks pretty reasonable.
Could you confirm what the udevadm --monitor --kernel --udev emits when this happens?
Thanks!
>
> Signed-off-by: Marc Olson <marcolso@amazon.com>
> ---
> drivers/block/xen-blkfront.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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:
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] blkfront: add uevent for size change
2017-04-11 19:24 Marc Olson
2017-04-11 20:04 ` Konrad Rzeszutek Wilk
@ 2017-04-11 20:04 ` Konrad Rzeszutek Wilk
1 sibling, 0 replies; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2017-04-11 20:04 UTC (permalink / raw)
To: Marc Olson
Cc: xen-devel, Boris Ostrovsky, David Vrabel, linux-kernel,
Roger Pau Monné
On Tue, Apr 11, 2017 at 12:24:09PM -0700, Marc Olson wrote:
> 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.
Looks pretty reasonable.
Could you confirm what the udevadm --monitor --kernel --udev emits when this happens?
Thanks!
>
> Signed-off-by: Marc Olson <marcolso@amazon.com>
> ---
> drivers/block/xen-blkfront.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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:
> --
> 2.7.4
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] blkfront: add uevent for size change
@ 2017-04-11 19:24 Marc Olson
2017-04-11 20:04 ` Konrad Rzeszutek Wilk
2017-04-11 20:04 ` Konrad Rzeszutek Wilk
0 siblings, 2 replies; 6+ messages in thread
From: Marc Olson @ 2017-04-11 19:24 UTC (permalink / raw)
To: xen-devel
Cc: Konrad Rzeszutek Wilk, Roger Pau Monné,
Boris Ostrovsky, David Vrabel, linux-kernel
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>
---
drivers/block/xen-blkfront.c | 3 +++
1 file changed, 3 insertions(+)
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:
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-04-12 0:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 19:24 [PATCH] blkfront: add uevent for size change Marc Olson
2017-04-11 19:24 Marc Olson
2017-04-11 20:04 ` Konrad Rzeszutek Wilk
2017-04-12 0:05 ` Marc Olson
2017-04-12 0:05 ` Marc Olson
2017-04-11 20:04 ` Konrad Rzeszutek Wilk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.