diff --git a/daemon/daemon.go b/daemon/daemon.go index dcaba0db65..bed1881a3e 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -277,11 +277,6 @@ func (daemon *Daemon) restore() error { defer wg.Done() rm := c.RestartManager(false) if c.IsRunning() || c.IsPaused() { - // Fix activityCount such that graph mounts can be unmounted later - if err := daemon.layerStore.ReinitRWLayer(c.RWLayer); err != nil { - logrus.Errorf("Failed to ReinitRWLayer for %s due to %s", c.ID, err) - return - } if err := daemon.containerd.Restore(c.ID, libcontainerd.WithRestartManager(rm)); err != nil { logrus.Errorf("Failed to restore with containerd: %q", err) return diff --git a/daemon/graphdriver/windows/windows.go b/daemon/graphdriver/windows/windows.go index 648ce16d67..3490c006fb 100644 --- a/daemon/graphdriver/windows/windows.go +++ b/daemon/graphdriver/windows/windows.go @@ -20,6 +20,7 @@ import ( "time" "unsafe" + "github.com/Microsoft/go-winio" "github.com/Microsoft/go-winio/archive/tar" "github.com/Microsoft/go-winio/backuptar" "github.com/Microsoft/hcsshim" @@ -31,7 +32,6 @@ import ( "github.com/docker/docker/pkg/longpath" "github.com/docker/docker/pkg/reexec" "github.com/docker/docker/pkg/system" - "github.com/docker/docker/vendor/src/github.com/Microsoft/go-winio" "github.com/vbatts/tar-split/tar/storage" ) diff --git a/daemon/graphdriver/zfs/zfs.go b/daemon/graphdriver/zfs/zfs.go index 7a4ec1d5cf..a9e40d3431 100644 --- a/daemon/graphdriver/zfs/zfs.go +++ b/daemon/graphdriver/zfs/zfs.go @@ -105,7 +105,7 @@ func Init(base string, opt []string, uidMaps, gidMaps []idtools.IDMap) (graphdri filesystemsCache: filesystemsCache, uidMaps: uidMaps, gidMaps: gidMaps, - ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicZfs)), + ctr: graphdriver.NewRefCounter(graphdriver.NewDefaultChecker()), } return graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps), nil } diff --git a/distribution/xfer/download_test.go b/distribution/xfer/download_test.go index 5a38e3f038..330882f24f 100644 --- a/distribution/xfer/download_test.go +++ b/distribution/xfer/download_test.go @@ -121,10 +121,6 @@ func (ls *mockLayerStore) GetMountID(string) (string, error) { return "", errors.New("not implemented") } -func (ls *mockLayerStore) ReinitRWLayer(layer.RWLayer) error { - return errors.New("not implemented") -} - func (ls *mockLayerStore) Cleanup() error { return nil } diff --git a/layer/layer.go b/layer/layer.go index 5100fe2dee..5d3b8c672a 100644 --- a/layer/layer.go +++ b/layer/layer.go @@ -174,7 +174,6 @@ type Store interface { CreateRWLayer(id string, parent ChainID, mountLabel string, initFunc MountInit, storageOpt map[string]string) (RWLayer, error) GetRWLayer(id string) (RWLayer, error) GetMountID(id string) (string, error) - ReinitRWLayer(l RWLayer) error ReleaseRWLayer(RWLayer) ([]Metadata, error) Cleanup() error diff --git a/layer/layer_store.go b/layer/layer_store.go index f25ef91ac9..8c3d0a4911 100644 --- a/layer/layer_store.go +++ b/layer/layer_store.go @@ -495,19 +495,6 @@ func (ls *layerStore) GetMountID(id string) (string, error) { return mount.mountID, nil } -// ReinitRWLayer reinitializes a given mount to the layerstore, specifically -// initializing the usage count. It should strictly only be used in the -// daemon's restore path to restore state of live containers. -func (ls *layerStore) ReinitRWLayer(l RWLayer) error { - ls.mountL.Lock() - defer ls.mountL.Unlock() - - if _, ok := ls.mounts[l.Name()]; !ok { - return ErrMountDoesNotExist - } - return nil -} - func (ls *layerStore) ReleaseRWLayer(l RWLayer) ([]Metadata, error) { ls.mountL.Lock() defer ls.mountL.Unlock() diff --git a/layer/layer_test.go b/layer/layer_test.go index 2e4fab5c86..8e6817c96a 100644 --- a/layer/layer_test.go +++ b/layer/layer_test.go @@ -174,10 +174,7 @@ func getCachedLayer(l Layer) *roLayer { } func getMountLayer(l RWLayer) *mountedLayer { - if rl, ok := l.(*referencedRWLayer); ok { - return rl.mountedLayer - } - return l.(*mountedLayer) + return l.(*referencedRWLayer).mountedLayer } func createMetadata(layers ...Layer) []Metadata { diff --git a/layer/mounted_layer.go b/layer/mounted_layer.go index 62189c8c20..add33d9f19 100644 --- a/layer/mounted_layer.go +++ b/layer/mounted_layer.go @@ -49,14 +49,6 @@ func (ml *mountedLayer) Parent() Layer { return nil } -func (ml *mountedLayer) Mount(mountLabel string) (string, error) { - return ml.layerStore.driver.Get(ml.mountID, mountLabel) -} - -func (ml *mountedLayer) Unmount() error { - return ml.layerStore.driver.Put(ml.mountID) -} - func (ml *mountedLayer) Size() (int64, error) { return ml.layerStore.driver.DiffSize(ml.mountID, ml.cacheParent()) } @@ -101,11 +93,11 @@ type referencedRWLayer struct { } func (rl *referencedRWLayer) Mount(mountLabel string) (string, error) { - return rl.mountedLayer.Mount(mountLabel) + return rl.layerStore.driver.Get(rl.mountedLayer.mountID, mountLabel) } // Unmount decrements the activity count and unmounts the underlying layer // Callers should only call `Unmount` once per call to `Mount`, even on error. func (rl *referencedRWLayer) Unmount() error { - return rl.mountedLayer.Unmount() + return rl.layerStore.driver.Put(rl.mountedLayer.mountID) }