Skip to content

Commit

Permalink
Fix left-over .sysbox dirs inside the container.
Browse files Browse the repository at this point in the history
Fixes left-over .sysbox-procfs-* and .sysbox-sysfs-* dirs inside
containers. They were being incorrectly left over by sysbox-fs nsenter
processes.

Fixes nestybox/sysbox#829.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
  • Loading branch information
ctalledo committed Dec 5, 2024
1 parent aeba775 commit f626fe2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nsenter/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func processPayloadMounts(mountSysfs, mountProcfs bool) (*payloadMountsInfo, err
cleanupSysfs := func(mountpoint string) {
if mountpoint != "" {
unix.Unmount(mountpoint, unix.MNT_DETACH)
if strings.HasPrefix(mountpoint, ".sysbox-sysfs-") {
if strings.HasPrefix(mountpoint, "/.sysbox-sysfs-") {
os.RemoveAll(mountpoint)
}
}
Expand Down Expand Up @@ -125,6 +125,9 @@ func processPayloadMounts(mountSysfs, mountProcfs bool) (*payloadMountsInfo, err
cleanupProcfs := func(mountpoint string) {
if mountpoint != "" {
unix.Unmount(mountpoint, unix.MNT_DETACH)
if strings.HasPrefix(mountpoint, "/.sysbox-procfs-") {
os.RemoveAll(mountpoint)
}
}
}

Expand Down

0 comments on commit f626fe2

Please sign in to comment.