Skip to content

Commit

Permalink
linux: fix fallback mechanism in a userns
Browse files Browse the repository at this point in the history
523eed3 introduced the regression.
If the mkdir fails, still attempt the other mechanisms to create the
cgroupv2 mount.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information
giuseppe committed Sep 26, 2023
1 parent 1ccbd18 commit 1f2769e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/libcrun/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,17 +1333,17 @@ do_mount_cgroup_v2 (libcrun_container_t *container, int targetfd, const char *ta
return ret;

ret = crun_ensure_directory (tmp_mount_dir, 0700, true, err);
if (UNLIKELY (ret < 0))
return ret;

ret = mount ("cgroup2", tmp_mount_dir, "cgroup2", 0, NULL);
if (LIKELY (ret == 0))
if (ret == 0)
{
ret = do_mount (container, tmp_mount_dir, targetfd, target, NULL, MS_MOVE | mountflags, NULL, LABEL_NONE, err);
ret = mount ("cgroup2", tmp_mount_dir, "cgroup2", 0, NULL);
if (LIKELY (ret == 0))
return 0;
{
ret = do_mount (container, tmp_mount_dir, targetfd, target, NULL, MS_MOVE | mountflags, NULL, LABEL_NONE, err);
if (LIKELY (ret == 0))
return 0;

crun_error_release (err);
crun_error_release (err);
}
}
}

Expand Down

0 comments on commit 1f2769e

Please sign in to comment.