Skip to content

Commit 8bb4d31

Browse files
committed
Remove mountedLayer Mount and Unmount
Signed-off-by: Michael Crosby <[email protected]>
1 parent 36a82c2 commit 8bb4d31

File tree

8 files changed

+5
-39
lines changed

8 files changed

+5
-39
lines changed

daemon/daemon.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,6 @@ func (daemon *Daemon) restore() error {
277277
defer wg.Done()
278278
rm := c.RestartManager(false)
279279
if c.IsRunning() || c.IsPaused() {
280-
// Fix activityCount such that graph mounts can be unmounted later
281-
if err := daemon.layerStore.ReinitRWLayer(c.RWLayer); err != nil {
282-
logrus.Errorf("Failed to ReinitRWLayer for %s due to %s", c.ID, err)
283-
return
284-
}
285280
if err := daemon.containerd.Restore(c.ID, libcontainerd.WithRestartManager(rm)); err != nil {
286281
logrus.Errorf("Failed to restore with containerd: %q", err)
287282
return

daemon/graphdriver/windows/windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"time"
2121
"unsafe"
2222

23+
"github.com/Microsoft/go-winio"
2324
"github.com/Microsoft/go-winio/archive/tar"
2425
"github.com/Microsoft/go-winio/backuptar"
2526
"github.com/Microsoft/hcsshim"
@@ -31,7 +32,6 @@ import (
3132
"github.com/docker/docker/pkg/longpath"
3233
"github.com/docker/docker/pkg/reexec"
3334
"github.com/docker/docker/pkg/system"
34-
"github.com/docker/docker/vendor/src/github.com/Microsoft/go-winio"
3535
"github.com/vbatts/tar-split/tar/storage"
3636
)
3737

daemon/graphdriver/zfs/zfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func Init(base string, opt []string, uidMaps, gidMaps []idtools.IDMap) (graphdri
105105
filesystemsCache: filesystemsCache,
106106
uidMaps: uidMaps,
107107
gidMaps: gidMaps,
108-
ctr: graphdriver.NewRefCounter(graphdriver.NewFsChecker(graphdriver.FsMagicZfs)),
108+
ctr: graphdriver.NewRefCounter(graphdriver.NewDefaultChecker()),
109109
}
110110
return graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps), nil
111111
}

distribution/xfer/download_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ func (ls *mockLayerStore) GetMountID(string) (string, error) {
121121
return "", errors.New("not implemented")
122122
}
123123

124-
func (ls *mockLayerStore) ReinitRWLayer(layer.RWLayer) error {
125-
return errors.New("not implemented")
126-
}
127-
128124
func (ls *mockLayerStore) Cleanup() error {
129125
return nil
130126
}

layer/layer.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ type Store interface {
174174
CreateRWLayer(id string, parent ChainID, mountLabel string, initFunc MountInit, storageOpt map[string]string) (RWLayer, error)
175175
GetRWLayer(id string) (RWLayer, error)
176176
GetMountID(id string) (string, error)
177-
ReinitRWLayer(l RWLayer) error
178177
ReleaseRWLayer(RWLayer) ([]Metadata, error)
179178

180179
Cleanup() error

layer/layer_store.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -495,19 +495,6 @@ func (ls *layerStore) GetMountID(id string) (string, error) {
495495
return mount.mountID, nil
496496
}
497497

498-
// ReinitRWLayer reinitializes a given mount to the layerstore, specifically
499-
// initializing the usage count. It should strictly only be used in the
500-
// daemon's restore path to restore state of live containers.
501-
func (ls *layerStore) ReinitRWLayer(l RWLayer) error {
502-
ls.mountL.Lock()
503-
defer ls.mountL.Unlock()
504-
505-
if _, ok := ls.mounts[l.Name()]; !ok {
506-
return ErrMountDoesNotExist
507-
}
508-
return nil
509-
}
510-
511498
func (ls *layerStore) ReleaseRWLayer(l RWLayer) ([]Metadata, error) {
512499
ls.mountL.Lock()
513500
defer ls.mountL.Unlock()

layer/layer_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,7 @@ func getCachedLayer(l Layer) *roLayer {
174174
}
175175

176176
func getMountLayer(l RWLayer) *mountedLayer {
177-
if rl, ok := l.(*referencedRWLayer); ok {
178-
return rl.mountedLayer
179-
}
180-
return l.(*mountedLayer)
177+
return l.(*referencedRWLayer).mountedLayer
181178
}
182179

183180
func createMetadata(layers ...Layer) []Metadata {

layer/mounted_layer.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ func (ml *mountedLayer) Parent() Layer {
4949
return nil
5050
}
5151

52-
func (ml *mountedLayer) Mount(mountLabel string) (string, error) {
53-
return ml.layerStore.driver.Get(ml.mountID, mountLabel)
54-
}
55-
56-
func (ml *mountedLayer) Unmount() error {
57-
return ml.layerStore.driver.Put(ml.mountID)
58-
}
59-
6052
func (ml *mountedLayer) Size() (int64, error) {
6153
return ml.layerStore.driver.DiffSize(ml.mountID, ml.cacheParent())
6254
}
@@ -101,11 +93,11 @@ type referencedRWLayer struct {
10193
}
10294

10395
func (rl *referencedRWLayer) Mount(mountLabel string) (string, error) {
104-
return rl.mountedLayer.Mount(mountLabel)
96+
return rl.layerStore.driver.Get(rl.mountedLayer.mountID, mountLabel)
10597
}
10698

10799
// Unmount decrements the activity count and unmounts the underlying layer
108100
// Callers should only call `Unmount` once per call to `Mount`, even on error.
109101
func (rl *referencedRWLayer) Unmount() error {
110-
return rl.mountedLayer.Unmount()
102+
return rl.layerStore.driver.Put(rl.mountedLayer.mountID)
111103
}

0 commit comments

Comments
 (0)