From a0b8429d2e57e15d559333a79f33ff58ad1cf34e Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Thu, 29 Jan 2015 16:13:12 -0800 Subject: [PATCH] Reverse the order of unmounting and removing the pd disk. This should mean that we retry detaching if the original detach fails for some reason. --- pkg/kubelet/volume/gce_pd/gce_pd.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/kubelet/volume/gce_pd/gce_pd.go b/pkg/kubelet/volume/gce_pd/gce_pd.go index cfd5f73b9dc..cdec6a3f0e4 100644 --- a/pkg/kubelet/volume/gce_pd/gce_pd.go +++ b/pkg/kubelet/volume/gce_pd/gce_pd.go @@ -234,9 +234,6 @@ func (pd *gcePersistentDisk) TearDown() error { return err } refCount-- - if err := os.RemoveAll(pd.GetPath()); err != nil { - return err - } // If refCount is 1, then all bind mounts have been removed, and the // remaining reference is the global mount. It is safe to detach. if refCount == 1 { @@ -244,5 +241,8 @@ func (pd *gcePersistentDisk) TearDown() error { return err } } + if err := os.RemoveAll(pd.GetPath()); err != nil { + return err + } return nil }