Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion internal/lib/sandbox/namespaces_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,9 @@ func (n *Namespace) Remove() error {
if err := unix.Unmount(fp, unix.MNT_DETACH); err != nil && err != unix.EINVAL {
return errors.Wrapf(err, "unable to unmount %s", fp)
}
return os.RemoveAll(fp)
out, execErr := exec.Command("sh", "-c", "grep "+filepath.Base(fp)+" /proc/*/mountinfo").CombinedOutput()
if err := os.Remove(fp); err != nil {
return errors.Wrapf(err, "can't remove ns mount file; mountinfo shows: %s (err: %v)", out, execErr)
}
return nil
}
7 changes: 6 additions & 1 deletion test/test_runner.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash
set -e

set -x
uname -a
tail /proc/sys/fs/may_detach_mounts
grep may_detach_mounts /etc/sysctl.conf /etc/sysctl.d/*
exit 0

TEST_USERNS=${TEST_USERNS:-}

Expand Down