From 83fbbd6d93f1c229db2532ab75e24325b1b8ab41 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 17 Nov 2020 18:35:09 +0530 Subject: [PATCH] cephfs: check only the stderror message for umount if the cephfs mountpoint is not mounted the umount call will fail with both stderr and err, an error (exit status 32) and stdError (umount: /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pvc-e622cd2b-0b87-4f49-a709-b89664ca6ec4/globalmount: not mounted. checking stderr is sufficient to find out the mountpoint is not mounted. Signed-off-by: Madhu Rajanna --- internal/cephfs/volumemounter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cephfs/volumemounter.go b/internal/cephfs/volumemounter.go index 67bd6eb89..f6e8d308f 100644 --- a/internal/cephfs/volumemounter.go +++ b/internal/cephfs/volumemounter.go @@ -258,7 +258,7 @@ func bindMount(ctx context.Context, from, to string, readOnly bool, mntOptions [ func unmountVolume(ctx context.Context, mountPoint string) error { if err := execCommandErr(ctx, "umount", mountPoint); err != nil { - if strings.Contains(err.Error(), fmt.Sprintf("exit status 32: umount: %s: not mounted", mountPoint)) || + if strings.Contains(err.Error(), fmt.Sprintf("umount: %s: not mounted", mountPoint)) || strings.Contains(err.Error(), "No such file or directory") { return nil }