patch to enable creating device attributes before exporting h otpl ug/uevent for device kobject
Quoted 24 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, November 10, 2005 5:38 PM
To: goggin, edward
Cc: '[email protected]'
Subject: Re: patch to enable creating device attributes before exporting hotpl ug/uevent for device kobjectQuoted 1 line · edward
In order to guarantee visibility through Sysfs of device
attributes for
Quoted 2 lines
uevent/hotplug handlers, I've changed drivers/base/core.c:device_add from calling
kobject_register()before adding attributes tothe device
Quoted 10 lines
kobject to instead
(1) call
kobject_add(),(2) add the device attributes to the device kobject, and
(3) call
kobject_hotplug()to export the kobject ONLY AFTER the
attributes
are added to the device object.
Quoted 8 lines
Quoted 1 line
Also, changed
scsi_sysfs_add_sdev()to follow this newsequence for creating
Quoted 1 line
scsi device objects.
Ick. First a few general comments on procedure:
- please CC: linux-hotplug devel, or linux-kernel with core
stuff like
this.
OK. Thanks.
Quoted 1 line
- your patch was line-wrapped, and could not be applied :(
I'm having a terrible time with the line-wrapping. I'll work on it.
Quoted 2 lines
- No Signed-off-by: line as per the rules specified in
Documentation/SubmittingPatches.
Guilty as charged. I'll read Documentation/SubmittingPatches. Thanks.
Quoted 4 lines
Ok, now, what exactly are you trying to solve here? With 2.6.14 and udev handling the hotplug control, you should not see any need for a change like this.
The multipathd uevent handler is sometimes failing to find attribute files for scsi sysfs kobjects like those found under /sys/block/sda/device/ because
these sysfs attributes are created after the kobject is added to sysfs. Hotplug
and udev are not involved.
Quoted 5 lines
thanks,
greg k-h
Quoted 5 lines · edward
The multipathd uevent handler is sometimes failing to find attribute files for scsi sysfs kobjects like those found under
/sys/block/sda/device/because these sysfs attributes are created after the kobject is added to sysfs. Hotplug and udev are not involved.
Then make it involved. On modern distros, /sbin/hotplug is disabled to NULL. udevd watches the netlink socket and handles all of the event ordering. Add your hook in a udev rule and you will not have to worry about the wait issues at all, thereby sparing the kernel these nasty changes.
Or just copy the logic out of the udev codebase for your userspace code, as long as it's under the GPL, you are fine to do so.
thanks,
greg k-h