]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: skipping empty udev rules file while collecting the stats
authorLidong Zhong <lidong.zhong@suse.com>
Thu, 7 Nov 2024 06:41:11 +0000 (14:41 +0800)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 8 Nov 2024 23:20:09 +0000 (23:20 +0000)
To keep align with the logic used in udev_rules_parse_file(), we also
should skip the empty udev rules file while collecting the stats during
manager reload. Otherwise all udev rules files will be parsed again whenever
reloading udev manager with an empty udev rules file. It's time consuming
and the following uevents will fail with timeout.

src/shared/conf-parser.c

index 8c5a4a7013a0dc31f51d2ff1f559c37e07669832..eaa8a5f11c6b48fbbcec622e6e0cfb2db1b57f53 100644 (file)
@@ -749,6 +749,10 @@ int config_get_stats_by_path(
                         return -errno;
                 }
 
+                /* Skipping an empty file. */
+                if (null_or_empty(&st))
+                        continue;
+
                 r = hashmap_put_stats_by_path(&stats_by_path, *f, &st);
                 if (r < 0)
                         return r;