]> git.ipfire.org Git - thirdparty/systemd.git/commit
udev: sort queued events by their seqnum 37314/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 26 Apr 2025 06:37:25 +0000 (15:37 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 9 May 2025 17:44:54 +0000 (02:44 +0900)
commit6a04c1e518008bb81b41a94f56b015801fd399b2
tree04ebcbdbdda6e3418d377760110ccb6dad295a51
parente8f017c42171cefe62e783b467d9edbfc5dafd33
udev: sort queued events by their seqnum

Unfortunately, the kernel may send events in a random order:
```
[   25.769624] systemd-udevd[194]: sdi7: Device is queued (SEQNUM=2843, ACTION=add)
[   25.769893] systemd-udevd[194]: sda5: Device is queued (SEQNUM=2842, ACTION=add)
[   25.770517] systemd-udevd[194]: sdi8: Device is queued (SEQNUM=2844, ACTION=add)
```
As you can see, udevd receives the event with SEQNUM=2843 earlier than
one with SEQNUM=2842.

Let's make queued events sorted, as our logic of determining which event
is ready for being processed assumes that queued events are sorted.
See event_build_dependencies().

Also, refuse to queue an event if another event with the same seqnum is
already queued.
src/udev/udev-manager.c