Skip to content

Commit 3ec6298

Browse files
authored
Merge pull request #1621 from giuseppe/drop-fallback-with-temporary-mount
linux: remove tmpmount workaround
2 parents ca39d7c + 1832c17 commit 3ec6298

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

src/libcrun/linux.c

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,38 +1328,7 @@ do_mount_cgroup_v2 (libcrun_container_t *container, int targetfd, const char *ta
13281328
if (errno == EBUSY)
13291329
{
13301330
/* If we got EBUSY it means the cgroup file system is already mounted at the targetfd and we
1331-
cannot stack another one on top of it. First attempt with a temporary mount and then move
1332-
it to the destination directory. If that cannot be used try mounting a tmpfs below the
1333-
cgroup mount. */
1334-
cleanup_free char *state_dir = NULL;
1335-
1336-
state_dir = libcrun_get_state_directory (container->context->state_root, container->context->id);
1337-
1338-
if (state_dir)
1339-
{
1340-
cleanup_free char *tmp_mount_dir = NULL;
1341-
1342-
ret = append_paths (&tmp_mount_dir, err, state_dir, "tmpmount", NULL);
1343-
if (UNLIKELY (ret < 0))
1344-
return ret;
1345-
1346-
ret = crun_ensure_directory (tmp_mount_dir, 0700, true, err);
1347-
if (ret == 0)
1348-
{
1349-
ret = mount ("cgroup2", tmp_mount_dir, "cgroup2", 0, NULL);
1350-
if (LIKELY (ret == 0))
1351-
{
1352-
ret = do_mount (container, tmp_mount_dir, targetfd, target, NULL, MS_MOVE | mountflags, NULL, LABEL_NONE, err);
1353-
if (LIKELY (ret == 0))
1354-
return 0;
1355-
1356-
/* Best-effort cleanup of now-unused temporary mount */
1357-
umount2 (tmp_mount_dir, MNT_DETACH);
1358-
crun_error_release (err);
1359-
}
1360-
}
1361-
rmdir (tmp_mount_dir);
1362-
}
1331+
cannot stack another one on top of it. Attempt mounting a tmpfs below the cgroup mount. */
13631332

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

0 commit comments

Comments
 (0)