diff options
| author | chrislusf <chris.lu@gmail.com> | 2025-12-03 20:05:10 -0800 |
|---|---|---|
| committer | Chris Lu <chrislusf@users.noreply.github.com> | 2025-12-03 20:52:27 -0800 |
| commit | fd2b35494095ccf7b06fb210305406f83ed17998 (patch) | |
| tree | 051ecad6f60960abe23a8a16911cc1dd84ba3f30 /pkg/driver/mount_util.go | |
| parent | fe60f2bf160c1191eb81765af2b2fc32a6d311b5 (diff) | |
| download | seaweedfs-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/mount_util.go')
| -rw-r--r-- | pkg/driver/mount_util.go | 3 |
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 } |
