udevadm: cleanup-db: don't delete information for kept db entries
authorMartin Wilck <mwilck@suse.com>
Thu, 20 Jan 2022 13:31:45 +0000 (14:31 +0100)
committerLuca Boccassi <bluca@debian.org>
Mon, 14 Feb 2022 21:56:48 +0000 (21:56 +0000)
commitef7ceef26adb714ef44b2fbc07a219c05a012b42
tree90ae032a8ded380b0567da96e3d1b847553da448
parent494e3c0def197abd4ec88f7b0c3ba331a708d81e
udevadm: cleanup-db: don't delete information for kept db entries

devices with the db_persist property won't be deleted during database
cleanup. This applies to dm and md devices in particular.
For such devices, we should also keep the files under /run/udev/links,
/run/udev/tags, and /run/udev/watch, to make sure that after restart,
udevd has the same information about the devices as it did before
the cleanup.

If we don't do this, a lower-priority device that is discovered in
the coldplug phase may take over symlinks from a device that persisted.
Not removing the watches also enables udevd to resume watching a device
after restart.

Signed-off-by: Martin Wilck <mwilck@suse.com>
(cherry picked from commit 7ec624147a41d80f8e492c9fe19a24e2cda58c25)
src/udev/udevadm-info.c