-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(csi): propagate mount error in recoverBrokenMount #5753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,8 +181,8 @@ func (r *FuseRecover) recoverBrokenMount(point mountinfo.MountPoint) (err error) | |
|
|
||
| // Info: Attempting recovery action | ||
| glog.V(3).Infof("FuseRecovery: attempting bind mount, source=%s mountPath=%s options=%v", point.SourcePath, point.MountPath, mountOption) | ||
| if err := r.Mount(point.SourcePath, point.MountPath, "none", mountOption); err != nil { | ||
| // Warning: Mount failure is recoverable - will retry on next cycle | ||
| if err = r.Mount(point.SourcePath, point.MountPath, "none", mountOption); err != nil { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment "Mount failure is recoverable - will retry on next cycle" no longer matches the new behavior. After this fix, the error propagates to |
||
| // Warning: Mount failure is propagated to caller, which records FuseRecoverFailed event | ||
| glog.Warningf("FuseRecovery: bind mount failed, mountPath=%s source=%s error=%v", point.MountPath, point.SourcePath, err) | ||
| } | ||
| return | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this change correctly fixes the shadowing issue by using assignment (
=) instead of a short variable declaration (:=), the use of named return parameters (likeerrin this function signature) is generally discouraged in Go unless they provide significant documentation value. In this case, the named return directly contributed to the bug. For better maintainability and to prevent similar shadowing issues in the future, consider removing the named return parameter from the function signature and using explicitreturn errorreturn nilstatements.