]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: refuse enumerated device with ID_PROCESSING=1 32085/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Apr 2024 20:53:55 +0000 (05:53 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Apr 2024 16:49:20 +0000 (01:49 +0900)
When enumerated devices are being processed by udevd, we will receive
corresponding uevents later. So, we should not process devices in that
case.

src/core/device.c
src/home/homed-manager.c
src/login/logind.c
src/storagetm/storagetm.c

index 93cab92b8ce0669e8c4e20301e86a1e49f3617d3..d8567676a75fa00fdd0e59a6f45336762adabf95 100644 (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;
 
index 5f345b3d407664db18d440d0d7ee626a9fbb1fa4..90fd91c8a74b7c64071a99e8b8aa17f0addc8008 100644 (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;
 }
index 4d3d0270effa718a3e78b4f247b830a610852fc8..ac4b8602c4f9b11816595a8148d02278ff268e97 100644 (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;
 }
index 62b78a350fa049deb54a0ba4e0477ee8b651c415..e0609988293705c21d368d413089c770c8efd723 100644 (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;