]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
oomd: wrap paths in oomd_insert_cgroup_context with empty_to_root
authorAnita Zhang <the.anitazha@gmail.com>
Mon, 8 Mar 2021 18:21:37 +0000 (10:21 -0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 12 Mar 2021 16:35:57 +0000 (17:35 +0100)
(cherry picked from commit 50c0578b619e7298375afdffec7a8b3a40a68c21)

src/oom/oomd-util.c

index b17e506ce1967ff935c94ff2ebc9582dd1990798..285397ddce6ae45d41c3521e113ba78ee13ac5c9 100644 (file)
@@ -367,10 +367,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;