diff options
| author | chrislusf <chris.lu@gmail.com> | 2025-12-03 19:36:35 -0800 |
|---|---|---|
| committer | chrislusf <chris.lu@gmail.com> | 2025-12-03 19:36:35 -0800 |
| commit | a0500b8a994235079337599ba6ebdc598a671abf (patch) | |
| tree | 647a3bddb1383926f0f7907aaed0f36982023a78 /pkg/driver/volume.go | |
| parent | 454b9651450a8feecf5896ce3b2526a442a73e33 (diff) | |
| download | seaweedfs-csi-driver-a0500b8a994235079337599ba6ebdc598a671abf.tar.xz seaweedfs-csi-driver-a0500b8a994235079337599ba6ebdc598a671abf.zip | |
refactor: address code review feedback
- Handle unexpected stat errors in cleanupStaleStagingPath (high priority)
- Extract staging logic into stageNewVolume helper method for reuse
- Extract isReadOnlyAccessMode helper to avoid duplicated read-only checks
- Remove redundant mountutil.Unmount call (CleanupMountPoint already handles it)
Diffstat (limited to 'pkg/driver/volume.go')
| -rw-r--r-- | pkg/driver/volume.go | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/pkg/driver/volume.go b/pkg/driver/volume.go index 8abf88b..023abf9 100644 --- a/pkg/driver/volume.go +++ b/pkg/driver/volume.go @@ -123,12 +123,7 @@ func (vol *Volume) Unstage(stagingTargetPath string) error { // after a CSI driver restart. In this case, we need to force unmount. glog.Infof("volume %s has no unmounter (rebuilt from existing mount), using force unmount", vol.VolumeId) - // Try to unmount the staging path - if err := mountutil.Unmount(stagingTargetPath); err != nil { - glog.Warningf("error force unmounting volume %s: %v", vol.VolumeId, err) - } - - // Clean up using mount utilities + // Clean up using mount utilities. This will also handle unmounting. if err := mount.CleanupMountPoint(stagingTargetPath, mountutil, true); err != nil { glog.Warningf("error cleaning up mount point for volume %s: %v", vol.VolumeId, err) } |
