From 33ddc6d17220d3dc0640bcf1e898c0adf7e077ea Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Wed, 7 Feb 2018 14:49:20 -0500 Subject: [PATCH] Do not recursive unmount on cleanup of zfs/btrfs This was added in #36047 just as a way to make sure the tree is fully unmounted on shutdown. For ZFS this could be a breaking change since there was no unmount before. Someone could have setup the zfs tree themselves. It would be better, if we really do want the cleanup to actually the unpacked layers checking for mounts rather than a blind recursive unmount of the root. BTRFS does not use mounts and does not need to unmount anyway. These was only an unmount to begin with because for some reason the btrfs tree was being moutned with `private` propagation. For the other graphdrivers that still have a recursive unmount here... these were already being unmounted and performing the recursive unmount shouldn't break anything. If anyone had anything mounted at the graphdriver location it would have been unmounted on shutdown anyway. Signed-off-by: Brian Goff Upstream-commit: 2fe4f888bee52b1f256d6fa5e20f9b061d30221c Component: engine --- components/engine/daemon/graphdriver/btrfs/btrfs.go | 3 +-- components/engine/daemon/graphdriver/zfs/zfs.go | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/engine/daemon/graphdriver/btrfs/btrfs.go b/components/engine/daemon/graphdriver/btrfs/btrfs.go index 54bb9b7902..fbaa96f246 100644 --- a/components/engine/daemon/graphdriver/btrfs/btrfs.go +++ b/components/engine/daemon/graphdriver/btrfs/btrfs.go @@ -29,7 +29,6 @@ import ( "github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/pkg/containerfs" "github.com/docker/docker/pkg/idtools" - "github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/system" "github.com/docker/go-units" @@ -163,7 +162,7 @@ func (d *Driver) Cleanup() error { return err } - return mount.RecursiveUnmount(d.home) + return nil } func free(p *C.char) { diff --git a/components/engine/daemon/graphdriver/zfs/zfs.go b/components/engine/daemon/graphdriver/zfs/zfs.go index 9ab5d87ad0..743d6daf5b 100644 --- a/components/engine/daemon/graphdriver/zfs/zfs.go +++ b/components/engine/daemon/graphdriver/zfs/zfs.go @@ -178,9 +178,10 @@ func (d *Driver) String() string { return "zfs" } -// Cleanup is called on daemon shutdown, it is used to clean up any remaining mounts +// Cleanup is called on daemon shutdown, it is a no-op for ZFS. +// TODO(@cpuguy83): Walk layer tree and check mounts? func (d *Driver) Cleanup() error { - return mount.RecursiveUnmount(d.options.mountPath) + return nil } // Status returns information about the ZFS filesystem. It returns a two dimensional array of information