From fd2ecc289e1f462e3b25aaf7b2e1dee709d201ab Mon Sep 17 00:00:00 2001 From: WuJing Date: Mon, 29 Apr 2019 16:46:09 +0800 Subject: [PATCH 10/47] abnormal scene container restart failure Solve the problem that the mountpoint.json write fails due to an abnormal condition, causing the container to fail to restart. Signed-off-by: WuJing --- vendor/github.com/containers/storage/layers.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vendor/github.com/containers/storage/layers.go b/vendor/github.com/containers/storage/layers.go index 8fcc4e2..e01cf23 100644 --- a/vendor/github.com/containers/storage/layers.go +++ b/vendor/github.com/containers/storage/layers.go @@ -26,6 +26,7 @@ import ( "github.com/vbatts/tar-split/tar/asm" "github.com/vbatts/tar-split/tar/storage" "github.com/sirupsen/logrus" + "github.com/docker/docker/pkg/mount" ) const ( @@ -713,8 +714,10 @@ func (r *layerStore) Mount(id string, options drivers.MountOpts) (string, error) return "", ErrLayerUnknown } if layer.MountCount > 0 { - layer.MountCount++ - return layer.MountPoint, r.Save() + if mounted, err := mount.Mounted(layer.MountPoint); mounted && err == nil { + layer.MountCount++ + return layer.MountPoint, r.Save() + } } if options.MountLabel == "" { options.MountLabel = layer.MountLabel -- 2.19.1