From 484d31a58d7b820fa83a70a9f654b907130eec75 Mon Sep 17 00:00:00 2001 From: Lidong Zhong Date: Thu, 7 Nov 2024 14:41:11 +0800 Subject: [PATCH] udev: skipping empty udev rules file while collecting the stats 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. (cherry picked from commit 2ae79a31b7c7947e2c16e18eb85ac5607ebc40b6) (cherry picked from commit 688eb20fdb9c4bcc6d205323f9cec119d6273169) --- src/shared/conf-parser.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 9fb0395714..fbe8103b43 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -763,6 +763,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;