Skip to content

Commit

Permalink
mountToRootfs: minor refactor
Browse files Browse the repository at this point in the history
The setRecAttr is only called for "bind" case, as cases end with a
return statement. Indeed, recursive mount attributes only make sense for
bind mounts.

Move the code to under case "bind" to improve readability. No change in
logic.

Fixes: 382eba4
Reported-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Mar 27, 2023
1 parent da5047c commit da98076
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions libcontainer/rootfs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ func mountToRootfs(m *configs.Mount, c *mountConfig) error {
return err
}
}
return setRecAttr(m, rootfs)
case "cgroup":
if cgroups.IsCgroup2UnifiedMode() {
return mountCgroupV2(m, c)
Expand All @@ -483,10 +484,6 @@ func mountToRootfs(m *configs.Mount, c *mountConfig) error {
}
return mountPropagate(m, rootfs, mountLabel, mountFd)
}
if err := setRecAttr(m, rootfs); err != nil {
return err
}
return nil
}

func getCgroupMounts(m *configs.Mount) ([]*configs.Mount, error) {
Expand Down

0 comments on commit da98076

Please sign in to comment.