diff options
| author | chrislusf <chris.lu@gmail.com> | 2025-12-03 19:54:28 -0800 |
|---|---|---|
| committer | Chris Lu <chrislusf@users.noreply.github.com> | 2025-12-03 20:52:27 -0800 |
| commit | 639573bdc0108da9c4d6fce7ffcb897ea1b71e14 (patch) | |
| tree | 2e4e28653e548c1ed330711f754bf272276d094b /pkg | |
| parent | 921804525b8c4eaf840ac4c4956ce271712d3692 (diff) | |
| download | seaweedfs-csi-driver-639573bdc0108da9c4d6fce7ffcb897ea1b71e14.tar.xz seaweedfs-csi-driver-639573bdc0108da9c4d6fce7ffcb897ea1b71e14.zip | |
fix: cleanup staged mount on quota application failure
Address CodeRabbit review - if volume.Stage() succeeds but volume.Quota()
fails, clean up the staged mount before returning the error to avoid
leaving an orphaned FUSE process.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/driver/nodeserver.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/driver/nodeserver.go b/pkg/driver/nodeserver.go index e8890dd..e65038e 100644 --- a/pkg/driver/nodeserver.go +++ b/pkg/driver/nodeserver.go @@ -380,6 +380,10 @@ func (ns *NodeServer) stageNewVolume(volumeID, stagingTargetPath string, volCont if capacity, err := k8s.GetVolumeCapacity(volumeID); err == nil { if err := volume.Quota(capacity); err != nil { glog.Warningf("failed to apply quota for volume %s: %v", volumeID, err) + // Clean up the staged mount since we're returning an error + if unstageErr := volume.Unstage(stagingTargetPath); unstageErr != nil { + glog.Errorf("failed to unstage volume %s after quota failure: %v", volumeID, unstageErr) + } return nil, err } } else { |
