53 lines
1.7 KiB
Diff
53 lines
1.7 KiB
Diff
From 4726233b421628eae405b3b3fb08222cf0befae4 Mon Sep 17 00:00:00 2001
|
|
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
Date: Tue, 28 Jan 2025 10:09:32 +0900
|
|
Subject: [PATCH] core/unit: remove path to transient unit file from unit name
|
|
maps on stop
|
|
|
|
Fixes #35190.
|
|
|
|
(cherry picked from commit fce94c5c563b8f6ede2b8f7f283d2d2faff4e062)
|
|
|
|
Resolves: RHEL-14112
|
|
---
|
|
src/core/unit.c | 15 ++++++++++++---
|
|
1 file changed, 12 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/core/unit.c b/src/core/unit.c
|
|
index 9e349402ff..afe3fdab04 100644
|
|
--- a/src/core/unit.c
|
|
+++ b/src/core/unit.c
|
|
@@ -598,13 +598,11 @@ static void unit_clear_dependencies(Unit *u) {
|
|
|
|
static void unit_remove_transient(Unit *u) {
|
|
assert(u);
|
|
+ assert(u->manager);
|
|
|
|
if (!u->transient)
|
|
return;
|
|
|
|
- if (u->fragment_path)
|
|
- (void) unlink(u->fragment_path);
|
|
-
|
|
STRV_FOREACH(i, u->dropin_paths) {
|
|
_cleanup_free_ char *p = NULL, *pp = NULL;
|
|
|
|
@@ -621,6 +619,17 @@ static void unit_remove_transient(Unit *u) {
|
|
(void) unlink(*i);
|
|
(void) rmdir(p);
|
|
}
|
|
+
|
|
+ if (u->fragment_path) {
|
|
+ (void) unlink(u->fragment_path);
|
|
+ (void) unit_file_remove_from_name_map(
|
|
+ &u->manager->lookup_paths,
|
|
+ &u->manager->unit_cache_timestamp_hash,
|
|
+ &u->manager->unit_id_map,
|
|
+ &u->manager->unit_name_map,
|
|
+ &u->manager->unit_path_cache,
|
|
+ u->fragment_path);
|
|
+ }
|
|
}
|
|
|
|
static void unit_free_requires_mounts_for(Unit *u) {
|