Block layer sends ADD uevent when new device is initialised.
But the device-mapper block devices are more complex,
initialisation consists of allocating underlying device and
loading mapping table.
Because from the userspace all block devices should behave
the same, patch defines new flag indicating that ADD event
should be suppressed in block layer.
If the flag is set, caller then take full responsibility
for enabling and sending events later when device is ready
to use.
/*
+ * Is the device initialised? (Add event was sent.)
+ */
+int dm_initialised_md(struct mapped_device *md);
+
+/*
* The device-mapper can be driven through one of two interfaces;
* ioctl or filesystem, depending which patch you have applied.
*/
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index e8865c1..916173b 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -526,6 +526,10 @@ void register_disk(struct gendisk *disk)
blkdev_put(bdev, FMODE_READ);
exit:
+ /* caller will send ADD event later */
+ if (disk->flags & GENHD_FL_SUPPRESS_ADD_EVENT)
+ return;
+
/* announce disk after possible partitions are created */
dev_set_uevent_suppress(ddev, 0);
kobject_uevent(&ddev->kobj, KOBJ_ADD);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 56b5051..ade71ff 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -116,6 +116,7 @@ struct hd_struct {
#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
#define GENHD_FL_NATIVE_CAPACITY 128
+#define GENHD_FL_SUPPRESS_ADD_EVENT 256
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
03-19-2010, 08:06 AM
Lars Ellenberg
Send KOBJ_ADD event after dm resume ioctl.
On Fri, Mar 19, 2010 at 09:27:35AM +0100, Kay Sievers wrote:
> On Thu, Mar 18, 2010 at 22:35, Milan Broz <mbroz@redhat.com> wrote:
>
> > But if your statement is "it is your broken activation model" as you said
> > in some discussion, I can do nothing, just disagree - it is different model,
> > not broken.
>
> Sure, if you are fine with that model, I'm fine with it too. You are
> the one sending patches to mangle basic driver-core definitions to
> paper-over some issues dm seem to have with it. I just object to such
> core changes, not to the way dm is doing things.
>
> I have no problem with dm creating "dead" devices, it's like this
> since a long time, but please don't try to fake things in the driver
> core to make it look different from what it is. We don't want /sys and
> /dev and events to be out of sync, like non-"add"-ed devices which are
> fully created in /sys, or "remove"-d devices which are still fully
> populated in /sys.
>
> /sys is the direct export of kernel objects, if you create objects,
> they appear, and they get announced. If you don't want them to be
> announced at that time, just don't register them at that time.
>
> Don't get me wrong, I'm not asking you to change the current state how
> dm is doing things, I just object to the patch which inconsistently
> tries to fake events, which do not match the state in /sys.
Would introducing a KOBJ_READY_TO_BE_CONSUMED_BY_UDEV help?
Or re-using KOBJ_ONLINE for that purpose,
even though it has different meaning elsewhere?
Lars
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel