summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-10-10 03:42:24 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-10-11 22:34:07 +0200
commitea4af553d8c0fd9669d329d89e329d7270102032 (patch)
tree953a56e0cbc38a24f9c465f58bb1401998cacfe4
parentudev-node: drop workaround for by-diskseq symlinks (diff)
downloadsystemd-ea4af553d8c0fd9669d329d89e329d7270102032.tar.xz
systemd-ea4af553d8c0fd9669d329d89e329d7270102032.zip
udev-node: drop unnecessary manager side cleaning up logic for stack directory
Unnecessary stack directories and their lock files are removed by workers. Hence, the logic is not necessary anymore.
-rw-r--r--src/udev/udev-manager.c8
-rw-r--r--src/udev/udev-manager.h1
-rw-r--r--src/udev/udev-node.c42
-rw-r--r--src/udev/udev-node.h1
4 files changed, 0 insertions, 52 deletions
diff --git a/src/udev/udev-manager.c b/src/udev/udev-manager.c
index 08ed176faf..32bc0db345 100644
--- a/src/udev/udev-manager.c
+++ b/src/udev/udev-manager.c
@@ -583,9 +583,6 @@ static int event_queue_start(Manager *manager) {
if (!manager->events || manager->exit || manager->stop_exec_queue)
return 0;
- /* To make the stack directory /run/udev/links cleaned up later. */
- manager->udev_node_needs_cleanup = true;
-
r = event_source_disable(manager->kill_workers_event);
if (r < 0)
log_warning_errno(r, "Failed to disable event source for cleaning up idle workers, ignoring: %m");
@@ -1181,11 +1178,6 @@ static int on_post(sd_event_source *s, void *userdata) {
/* There are no idle workers. */
- if (manager->udev_node_needs_cleanup) {
- (void) udev_node_cleanup();
- manager->udev_node_needs_cleanup = false;
- }
-
if (manager->exit)
return sd_event_exit(manager->event, 0);
diff --git a/src/udev/udev-manager.h b/src/udev/udev-manager.h
index 41aa73698d..5921d333d1 100644
--- a/src/udev/udev-manager.h
+++ b/src/udev/udev-manager.h
@@ -44,7 +44,6 @@ typedef struct Manager {
int timeout_signal;
bool blockdev_read_only;
- bool udev_node_needs_cleanup;
bool stop_exec_queue;
bool exit;
} Manager;
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 6d917c4dd2..673f723ff2 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -28,48 +28,6 @@
#define UDEV_NODE_HASH_KEY SD_ID128_MAKE(b9,6a,f1,ce,40,31,44,1a,9e,19,ec,8b,ae,f3,e3,2f)
-int udev_node_cleanup(void) {
- _cleanup_closedir_ DIR *dir = NULL;
-
- /* This must not be called when any workers exist. It would cause a race between mkdir() called
- * by stack_directory_lock() and unlinkat() called by this. */
-
- dir = opendir("/run/udev/links");
- if (!dir) {
- if (errno == ENOENT)
- return 0;
-
- return log_debug_errno(errno, "Failed to open directory '/run/udev/links', ignoring: %m");
- }
-
- FOREACH_DIRENT_ALL(de, dir, break) {
- _cleanup_free_ char *lockfile = NULL;
-
- if (de->d_name[0] == '.')
- continue;
-
- if (de->d_type != DT_DIR)
- continue;
-
- /* As commented in the above, this is called when no worker exists, hence the file is not
- * locked. On a later uevent, the lock file will be created if necessary. So, we can safely
- * remove the file now. */
- lockfile = path_join(de->d_name, ".lock");
- if (!lockfile)
- return log_oom_debug();
-
- if (unlinkat(dirfd(dir), lockfile, 0) < 0 && errno != ENOENT) {
- log_debug_errno(errno, "Failed to remove '/run/udev/links/%s', ignoring: %m", lockfile);
- continue;
- }
-
- if (unlinkat(dirfd(dir), de->d_name, AT_REMOVEDIR) < 0 && errno != ENOTEMPTY)
- log_debug_errno(errno, "Failed to remove '/run/udev/links/%s', ignoring: %m", de->d_name);
- }
-
- return 0;
-}
-
static int node_remove_symlink(sd_device *dev, const char *slink) {
assert(dev);
assert(slink);
diff --git a/src/udev/udev-node.h b/src/udev/udev-node.h
index 0c545e4a0f..86a829545a 100644
--- a/src/udev/udev-node.h
+++ b/src/udev/udev-node.h
@@ -24,6 +24,5 @@ int static_node_apply_permissions(
int udev_node_remove(sd_device *dev);
int udev_node_update(sd_device *dev, sd_device *dev_old);
-int udev_node_cleanup(void);
size_t udev_node_escape_path(const char *src, char *dest, size_t size);