From 139e0d50843c6bd00d0612b979c2d769b2aaa477 Mon Sep 17 00:00:00 2001 From: Jan Pazdziora Date: Tue, 25 Jul 2017 10:07:34 +0200 Subject: [PATCH] UPSTREAM: 49118: Allow unmounting bind-mounted directories. For bind-mounted directories, the isNotMounted which calls IsLikelyNotMountPoint fails because the filesystem of the mounted location and the parent directory are the same. Addressing: unmounter.go:59] Warning: Path: /path/.../test-dir already unmounted --- .../pkg/volume/flexvolume/unmounter.go | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/vendor/k8s.io/kubernetes/pkg/volume/flexvolume/unmounter.go b/vendor/k8s.io/kubernetes/pkg/volume/flexvolume/unmounter.go index 2959b53f9489..2f1e189b1c78 100644 --- a/vendor/k8s.io/kubernetes/pkg/volume/flexvolume/unmounter.go +++ b/vendor/k8s.io/kubernetes/pkg/volume/flexvolume/unmounter.go @@ -51,23 +51,15 @@ func (f *flexVolumeUnmounter) TearDownAt(dir string) error { return nil } - notmnt, err := isNotMounted(f.mounter, dir) + call := f.plugin.NewDriverCall(unmountCmd) + call.Append(dir) + _, err := call.Run() + if isCmdNotSupportedErr(err) { + err = (*unmounterDefaults)(f).TearDownAt(dir) + } if err != nil { return err } - if notmnt { - glog.Warningf("Warning: Path: %v already unmounted", dir) - } else { - call := f.plugin.NewDriverCall(unmountCmd) - call.Append(dir) - _, err := call.Run() - if isCmdNotSupportedErr(err) { - err = (*unmounterDefaults)(f).TearDownAt(dir) - } - if err != nil { - return err - } - } // Flexvolume driver may remove the directory. Ignore if it does. if pathExists, pathErr := util.PathExists(dir); pathErr != nil {