From 2f0421b406ee252e9197c0b4589c0b33662bef34 Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Tue, 13 Feb 2024 12:41:09 +0530 Subject: [PATCH] fix: run xfs_repair on invalid argument error Run `xfs_repair` for invalid argument error. Part of: #8292 Signed-off-by: Noel Georgi --- internal/pkg/mount/mount.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/pkg/mount/mount.go b/internal/pkg/mount/mount.go index 8d8e65d889..4552cea441 100644 --- a/internal/pkg/mount/mount.go +++ b/internal/pkg/mount/mount.go @@ -141,6 +141,7 @@ func PrefixMountTargets(mountpoints *Points, targetPrefix string) error { return iter.Err() } +//nolint:gocyclo func mountRetry(f RetryFunc, p *Point, isUnmount bool) (err error) { err = retry.Constant(5*time.Second, retry.WithUnits(50*time.Millisecond)).Retry(func() error { if err = f(p); err != nil { @@ -162,6 +163,14 @@ func mountRetry(f RetryFunc, p *Point, isUnmount bool) (err error) { return retry.ExpectedError(checkErr) } + if !isMounted && !isUnmount { + if errRepair := p.Repair(); errRepair != nil { + return fmt.Errorf("error repairing: %w", errRepair) + } + + return retry.ExpectedError(err) + } + if !isMounted && isUnmount { // if partition is already unmounted, ignore EINVAL return nil }