From: Anita Zhang Date: Mon, 8 Mar 2021 18:21:37 +0000 (-0800) Subject: oomd: wrap paths in oomd_insert_cgroup_context with empty_to_root X-Git-Tag: v248-rc3~23^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F18930%2Fhead;p=thirdparty%2Fsystemd.git oomd: wrap paths in oomd_insert_cgroup_context with empty_to_root --- diff --git a/src/oom/oomd-manager.c b/src/oom/oomd-manager.c index fad1fb0d452..085fc6487fd 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 82bc9e25291..d8dbb750139 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;