summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/scrub.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-07-14 11:16:21 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-10-14 14:17:28 -0700
commit45bbbb82edc53d0ea64bd7fad9d5cebd41d6c391 (patch)
tree98d301f182aa44e27e9cece44a25e1f3bc4e8473 /fs/xfs/scrub/scrub.c
parent2f6716f60842be8bb64deb06a461b66272ac405a (diff)
xfs: whine to dmesg when we encounter errors
Forward everything scrub whines about to dmesg. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/scrub.c')
-rw-r--r--fs/xfs/scrub/scrub.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/fs/xfs/scrub/scrub.c b/fs/xfs/scrub/scrub.c
index 2f60fd6b86a9..342a50248650 100644
--- a/fs/xfs/scrub/scrub.c
+++ b/fs/xfs/scrub/scrub.c
@@ -551,6 +551,42 @@ static inline void xchk_postmortem(struct xfs_scrub *sc)
}
#endif /* CONFIG_XFS_ONLINE_REPAIR */
+static inline void
+repair_outcomes(struct xfs_scrub *sc, int error)
+{
+ struct xfs_scrub_metadata *sm = sc->sm;
+ const char *wut = NULL;
+
+ if (sc->flags & XREP_ALREADY_FIXED) {
+ wut = "*** REPAIR SUCCESS";
+ error = 0;
+ } else if (error == -EBUSY) {
+ wut = "??? FILESYSTEM BUSY";
+ } else if (error == -EAGAIN) {
+ wut = "??? REPAIR DEFERRED";
+ } else if (error == -ECANCELED) {
+ wut = "??? REPAIR CANCELLED";
+ } else if (error == -EINTR) {
+ wut = "??? REPAIR INTERRUPTED";
+ } else if (error != -EOPNOTSUPP && error != -ENOENT) {
+ wut = "!!! REPAIR FAILED";
+ xfs_info(sc->mp,
+"%s ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags 0x%x error %d",
+ wut, XFS_I(file_inode(sc->file))->i_ino,
+ xchk_type_string(sm->sm_type), sm->sm_agno,
+ sm->sm_ino, sm->sm_gen, sm->sm_flags, error);
+ return;
+ } else {
+ return;
+ }
+
+ xfs_info_ratelimited(sc->mp,
+"%s ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags 0x%x error %d",
+ wut, XFS_I(file_inode(sc->file))->i_ino,
+ xchk_type_string(sm->sm_type), sm->sm_agno, sm->sm_ino,
+ sm->sm_gen, sm->sm_flags, error);
+}
+
/* Dispatch metadata scrubbing. */
int
xfs_scrub_metadata(
@@ -643,6 +679,7 @@ retry_op:
* already tried to fix it, then attempt a repair.
*/
error = xrep_attempt(sc);
+ repair_outcomes(sc, error);
if (error == -EAGAIN) {
/*
* Either the repair function succeeded or it couldn't