From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Thu, 18 Dec 2003 21:13:31 +0000 Subject: Re: Problem hotplugging USB flashdrive (race?) Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Thu, Dec 18, 2003 at 10:04:20AM -0800, Matthew Dharm wrote: > On Thu, Dec 18, 2003 at 09:53:03AM +0100, Oliver Neukum wrote: > > Am Mittwoch, 17. Dezember 2003 18:47 schrieb Greg KH: > > > On Wed, Dec 17, 2003 at 06:28:13PM +0100, Bertrik Sikken wrote: > > > > >Exactly. Try putting a sleep before reading the file, or loop on the > > > > >file for a bit before reading it. > > > > > > > > I can confirm that the sleep works (added a sleep 1 at the start > > > > of the script). Does this suggest an issue in the kernel? > > > > > > No, it's not a problem with the kernel, it's just something that you > > > need to be aware of in your hotplug scripts. > > > > Technically, it is a race condition. > > You need to make sure that user space loses the race. > > Shouldn't this actually be two separate hotplug events? > > One when the unit is physically attached, to load the usb-storage driver. > > The second when the SCSI layer has initalized the device, to run the > scsi.agent? Actually, udev cares about the _third_ event :) The one where the block device is created in sysfs. The problem is that the block device is created, hotplug is called, but the scsi core hasn't finished populating the sysfs tree with the files for the scsi device yet. It's not that big of a deal, as it's easy to detect in userspace, I just haven't added it to udev yet... thanks, greg k-h ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click _______________________________________________ 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