Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1434160 > unrolled thread

[PATCH v2 04/12] axonrom: Generate uevent after attribute available

Started byFam Zheng <famz@redhat.com>
First post2016-06-30 04:10 +0200
Last post2016-07-01 03:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 04/12] axonrom: Generate uevent after attribute available Fam Zheng <famz@redhat.com> - 2016-06-30 04:10 +0200
    Re: [PATCH v2 04/12] axonrom: Generate uevent after attribute available Dan Williams <dan.j.williams@gmail.com> - 2016-07-01 00:20 +0200
      Re: [PATCH v2 04/12] axonrom: Generate uevent after attribute  available Fam Zheng <famz@redhat.com> - 2016-07-01 03:20 +0200

#1434160 — [PATCH v2 04/12] axonrom: Generate uevent after attribute available

FromFam Zheng <famz@redhat.com>
Date2016-06-30 04:10 +0200
Subject[PATCH v2 04/12] axonrom: Generate uevent after attribute available
Message-ID<rPzAt-3BV-3@gated-at.bofh.it>
It is documented that KOBJ_ADD should be generated after the object's
attributes and children are ready.  We can achieve this with the new
disk_gen_uevents interface.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 arch/powerpc/sysdev/axonram.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 4efd69b..27e7175 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -238,7 +238,7 @@ static int axon_ram_probe(struct platform_device *device)
 	set_capacity(bank->disk, bank->size >> AXON_RAM_SECTOR_SHIFT);
 	blk_queue_make_request(bank->disk->queue, axon_ram_make_request);
 	blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
-	add_disk(bank->disk, true);
+	add_disk(bank->disk, false);
 
 	bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
 	if (bank->irq_id == NO_IRQ) {
@@ -262,6 +262,7 @@ static int axon_ram_probe(struct platform_device *device)
 		rc = -EFAULT;
 		goto failed;
 	}
+	disk_gen_uevents(bank->disk);
 
 	azfs_minor += bank->disk->minors;
 
-- 
2.9.0

[toc] | [next] | [standalone]


#1434887

FromDan Williams <dan.j.williams@gmail.com>
Date2016-07-01 00:20 +0200
Message-ID<rPSts-6J4-39@gated-at.bofh.it>
In reply to#1434160
On Wed, Jun 29, 2016 at 6:59 PM, Fam Zheng <famz@redhat.com> wrote:
> It is documented that KOBJ_ADD should be generated after the object's
> attributes and children are ready.  We can achieve this with the new
> disk_gen_uevents interface.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  arch/powerpc/sysdev/axonram.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
> index 4efd69b..27e7175 100644
> --- a/arch/powerpc/sysdev/axonram.c
> +++ b/arch/powerpc/sysdev/axonram.c
> @@ -238,7 +238,7 @@ static int axon_ram_probe(struct platform_device *device)
>         set_capacity(bank->disk, bank->size >> AXON_RAM_SECTOR_SHIFT);
>         blk_queue_make_request(bank->disk->queue, axon_ram_make_request);
>         blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
> -       add_disk(bank->disk, true);
> +       add_disk(bank->disk, false);
>
>         bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
>         if (bank->irq_id == NO_IRQ) {
> @@ -262,6 +262,7 @@ static int axon_ram_probe(struct platform_device *device)
>                 rc = -EFAULT;
>                 goto failed;
>         }
> +       disk_gen_uevents(bank->disk);

I assume you are doing this after:

   rc = device_create_file(&device->dev, &dev_attr_ecc);

...so that userspace gets notified of the new attribute, but this
attribute is on the parent device, not the disk itself.  Instead I
think this attribute should simply be registered before the call to
add_disk().  Then the KOBJ_ADD event for the disk comes after the
attribute is available.  It's still not a clean fit, because userspace
should not be expecting a child device uevent to signal new attributes
available on the parent.

[toc] | [prev] | [next] | [standalone]


#1434943 — Re: [PATCH v2 04/12] axonrom: Generate uevent after attribute available

FromFam Zheng <famz@redhat.com>
Date2016-07-01 03:20 +0200
SubjectRe: [PATCH v2 04/12] axonrom: Generate uevent after attribute available
Message-ID<rPVhD-8tw-1@gated-at.bofh.it>
In reply to#1434887
On Thu, 06/30 15:10, Dan Williams wrote:
> On Wed, Jun 29, 2016 at 6:59 PM, Fam Zheng <famz@redhat.com> wrote:
> > It is documented that KOBJ_ADD should be generated after the object's
> > attributes and children are ready.  We can achieve this with the new
> > disk_gen_uevents interface.
> >
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  arch/powerpc/sysdev/axonram.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
> > index 4efd69b..27e7175 100644
> > --- a/arch/powerpc/sysdev/axonram.c
> > +++ b/arch/powerpc/sysdev/axonram.c
> > @@ -238,7 +238,7 @@ static int axon_ram_probe(struct platform_device *device)
> >         set_capacity(bank->disk, bank->size >> AXON_RAM_SECTOR_SHIFT);
> >         blk_queue_make_request(bank->disk->queue, axon_ram_make_request);
> >         blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
> > -       add_disk(bank->disk, true);
> > +       add_disk(bank->disk, false);
> >
> >         bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
> >         if (bank->irq_id == NO_IRQ) {
> > @@ -262,6 +262,7 @@ static int axon_ram_probe(struct platform_device *device)
> >                 rc = -EFAULT;
> >                 goto failed;
> >         }
> > +       disk_gen_uevents(bank->disk);
> 
> I assume you are doing this after:
> 
>    rc = device_create_file(&device->dev, &dev_attr_ecc);
> 
> ...so that userspace gets notified of the new attribute, but this
> attribute is on the parent device, not the disk itself.  Instead I
> think this attribute should simply be registered before the call to
> add_disk().  Then the KOBJ_ADD event for the disk comes after the
> attribute is available.  It's still not a clean fit, because userspace
> should not be expecting a child device uevent to signal new attributes
> available on the parent.

Yes you are right, this patch is a mistake. Moving to before add_disk makes
sense to me.

Thanks for taking a look!

Fam

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web