Skip to content

Commit

Permalink
Merge pull request #1908 from leiyiz/release-1.14.2-exp
Browse files Browse the repository at this point in the history
experimental fix, remove deviceInUse check
  • Loading branch information
pwschuurman authored Jan 17, 2025
2 parents 4c5ee54 + 7233438 commit 17072be
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions pkg/gce-pd-csi-driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"errors"
"fmt"
"os"
"path/filepath"
"regexp"
"runtime"
"strconv"
Expand Down Expand Up @@ -468,21 +467,24 @@ func (ns *GCENodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUns
type ignoreableError struct{ error }

func (ns *GCENodeServer) confirmDeviceUnused(volumeID string) error {
devicePath, err := getDevicePath(ns, volumeID, "" /* partition, which is unused */)
if err != nil {
return &ignoreableError{fmt.Errorf("failed to find device path for volume %s: %v", volumeID, err.Error())}
}

devFsPath, err := filepath.EvalSymlinks(devicePath)
if err != nil {
return &ignoreableError{fmt.Errorf("filepath.EvalSymlinks(%q) failed: %v", devicePath, err)}
}
// 1.14-exp release. DO NOT INCLUDE in regular release.
//

if inUse, err := ns.DeviceUtils.IsDeviceFilesystemInUse(ns.Mounter, devicePath, devFsPath); err != nil {
return &ignoreableError{fmt.Errorf("failed to check if device %s (aka %s) is in use: %v", devicePath, devFsPath, err)}
} else if inUse {
return fmt.Errorf("device %s (aka %s) is still in use", devicePath, devFsPath)
}
// devicePath, err := getDevicePath(ns, volumeID, "" /* partition, which is unused */)
// if err != nil {
// return &ignoreableError{fmt.Errorf("failed to find device path for volume %s: %v", volumeID, err.Error())}
// }

// devFsPath, err := filepath.EvalSymlinks(devicePath)
// if err != nil {
// return &ignoreableError{fmt.Errorf("filepath.EvalSymlinks(%q) failed: %v", devicePath, err)}
// }

// if inUse, err := ns.DeviceUtils.IsDeviceFilesystemInUse(ns.Mounter, devicePath, devFsPath); err != nil {
// return &ignoreableError{fmt.Errorf("failed to check if device %s (aka %s) is in use: %v", devicePath, devFsPath, err)}
// } else if inUse {
// return fmt.Errorf("device %s (aka %s) is still in use", devicePath, devFsPath)
// }

return nil
}
Expand Down

0 comments on commit 17072be

Please sign in to comment.