forked from systemd/systemd
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
udev: abort non-remove event processing if device is already removed
If the device is already removed, we will not be able to load identifying information from the device :-). So we will fail to calculate the correct tag. Abort processing before we save the incorrect data to the DB! Also don't broadcast the incomplete event or run any of the collected RUN programs. This avoids losing tags in the DB, which we need for the "remove" event. On the remove event, we will broadcast the event with the tags (and other properties) loaded from the DB. This fixes the systemd part of systemd#7587 / systemd#8221. My test case is to plug and unplug a USB printer, while running on kernel version 4.12+. Before this fix, the device would remain active in `systemctl list-devices *usb*.device`. After this fix, the device unit is removed correctly. If there are third-party rules which add tags (are there any of these??), they can match our behaviour by handling all unknown events the same as "change" events. This is *already required* on kernels 4.12+ due to the addition of "bind" and "unbind" events, combined with a change to systemd-udev which allowed "bind" and "unbind" events to be executed with all of the same features as "change" events). If your rules skip unknown events, you will lose symlinks and tags, for example. Losing tags is *not allowed for* by the libudev filter design. (Again, I don't know if anything really uses tags outside of the systemd project).
- Loading branch information
1 parent
99b5b0d
commit aa76361
Showing
2 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters