Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
vc: set detach flag when umounting rootfs
Browse files Browse the repository at this point in the history
docker might bind mount some files/dirs under container rootfs
without notifying runtime. We need to unmount them otherwise
docker will fail to clean up containers.

man umount(2):
MNT_DETACH (since Linux 2.4.11)
     Perform a lazy unmount: make the mount point unavailable for new accesses, immediately
     disconnect the filesystem and all filesystems mounted below it from each other and
     from the mount table, and actually perform the unmount when the mount point ceases to be busy.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
  • Loading branch information
bergwolf committed Jan 21, 2019
1 parent d314e2d commit d75f26d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion virtcontainers/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func bindUnmountContainerRootfs(ctx context.Context, sharedDir, sandboxID, cID s
defer span.Finish()

rootfsDest := filepath.Join(sharedDir, sandboxID, cID, rootfsDir)
syscall.Unmount(rootfsDest, 0)
syscall.Unmount(rootfsDest, syscall.MNT_DETACH)

return nil
}
Expand Down

0 comments on commit d75f26d

Please # to comment.