From: Yu Watanabe Date: Wed, 3 Apr 2024 20:53:55 +0000 (+0900) Subject: tree-wide: refuse enumerated device with ID_PROCESSING=1 X-Git-Tag: v256-rc1~299^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F32085%2Fhead;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/core/device.c b/src/core/device.c index 93cab92b8ce..d8567676a75 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -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, ¬_ready_units) < 0) continue; diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c index 5f345b3d407..90fd91c8a74 100644 --- a/src/home/homed-manager.c +++ b/src/home/homed-manager.c @@ -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; } diff --git a/src/login/logind.c b/src/login/logind.c index 4d3d0270eff..ac4b8602c4f 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -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; } diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c index 62b78a350fa..e0609988293 100644 --- a/src/storagetm/storagetm.c +++ b/src/storagetm/storagetm.c @@ -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;