aboutsummaryrefslogtreecommitdiff
path: root/pkg/driver
diff options
context:
space:
mode:
authorchrislusf <chris.lu@gmail.com>2025-12-03 20:05:10 -0800
committerChris Lu <chrislusf@users.noreply.github.com>2025-12-03 20:52:27 -0800
commitfd2b35494095ccf7b06fb210305406f83ed17998 (patch)
tree051ecad6f60960abe23a8a16911cc1dd84ba3f30 /pkg/driver
parentfe60f2bf160c1191eb81765af2b2fc32a6d311b5 (diff)
downloadseaweedfs-csi-driver-fd2b35494095ccf7b06fb210305406f83ed17998.tar.xz
seaweedfs-csi-driver-fd2b35494095ccf7b06fb210305406f83ed17998.zip
fix: use RemoveAll for more robust staging path cleanupv1.3.5
Address gemini-code-assist review - use os.RemoveAll instead of os.Remove to handle cases where the directory is not empty after an imperfect unmount. This ensures complete cleanup of stale staging paths.
Diffstat (limited to 'pkg/driver')
-rw-r--r--pkg/driver/mount_util.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/driver/mount_util.go b/pkg/driver/mount_util.go
index 200817d..50c78d2 100644
--- a/pkg/driver/mount_util.go
+++ b/pkg/driver/mount_util.go
@@ -74,8 +74,9 @@ func cleanupStaleStagingPath(stagingPath string) error {
}
// Check if directory still exists and remove it
+ // Use RemoveAll to handle cases where directory is not empty after imperfect unmount
if _, err := os.Stat(stagingPath); err == nil {
- if err := os.Remove(stagingPath); err != nil {
+ if err := os.RemoveAll(stagingPath); err != nil {
glog.Warningf("failed to remove staging path %s: %v", stagingPath, err)
return err
}