From d75f26d7191eb23abdb6a407340e0a2cdc9080e7 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Thu, 17 Jan 2019 23:50:52 +0800 Subject: [PATCH] vc: set detach flag when umounting rootfs 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 --- virtcontainers/mount.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtcontainers/mount.go b/virtcontainers/mount.go index 69567331f2..bd279dfde7 100644 --- a/virtcontainers/mount.go +++ b/virtcontainers/mount.go @@ -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 }