From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Thu, 15 Sep 2005 15:34:47 +0000 Subject: Re: udev synchronization problems Message-Id: <20050915153447.GA7187@vrfy.org> List-Id: References: <4328D34C.7070008@jcwren.com> In-Reply-To: <4328D34C.7070008@jcwren.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Wed, Sep 14, 2005 at 09:50:04PM -0400, J.C. Wren wrote: > Forgive me if this has been addressed before. I did some googling > for answers, but either there are none, or more likely, I am not using > the correct search terms for useful results. > > I have a script to create compact flash cards for an application. > It worked well until I switched from devfs to udev. > > The script is pretty basic. sfdisk, mke2fs, tune2fs, mount, cp, > umount. I run into errors where sfdisk completes, then mke2fs complains > that /dev/hde1 (hde is the PCMCIA CF card) doesn't exist. Or sometimes > it gets past that, and tune2fs complains /dev/hde1 doesn't exist. > > As near as I can tell, it's because udevd doesn't react fast enough > (from my scripts perspective) and present /dev/hde1 once it's been > created. So I tried a few things. I put a loop in the script waiting > for /dev/hde1 to become present. Didn't fix it. Added some 'sleep 1' > commands. Didn't fix it. Tried a while loop that waited for /dev/hde1 > to become present in /proc/partitions. Didn't fix it. However, running > these commands by hand almost always succeed. > > Is there some reliable way to determine that /dev/hde1 is *really* > there, and ready for action? > > I've tried 2.6.12-gentoo-r10, 2.6.13 (vanilla), both against udev > 068 and 069. > > I've been through the udev utilities, didn't see anything that > looked like it was what I neeed. Is there a handy command that makes > sure things are flushed and updated before the next action can take place? > > I'll cheerfully take a solution, or go back to Google if someone can > tell me what sort of search terms would be relevant. I don't see why a while loop wouldn't work. Please run "udevmonitor" while yoy run your script and post the output here. I expect fdisk writes the partitiontanble and triggers a reread with a ioctl, which will create the hotplug events for the partition devices. You have to wait for the nodes to appear. Kay ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ 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