Re: udev problem with udevsettle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Farkas Levente wrote:
> Bryan Kadzban wrote:
>> So while your script is running, udev has not settled (the test
>> that udevsettle uses to decide this will never succeed, because the
>> RUN rule that called udevsettle is not finished).  To get the rule
>> to finish processing, the program that RUN ran needs to exit.
> 
> yes i see it, but anyway what does the "very short running tasks"
> means?

It means that if your program takes a "long time" to run, it will delay
udevd's processing of this event any anything else that depends on it.
That's not a good thing to have happen.

As far as what the definition of "long time" is, that's not exactly
relevant to the issue here: the issue here is that udevsettle *will
never finish* as long as your RUN-key script hasn't finished.  That
means that it's automatically a "long time".

> my scripts is about a second (under normal circumstances) which is
> imho very short from a shell script:-)

For a shell script, maybe.  (But e.g. create_floppy_devices exits in a
*much* shorter time.)  But for a uevent, not really: most of the system
uevents are finished within a few seconds of running "udevadm trigger";
that's *way* less than a second per event.

But whatever: the issue isn't (directly) how long the script takes to
run normally.  The issue is that when the script runs from the RUN key
and doesn't fork into the background, the uevent has not finished (and
won't finish until the script exits), so any calls to udevsettle will
deadlock.  (And eventually time out.)

> yes i already solve it, but imho it's not a good habit to call 
> udevsettle from cryptsetup.

Very well -- and you may be correct -- but I believe the cryptsetup
maintainers are the ones that added that, not the udev maintainers.  ;-)

However, I am not so sure that it's a bad idea to call udevsettle from
where it's being called.  It's being called after cryptsetup creates a
new device-mapper device, to wait until udev has actually created the
correct device node for the new device-mapper device.  If you remove the
udevsettle call, you'll reintroduce the race that led to its addition in
the first place.

The problem is, udevsettle *can't* finish while a uevent is halfway
processed.  And running the script in the foreground means the uevent
will be halfway processed until the script finishes.  You need to just
run the script in the background.

(This should be fine, because the script is simply using RUN as a
notification.  Nothing about the script -- that I can see -- requires it
to run in the foreground.)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIbUlPS5vET1Wea5wRA06FAJ9xJl87hjoLrxLJ1upgV1mZh6bg3gCgtkgX
eEDnT++k9WjDH4FBuTHmHUQ=
=aAAI
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux