Systemd/src/udev
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
..
ata_id Remove unneded {}s 2020-04-13 09:31:49 +02:00
cdrom_id udev/cdrom_id: Do not open CD-rom in exclusive mode. 2019-10-24 00:09:18 +02:00
fido_id test: move {test,fuzz}-fido-id-desc.c into src/udev/fido_id 2019-10-31 10:37:42 +09:00
mtd_probe coccinelle: make use of SYNTHETIC_ERRNO 2018-11-22 10:54:38 +01:00
net udev: do not try to reassign alternative names 2020-07-17 21:36:11 +09:00
scsi_id Remove unneded {}s 2020-04-13 09:31:49 +02:00
v4l_id tree-wide: replace explicit NULL checks with their shorter variants 2019-04-28 14:28:49 +02:00
.vimrc
generate-keyboard-keys-gperf.sh scripts: use 4 space indentation 2019-04-12 08:30:31 +02:00
generate-keyboard-keys-list.sh scripts: use 4 space indentation 2019-04-12 08:30:31 +02:00
meson.build udev: single binary replacing udevd and udevadm 2020-06-01 09:41:21 +02:00
udev-builtin-blkid.c libblkid: open device in nonblock mode. 2019-11-08 12:11:32 +01:00
udev-builtin-btrfs.c udev: modernize udev-rules.c 2019-06-02 14:15:26 +09:00
udev-builtin-hwdb.c udev: change the modalias string for usb devices to include the device name 2020-07-16 19:00:26 +02:00
udev-builtin-input_id.c Remove unneded {}s 2020-04-13 09:31:49 +02:00
udev-builtin-keyboard.c tree-wide: drop stdio.h when stdio-util.h is included 2019-11-04 00:30:32 +09:00
udev-builtin-kmod.c tree-wide: drop libkmod.h when module-util.h is included 2019-11-04 00:30:32 +09:00
udev-builtin-net_id.c Replace gendered pronouns with gender neutral ones. (#16844) 2020-08-27 11:52:48 +09:00
udev-builtin-net_setup_link.c udev: modernize udev-rules.c 2019-06-02 14:15:26 +09:00
udev-builtin-path_id.c udev: spi: include chip select number in ID_PATH 2020-07-01 13:12:11 +09:00
udev-builtin-uaccess.c udev: modernize udev-rules.c 2019-06-02 14:15:26 +09:00
udev-builtin-usb_id.c tree-wide: fix spelling of "fallback" 2020-08-20 17:45:32 +02:00
udev-builtin.c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
udev-builtin.h udev: modernize udev-rules.c 2019-06-02 14:15:26 +09:00
udev-ctrl.c tree-wide: make use of new relative time events in sd-event.h 2020-07-28 11:24:55 +02:00
udev-ctrl.h udev-ctrl: split out logic of waiting for reply to udev_ctrl_wait() 2019-02-20 06:17:42 +09:00
udev-event.c udev: make tags "sticky" 2020-09-01 17:40:12 +02:00
udev-event.h udev: udev_event_apply_format() always make buf NUL terminated 2020-06-18 13:53:08 +09:00
udev-node.c tree-wide: use SYNTHETIC_ERRNO with log_device_* in more places 2020-07-16 22:08:12 +02:00
udev-node.h udev: run programs in the specified order 2019-03-05 09:27:29 +01:00
udev-rules.c udev: make tags "sticky" 2020-09-01 17:40:12 +02:00
udev-rules.h udev: split rules object creation and loading 2020-06-23 18:04:18 +02:00
udev-watch.c udev: don't complain when udev_watch_end() is called without udev_watch_init() 2020-07-16 18:38:03 +02:00
udev-watch.h udev-watch: replace udev_device by sd_device and modernize code a bit 2018-10-11 04:21:14 +09:00
udev.conf udev: make signal that we use to kill workers on timeout configurable 2020-06-05 11:09:17 +02:00
udev.pc.in {systemd,udev}.pc: add names with underscores, deprecate the old ones 2020-03-27 20:12:44 +01:00
udevadm-control.c udevadm: drop pointless must_be_root() checks 2019-05-08 11:51:51 +02:00
udevadm-hwdb.c coccinelle: make use of SYNTHETIC_ERRNO 2018-11-22 10:54:38 +01:00
udevadm-info.c udev: fix codesonar warnings 2020-07-30 18:55:50 +02:00
udevadm-monitor.c udevadm-monitor: simplify creation of arg_tag_filter set 2020-06-22 16:32:37 +02:00
udevadm-settle.c udevadm: beef up deprecation log warning 2020-07-14 14:57:19 +02:00
udevadm-test-builtin.c udev: modernize udev-rules.c 2019-06-02 14:15:26 +09:00
udevadm-test.c udev: use path_startswith() instead of startswith() in two more cases 2020-08-27 16:16:43 +09:00
udevadm-trigger.c basic/set: let set_put_strdup() create the set with string hash ops 2020-05-06 16:54:06 +02:00
udevadm-util.c udevadm: allow a .device unit to be specified for query and trigger 2018-12-11 09:24:31 +01:00
udevadm-util.h udevadm-info,trigger: replace udev_device by sd_device 2018-10-17 03:31:20 +09:00
udevadm.c Make failures of mac_selinux_init() fatal 2020-06-23 19:10:07 +02:00
udevadm.h udevadm: add a workaround for dracut 2019-01-02 10:26:16 +01:00
udevd.c tree-wide: make use of new relative time events in sd-event.h 2020-07-28 11:24:55 +02:00
udevd.h udev: single binary replacing udevd and udevadm 2020-06-01 09:41:21 +02:00