Skip to content

Commit 2f0421b

Browse files
committed
fix: run xfs_repair on invalid argument error
Run `xfs_repair` for invalid argument error. Part of: #8292 Signed-off-by: Noel Georgi <git@frezbo.dev>
1 parent f868fb8 commit 2f0421b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

internal/pkg/mount/mount.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ func PrefixMountTargets(mountpoints *Points, targetPrefix string) error {
141141
return iter.Err()
142142
}
143143

144+
//nolint:gocyclo
144145
func mountRetry(f RetryFunc, p *Point, isUnmount bool) (err error) {
145146
err = retry.Constant(5*time.Second, retry.WithUnits(50*time.Millisecond)).Retry(func() error {
146147
if err = f(p); err != nil {
@@ -162,6 +163,14 @@ func mountRetry(f RetryFunc, p *Point, isUnmount bool) (err error) {
162163
return retry.ExpectedError(checkErr)
163164
}
164165

166+
if !isMounted && !isUnmount {
167+
if errRepair := p.Repair(); errRepair != nil {
168+
return fmt.Errorf("error repairing: %w", errRepair)
169+
}
170+
171+
return retry.ExpectedError(err)
172+
}
173+
165174
if !isMounted && isUnmount { // if partition is already unmounted, ignore EINVAL
166175
return nil
167176
}

0 commit comments

Comments
 (0)