[systemd-devel] udev event vs kernel uevent ordering guarantees

Lennart Poettering lennart at poettering.net
Wed Feb 10 20:22:06 CET 2016


On Wed, 10.02.16 20:13, Ilya Dryomov (idryomov at gmail.com) wrote:

> On Wed, Feb 10, 2016 at 7:42 PM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Wed, 10.02.16 19:40, Ilya Dryomov (idryomov at gmail.com) wrote:
> >
> >> Hello,
> >>
> >> (resending - one has to subscribe to post)
> >>
> >> What are udev event ordering guarantees?  Specifically, if I get three
> >> kernel uevents with seqnums i, i+1 and i+2, is it guaranteed that udev
> >> will deliver them to the udev monitor socket in the same (i.e., seqnum)
> >> order?  I don't have any logs and the problem occurs very infrequently,
> >> but what I'm seeing could be explained by udev delivering those three
> >> events in i+1, i+2, i order.  Is that possible?
> >
> > udev only maintains order between child and parent nodes, but not
> > otherwise.
> 
> I see.  So the idea is that everybody should subscribe to udev events
> and then, because udev doesn't expose seqnums in any way, nobody should
> even know they exist and, even though the kernel is guaranteed to
> deliver certain uevents in certain order, udev is free to reorder their
> udev counterparts, correct?

Yes.

Note that the seqno stuff is not as useful as it might sound. If
network namespaces are used, then device events might be invisible to
namespaces where a specific network device is not part of. WHich means
the sequence of seqnos will have "holes"... Which is the reason we
rmemoved any support for it from udev.

> Can you elaborate on what constitutes a parent-child relationship?
> E.g., in case of adding a block device, are bdi subsystem event and
> block subsystem event related or not?

Well, what matters is how they appear in /sys: if is guaranteed that a
device "further up" the tree appears before one "further down" the
tree, if you follow what i means.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list