From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Thu, 17 Jun 2004 18:09:30 +0000 Subject: Re: Delayed hotplug events Message-Id: <20040617180930.GB18134@kroah.com> List-Id: References: <40D17ECC.20501@suse.de> In-Reply-To: <40D17ECC.20501@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Thu, Jun 17, 2004 at 01:21:48PM +0200, Hannes Reinecke wrote: > Hi all, > > currently we have the problem that the driver core might send out > hotplug events even though the initialisation of a device has not been > finished; worse, we might get an "add" followed by an "remove" event if > the device fails to initialise properly, with the corresponding device > never appearing in sysfs properly. Exactly, that is why udevd handles the reordering of hotplug events. It seems that suse is not using udevd, and hence needs to handle these out of order events somehow :) > This is due to the design of the driver core: > a call to device_register will trigger a hotplug event, but any sysfs > attributes which are added _after_ device_register() will in fact > created after the hotplug event has been triggered. This is a known "issue", nothing new here. > For the unbelievers, look at > drivers/scsi/scsi_sysfs.c:scsi_sysfs_add_sdev(). This leads to all > sorts of nasty race conditions and waiting loops in the hotplug > agents. > > To solve this I've wrapped up a patch for delaying / suspending hotplug > events until they are explicitely enabled again. Nope, solve this in userspace, not with a patch like this. > As an example of how it should be used I've patched > drivers/scsi/scsi_sysfs.c:scsi_sysfs_add_sdev(), so that the device > "add" event will now be triggered only _after_ the device has been > initialised properly, including all sysfs attributes. > > Is this approach feasible or am I completely off kilter here? Off kilter :) > And if the latter, how should it be solved properly? In userspace, with things like udevd and just simply sleeping for a short ammount of time to allow the kernel to catch up to userspace :) thanks, greg k-h ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel