Skip to content

Commit

Permalink
Fix mount(cgroup2) for older kernels.
Browse files Browse the repository at this point in the history
Linux 4.15 doesn't like empty string for cgroup2 mount options.
Pass NULL then to satisfy the kernel check. Log the options for
easier debugging.

Signed-off-by: Michał Mirosław <emmir@google.com>
  • Loading branch information
osctobe authored and avagin committed Jun 15, 2023
1 parent af0e413 commit 11288c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions criu/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ static int open_cgroupfs(struct cg_ctl *cc)
return -1;
}

if (mount("none", prefix, fstype, 0, mopts) < 0) {
pr_perror("Unable to mount %s", mopts);
if (mount("none", prefix, fstype, 0, mopts[0] ? mopts : NULL) < 0) {
pr_perror("Unable to mount %s %s", fstype, mopts);
rmdir(prefix);
return -1;
}
Expand Down

0 comments on commit 11288c9

Please sign in to comment.