keventd: defer pidfile until coldplug queue is drained

When started with -c (the default when keventd is the device manager),
gate the pidfile on the kernel's uevent_seqnum having been stable for
200ms.  Up to now ready signaling with the pidfile was done right after
coldplug() triggered the kernel to re-emit events, but before uev_run()
had drained any of them, so <pid/keventd> really only meant "listening
on netlink".

With the gate, services that depend on <pid/keventd> can now assume /dev
is populated and persistent symlinks are live.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-08-16 22:03:34 +02:00
1 parent c1c68054ea
commit 5a3972714a
3 files changed
+93 -11

No files matched your search

+7
View File
@@ -41,6 +41,13 @@ texec initctl reload >/dev/null \
|| fail "initctl reload returned non-zero"
assert "initctl reload ok" 0 -eq 0
# keventd was restarted above and only writes its pidfile once the
# coldplug queue has drained, so <pid/keventd> asserts a good while
# after the restart returns. Let it land before subscribing below,
# or the monitor catches keventd's ConditionChanged instead of ours
# and stops, since it waits for exactly one signal.
retry 'assert_cond pid/keventd' 100 0.1
# A ConditionChanged signal can only originate from Cond1.Set going
# through finit (the legacy filesystem path doesn't emit signals).
# So if the monitor sees one, we know initctl cond set was routed