Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 1 addition & 32 deletions src/libcrun/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1328,38 +1328,7 @@ do_mount_cgroup_v2 (libcrun_container_t *container, int targetfd, const char *ta
if (errno == EBUSY)
{
/* If we got EBUSY it means the cgroup file system is already mounted at the targetfd and we
cannot stack another one on top of it. First attempt with a temporary mount and then move
it to the destination directory. If that cannot be used try mounting a tmpfs below the
cgroup mount. */
cleanup_free char *state_dir = NULL;

state_dir = libcrun_get_state_directory (container->context->state_root, container->context->id);

if (state_dir)
{
cleanup_free char *tmp_mount_dir = NULL;

ret = append_paths (&tmp_mount_dir, err, state_dir, "tmpmount", NULL);
if (UNLIKELY (ret < 0))
return ret;

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

/* Best-effort cleanup of now-unused temporary mount */
umount2 (tmp_mount_dir, MNT_DETACH);
crun_error_release (err);
}
}
rmdir (tmp_mount_dir);
}
cannot stack another one on top of it. Attempt mounting a tmpfs below the cgroup mount. */

ret = do_mount (container, "tmpfs", targetfd, target, "tmpfs", MS_PRIVATE, "nr_blocks=1,nr_inodes=1", LABEL_NONE, err);
if (LIKELY (ret == 0))
Expand Down
Loading