From ac91de717939e1ad54e008f94f22c4bea22d6a2c Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 20 Nov 2024 10:15:40 +0100 Subject: [PATCH] rbd: use os.Remove to remove directory using os.RemoveAll will remove everything in the director after the Umount we should be using os.Remove only to remove the empty directory Signed-off-by: Madhu Rajanna (cherry picked from commit 39cc628adf1da1ab78f3aacfb7fe8f53e9a1fd29) --- internal/rbd/nodeserver.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index df7b9cf6912..905fcf8affe 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -938,7 +938,7 @@ func (ns *NodeServer) NodeUnpublishVolume( return nil, status.Error(codes.NotFound, err.Error()) } if !isMnt { - if err = os.RemoveAll(targetPath); err != nil { + if err = os.Remove(targetPath); err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -949,7 +949,7 @@ func (ns *NodeServer) NodeUnpublishVolume( return nil, status.Error(codes.Internal, err.Error()) } - if err = os.RemoveAll(targetPath); err != nil { + if err = os.Remove(targetPath); err != nil { return nil, status.Error(codes.Internal, err.Error()) }