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>
Tue, 15 Feb 2022 01:13:47 +0000 (01:13 +0000)
commit7a23db67795b6583028b7d7c0d5d8ef63c67d8c9
treee2e6cb3e1db58b336458cd0aa44704ac9eb371a5
parent75ff2fb73ed545d0427aea251fae6d55124f0e7c
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)
(cherry picked from commit ef7ceef26adb714ef44b2fbc07a219c05a012b42)
src/udev/udevadm-info.c