Skip to content

Commit 60d42ed

Browse files
committed
Improve logging in defer func of Delete() for "efs-dir" mode
Two issues fixed: * If Unmount() failed, return error message with unmountErr * If Delete() failed before defer func, and defer func failed, return error message with both errors
1 parent 924fc84 commit 60d42ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/driver/provisioner_dir.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ func (d DirectoryProvisioner) Delete(ctx context.Context, req *csi.DeleteVolumeR
181181
// If that fails then track the error but don't do anything else
182182
if unmountErr != nil {
183183
klog.V(5).Infof("Unmount failed at '%s'", target)
184-
e = status.Errorf(codes.Internal, "Could not unmount %q: %v", target, err)
184+
e = status.Errorf(codes.Internal, "Could not unmount %q: %v (prev error: %v)", target, unmountErr, e)
185185
} else {
186186
// If it is nil then it's safe to try and delete the directory as it should now be empty
187187
klog.V(5).Infof("Deleting temporary directory at '%s'", target)
188188
if err := d.osClient.Remove(target); err != nil && !os.IsNotExist(err) {
189-
e = status.Errorf(codes.Internal, "Could not delete %q: %v", target, err)
189+
e = status.Errorf(codes.Internal, "Could not delete %q: %v (prev error: %v)", target, err, e)
190190
}
191191
}
192192
}()

0 commit comments

Comments
 (0)