diff options
| author | chrislusf <chris.lu@gmail.com> | 2025-12-03 20:05:10 -0800 |
|---|---|---|
| committer | chrislusf <chris.lu@gmail.com> | 2025-12-03 20:05:10 -0800 |
| commit | 7dad8a3790a51647d520783b0e5db0fb0a075c08 (patch) | |
| tree | 4221c968c66b6a2cc65ba067e0b00361e554bf71 | |
| parent | 64082cc28443d9489c10fa8cee47d023892ece43 (diff) | |
| download | seaweedfs-csi-driver-origin/fix/csi-driver-self-healing.tar.xz seaweedfs-csi-driver-origin/fix/csi-driver-self-healing.zip | |
fix: use RemoveAll for more robust staging path cleanuporigin/fix/csi-driver-self-healing
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.
| -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 } |
