summaryrefslogtreecommitdiff
path: root/src/oom
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2021-03-08 10:21:37 -0800
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-03-09 09:23:22 +0100
commit50c0578b619e7298375afdffec7a8b3a40a68c21 (patch)
tree9e0bf8d3876322422405090fe1a621e65e340482 /src/oom
parent45da27fa053898c1b94c175070a0dd63128875c9 (diff)
downloadsystemd-50c0578b619e7298375afdffec7a8b3a40a68c21.tar.gz
oomd: wrap paths in oomd_insert_cgroup_context with empty_to_root
Diffstat (limited to 'src/oom')
-rw-r--r--src/oom/oomd-manager.c2
-rw-r--r--src/oom/oomd-util.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/oom/oomd-manager.c b/src/oom/oomd-manager.c
index fad1fb0d45..085fc6487f 100644
--- a/src/oom/oomd-manager.c
+++ b/src/oom/oomd-manager.c
@@ -112,7 +112,7 @@ static int process_managed_oom_reply(
continue;
}
- ret = oomd_insert_cgroup_context(NULL, monitor_hm, empty_to_root(reply.path));
+ ret = oomd_insert_cgroup_context(NULL, monitor_hm, reply.path);
if (ret == -ENOMEM) {
r = ret;
goto finish;
diff --git a/src/oom/oomd-util.c b/src/oom/oomd-util.c
index 82bc9e2529..d8dbb75013 100644
--- a/src/oom/oomd-util.c
+++ b/src/oom/oomd-util.c
@@ -390,10 +390,14 @@ int oomd_insert_cgroup_context(Hashmap *old_h, Hashmap *new_h, const char *path)
assert(new_h);
assert(path);
+ path = empty_to_root(path);
+
r = oomd_cgroup_context_acquire(path, &curr_ctx);
if (r < 0)
return log_debug_errno(r, "Failed to get OomdCGroupContext for %s: %m", path);
+ assert_se(streq(path, curr_ctx->path));
+
old_ctx = hashmap_get(old_h, path);
if (old_ctx) {
curr_ctx->last_pgscan = old_ctx->pgscan;