-
Notifications
You must be signed in to change notification settings - Fork 203
Do not perform xfs_repair on xfs filesystem #150
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
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 |
---|---|---|
|
@@ -314,33 +314,6 @@ func (mounter *SafeFormatAndMount) checkAndRepairFilesystem(source string) error | |
return nil | ||
} | ||
|
||
// checkAndRepairXfsFilesystem checks and repairs xfs filesystem using command xfs_repair. | ||
func (mounter *SafeFormatAndMount) checkAndRepairXfsFilesystem(source string) error { | ||
klog.V(4).Infof("Checking for issues with xfs_repair on disk: %s", source) | ||
|
||
args := []string{source} | ||
checkArgs := []string{"-n", source} | ||
|
||
// check-only using "xfs_repair -n", if the exit status is not 0, perform a "xfs_repair" | ||
_, err := mounter.Exec.Command("xfs_repair", checkArgs...).CombinedOutput() | ||
if err != nil { | ||
if err == utilexec.ErrExecutableNotFound { | ||
klog.Warningf("'xfs_repair' not found on system; continuing mount without running 'xfs_repair'.") | ||
return nil | ||
} else { | ||
klog.Warningf("Filesystem corruption was detected for %s, running xfs_repair to repair", source) | ||
out, err := mounter.Exec.Command("xfs_repair", args...).CombinedOutput() | ||
if err != nil { | ||
return NewMountError(HasFilesystemErrors, "'xfs_repair' found errors on device %s but could not correct them: %s\n", source, out) | ||
} else { | ||
klog.Infof("Device %s has errors which were corrected by xfs_repair.", source) | ||
return nil | ||
} | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
// formatAndMount uses unix utils to format and mount the given disk | ||
func (mounter *SafeFormatAndMount) formatAndMountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error { | ||
readOnly := false | ||
|
@@ -410,14 +383,7 @@ func (mounter *SafeFormatAndMount) formatAndMountSensitive(source string, target | |
|
||
if !readOnly { | ||
// Run check tools on the disk to fix repairable issues, only do this for formatted volumes requested as rw. | ||
var err error | ||
switch existingFormat { | ||
case "xfs": | ||
err = mounter.checkAndRepairXfsFilesystem(source) | ||
default: | ||
err = mounter.checkAndRepairFilesystem(source) | ||
} | ||
|
||
err := mounter.checkAndRepairFilesystem(source) | ||
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 code that is part of 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. We could revert that change too but I figured it is harmless and helps to keep diff of this PR small. We will have to fix all the breaking tests because order in which Also it is perfectly fine to not run 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. Ack. Sounds good to me. @msau42 @xing-yang @jsafrane any objections? 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. Sounds good to me. 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. lgtm. The bug report had the error past the fs format check, so it's not the fs format check that's failing. 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.
@gnufied can you confirm? 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. which bug report? #141 or #125 ? I assume #141 - yes the problem isn't format checking but problem was that repairing the disk actually prevented volume from being mounted and recovery (although in some cases XFS volume can't recover itself and requires So, the only valid reason I did not do a full revert is because I liked not having to do a 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. Ack. SGTM |
||
if err != nil { | ||
return err | ||
} | ||
|
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.
code before change:
and hence should be same as before.