1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-21 13:34:21 +03:00

tree-wide: refuse enumerated device with ID_PROCESSING=1

When enumerated devices are being processed by udevd, we will receive
corresponding uevents later. So, we should not process devices in that
case.
This commit is contained in:
Yu Watanabe 2024-04-04 05:53:55 +09:00
parent 54e6172550
commit 405be62f05
4 changed files with 19 additions and 4 deletions

View File

@ -1051,6 +1051,9 @@ static void device_enumerate(Manager *m) {
_cleanup_set_free_ Set *ready_units = NULL, *not_ready_units = NULL;
Device *d;
if (device_is_processed(dev) <= 0)
continue;
if (device_setup_units(m, dev, &ready_units, &not_ready_units) < 0)
continue;

View File

@ -1365,8 +1365,11 @@ static int manager_enumerate_devices(Manager *m) {
if (r < 0)
return r;
FOREACH_DEVICE(e, d)
FOREACH_DEVICE(e, d) {
if (device_is_processed(d) <= 0)
continue;
(void) manager_add_device(m, d);
}
return 0;
}

View File

@ -194,8 +194,11 @@ static int manager_enumerate_devices(Manager *m) {
r = 0;
FOREACH_DEVICE(e, d)
FOREACH_DEVICE(e, d) {
if (device_is_processed(d) <= 0)
continue;
RET_GATHER(r, manager_process_seat_device(m, d));
}
return r;
}
@ -225,8 +228,11 @@ static int manager_enumerate_buttons(Manager *m) {
r = 0;
FOREACH_DEVICE(e, d)
FOREACH_DEVICE(e, d) {
if (device_is_processed(d) <= 0)
continue;
RET_GATHER(r, manager_process_button_device(m, d));
}
return r;
}

View File

@ -1214,8 +1214,11 @@ static int run(int argc, char* argv[]) {
if (r < 0)
return log_error_errno(r, "Failed to exclude loop devices: %m");
FOREACH_DEVICE(enumerator, device)
FOREACH_DEVICE(enumerator, device) {
if (device_is_processed(device) <= 0)
continue;
device_added(&context, device);
}
}
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;