Systemd/src/libsystemd
Lennart Poettering e77b146f82 udev: make tags "sticky"
This tries to address the "bind"/"unbind" uevent kernel API breakage, by
changing the semantics of device tags.

Previously, tags would be applied on uevents (and the database entries
they result in) only depending on the immediate context. This means that
if one uevent causes the tag to be set and the next to be unset, this
would immediately effect what apps would see and the database entries
would contain each time. This is problematic however, as tags are a
filtering concept, and if tags vanish then clients won't hence notice
when a device stops being relevant to them since not only the tags
disappear but immediately also the uevents for it are filtered including
the one necessary for the app to notice that the device lost its tag and
hence relevance.

With this change tags become "sticky". If a tag is applied is once
applied to a device it will stay in place forever, until the device is
removed. Tags can never be removed again. This means that an app
watching a specific set of devices by filtering for a tag is guaranteed
to not only see the events where the tag is set but also all follow-up
events where the tags might be removed again.

This change of behaviour is unfortunate, but is required due to the
kernel introducing new "bind" and "unbind" uevents that generally have
the effect that tags and properties disappear and apps hence don't
notice when a device looses relevance to it. "bind"/"unbind" events were
introduced in kernel 4.12, and are now used in more and more subsystems.
The introduction broke userspace widely, and this commit is an attempt
to provide a way for apps to deal with it.

While tags are now "sticky" a new automatic device property
CURRENT_TAGS is introduced (matching the existing TAGS property) that
always reflects the precise set of tags applied on the most recent
events. Thus, when subscribing to devices through tags, all devices that
ever had the tag put on them will be be seen, and by CURRENT_TAGS it may
be checked whether the device right at the moment matches the tag
requirements.

See: #7587 #7018 #8221
2020-09-01 17:40:12 +02:00
..
sd-bus homed: support recovery keys 2020-08-25 18:14:55 +02:00
sd-daemon tree-wide: port to fd_wait_for_event() 2020-06-10 20:06:10 +02:00
sd-device udev: make tags "sticky" 2020-09-01 17:40:12 +02:00
sd-event sd-event: add relative timer calls 2020-07-28 11:23:41 +02:00
sd-hwdb tree-wide: drop pointless zero initialization (#16900) 2020-08-30 06:21:20 +09:00
sd-id128 id128: move make_v4_uuid into id128-util.h to make it generally useful 2020-01-20 17:42:03 +01:00
sd-login sd-login: get rid of seat_can_multi_session() 2020-04-17 16:15:30 +02:00
sd-netlink Merge pull request #16501 from yuwata/udev-fix-renaming 2020-07-20 09:00:02 +02:00
sd-network sd-network: drop unused functions 2020-06-23 19:13:05 +09:00
sd-path sd-path: drop "-dir" and "-path" suffixes from path enums 2020-05-28 23:54:35 +02:00
sd-resolve tree-wide: drop pointless zero initialization (#16900) 2020-08-30 06:21:20 +09:00
sd-utf8 tree-wide: drop empty comments 2018-06-29 11:00:30 +09:00
disable-mempool.c mempool: only enable mempool use when linked to libsystemd-shared.so 2018-10-11 11:10:37 +02:00
libsystemd.pc.in meson: define PROJECT_VERSION as the "bare" project version 2018-12-20 21:35:29 +01:00
libsystemd.sym udev: make tags "sticky" 2020-09-01 17:40:12 +02:00
meson.build sd-netlink: save dynamic general netlink message type 2019-10-15 01:57:19 +09:00