Commit 3d8426b1 authored by Darrick J. Wong's avatar Darrick J. Wong

Merge tag 'scrub-fix-return-value-6.2_2022-11-16' of...

Merge tag 'scrub-fix-return-value-6.2_2022-11-16' of git://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.2-mergeA

xfs: fix incorrect return values in online fsck

Here we fix a couple of problems with the errno values that we return to
userspace.

v23.2: fix vague wording of comment
v23.3: fix the commit message to discuss what's really going on in this
patch
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>

* tag 'scrub-fix-return-value-6.2_2022-11-16' of git://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux:
  xfs: don't return -EFSCORRUPTED from repair when resources cannot be grabbed
  xfs: don't retry repairs harder when EAGAIN is returned
  xfs: fix return code when fatal signal encountered during dquot scrub
  xfs: return EINTR when a fatal signal terminates scrub
parents af1077fa 93b0c58e
......@@ -25,7 +25,7 @@ xchk_should_terminate(
if (fatal_signal_pending(current)) {
if (*error == 0)
*error = -EAGAIN;
*error = -EINTR;
return true;
}
return false;
......
......@@ -84,7 +84,7 @@ xchk_quota_item(
int error = 0;
if (xchk_should_terminate(sc, &error))
return -ECANCELED;
return error;
/*
* Except for the root dquot, the actual dquot we got must either have
......
......@@ -61,7 +61,6 @@ xrep_attempt(
sc->flags |= XREP_ALREADY_FIXED;
return -EAGAIN;
case -EDEADLOCK:
case -EAGAIN:
/* Tell the caller to try again having grabbed all the locks. */
if (!(sc->flags & XCHK_TRY_HARDER)) {
sc->flags |= XCHK_TRY_HARDER;
......@@ -70,10 +69,15 @@ xrep_attempt(
/*
* We tried harder but still couldn't grab all the resources
* we needed to fix it. The corruption has not been fixed,
* so report back to userspace.
* so exit to userspace with the scan's output flags unchanged.
*/
return -EFSCORRUPTED;
return 0;
default:
/*
* EAGAIN tells the caller to re-scrub, so we cannot return
* that here.
*/
ASSERT(error != -EAGAIN);
return error;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment