diff options
author | Darrick J. Wong <[email protected]> | 2022-11-16 19:18:54 -0800 |
---|---|---|
committer | Darrick J. Wong <[email protected]> | 2022-11-16 19:18:54 -0800 |
commit | 3d8426b13bac65d6729a836eda70a172e02afd62 (patch) | |
tree | cfbae54c48b7b7ba4538ecdb01f38f20e6a76c75 | |
parent | af1077fa87c33bc1d7c453321f112c8a562afad8 (diff) | |
parent | 93b0c58ed04b6cbe45354f23bb5628fff31f9084 (diff) |
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: Darrick J. Wong <[email protected]>
* 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
-rw-r--r-- | fs/xfs/scrub/common.h | 2 | ||||
-rw-r--r-- | fs/xfs/scrub/quota.c | 2 | ||||
-rw-r--r-- | fs/xfs/scrub/repair.c | 10 |
3 files changed, 9 insertions, 5 deletions
diff --git a/fs/xfs/scrub/common.h b/fs/xfs/scrub/common.h index 454145db10e7..b73648d81d23 100644 --- a/fs/xfs/scrub/common.h +++ b/fs/xfs/scrub/common.h @@ -25,7 +25,7 @@ xchk_should_terminate( if (fatal_signal_pending(current)) { if (*error == 0) - *error = -EAGAIN; + *error = -EINTR; return true; } return false; diff --git a/fs/xfs/scrub/quota.c b/fs/xfs/scrub/quota.c index 21b4c9006859..0b643ff32b22 100644 --- a/fs/xfs/scrub/quota.c +++ b/fs/xfs/scrub/quota.c @@ -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 diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c index 22335619c84e..4b92f9253ccd 100644 --- a/fs/xfs/scrub/repair.c +++ b/fs/xfs/scrub/repair.c @@ -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; } } |