mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-03 14:53:52 +00:00
Revert xfs_repair fix
This commit is contained in:
committed by
Srini Brahmaroutu
parent
d37a1749ed
commit
5f0ba4923c
@@ -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)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user