From 05ac88f67723f1a6ce60543413f3ae59d2e85654 Mon Sep 17 00:00:00 2001 From: chrislusf Date: Wed, 3 Dec 2025 19:36:35 -0800 Subject: 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) --- pkg/driver/volume.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'pkg/driver/volume.go') 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) } -- cgit v1.2.3