summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/scrub/common.c')
-rw-r--r--fs/xfs/scrub/common.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index 8cda752fad67..195e7ab082b9 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -27,6 +27,7 @@
#include "xfs_attr.h"
#include "xfs_reflink.h"
#include "xfs_rtrmap_btree.h"
+#include "xfs_error.h"
#include "scrub/scrub.h"
#include "scrub/common.h"
#include "scrub/trace.h"
@@ -84,6 +85,12 @@ __xchk_process_error(
*error = 0;
/* fall through */
default:
+ xchk_whine(sc->mp, "type %d agno %u agbno %u error %d ret_ip %pS",
+ sc->sm->sm_type,
+ agno,
+ bno,
+ *error,
+ ret_ip);
trace_xchk_op_error(sc, agno, bno, *error,
ret_ip);
break;
@@ -137,6 +144,13 @@ __xchk_fblock_process_error(
*error = 0;
/* fall through */
default:
+ xchk_whine(sc->mp, "ino %llu fork %d type %d offset %llu error %d ret_ip %pS",
+ sc->ip->i_ino,
+ whichfork,
+ sc->sm->sm_type,
+ offset,
+ *error,
+ ret_ip);
trace_xchk_file_op_error(sc, whichfork, offset, *error,
ret_ip);
break;
@@ -208,6 +222,8 @@ xchk_set_corrupt(
struct xfs_scrub *sc)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
+ xchk_whine(sc->mp, "type %d ret_ip %pS", sc->sm->sm_type,
+ __return_address);
trace_xchk_fs_error(sc, 0, __return_address);
}
@@ -218,6 +234,11 @@ xchk_block_set_corrupt(
struct xfs_buf *bp)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
+ xchk_whine(sc->mp, "type %d agno %u agbno %u ret_ip %pS",
+ sc->sm->sm_type,
+ XFS_FSB_TO_AGNO(sc->mp, XFS_DADDR_TO_FSB(sc->mp, bp->b_bn)),
+ XFS_FSB_TO_AGBNO(sc->mp, XFS_DADDR_TO_FSB(sc->mp, bp->b_bn)),
+ __return_address);
trace_xchk_block_error(sc, bp->b_bn, __return_address);
}
@@ -228,6 +249,11 @@ xchk_block_xref_set_corrupt(
struct xfs_buf *bp)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT;
+ xchk_whine(sc->mp, "type %d agno %u agbno %u ret_ip %pS",
+ sc->sm->sm_type,
+ XFS_FSB_TO_AGNO(sc->mp, XFS_DADDR_TO_FSB(sc->mp, bp->b_bn)),
+ XFS_FSB_TO_AGBNO(sc->mp, XFS_DADDR_TO_FSB(sc->mp, bp->b_bn)),
+ __return_address);
trace_xchk_block_error(sc, bp->b_bn, __return_address);
}
@@ -242,6 +268,8 @@ xchk_ino_set_corrupt(
xfs_ino_t ino)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
+ xchk_whine(sc->mp, "ino %llu type %d ret_ip %pS",
+ ino, sc->sm->sm_type, __return_address);
trace_xchk_ino_error(sc, ino, __return_address);
}
@@ -252,6 +280,8 @@ xchk_ino_xref_set_corrupt(
xfs_ino_t ino)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT;
+ xchk_whine(sc->mp, "ino %llu type %d ret_ip %pS",
+ ino, sc->sm->sm_type, __return_address);
trace_xchk_ino_error(sc, ino, __return_address);
}
@@ -263,6 +293,12 @@ xchk_fblock_set_corrupt(
xfs_fileoff_t offset)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
+ xchk_whine(sc->mp, "ino %llu fork %d type %d offset %llu ret_ip %pS",
+ sc->ip->i_ino,
+ whichfork,
+ sc->sm->sm_type,
+ offset,
+ __return_address);
trace_xchk_fblock_error(sc, whichfork, offset, __return_address);
}
@@ -274,6 +310,12 @@ xchk_fblock_xref_set_corrupt(
xfs_fileoff_t offset)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT;
+ xchk_whine(sc->mp, "ino %llu fork %d type %d offset %llu ret_ip %pS",
+ sc->ip->i_ino,
+ whichfork,
+ sc->sm->sm_type,
+ offset,
+ __return_address);
trace_xchk_fblock_error(sc, whichfork, offset, __return_address);
}
@@ -287,6 +329,8 @@ xchk_ino_set_warning(
xfs_ino_t ino)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING;
+ xchk_whine(sc->mp, "ino %llu type %d agno %u agbno %u ret_ip %pS",
+ ino, sc->sm->sm_type, __return_address);
trace_xchk_ino_warning(sc, ino, __return_address);
}
@@ -298,6 +342,12 @@ xchk_fblock_set_warning(
xfs_fileoff_t offset)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING;
+ xchk_whine(sc->mp, "ino %llu fork %d type %d offset %llu ret_ip %pS",
+ sc->ip->i_ino,
+ whichfork,
+ sc->sm->sm_type,
+ offset,
+ __return_address);
trace_xchk_fblock_warning(sc, whichfork, offset, __return_address);
}
@@ -748,6 +798,12 @@ xchk_get_inode(
error = -EFSCORRUPTED;
/* fall through */
default:
+ xchk_whine(mp, "type %d agno %u agbno %u error %d ret_ip %pS",
+ sc->sm->sm_type,
+ XFS_INO_TO_AGNO(mp, sc->sm->sm_ino),
+ XFS_INO_TO_AGBNO(mp, sc->sm->sm_ino),
+ error,
+ __return_address);
trace_xchk_op_error(sc,
XFS_INO_TO_AGNO(mp, sc->sm->sm_ino),
XFS_INO_TO_AGBNO(mp, sc->sm->sm_ino),
@@ -820,6 +876,10 @@ xchk_should_check_xref(
}
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL;
+ xchk_whine(sc->mp, "type %d xref error %d ret_ip %pS",
+ sc->sm->sm_type,
+ *error,
+ __return_address);
trace_xchk_xref_error(sc, *error, __return_address);
/*
@@ -850,6 +910,11 @@ xchk_buffer_recheck(
if (!fa)
return;
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
+ xchk_whine(sc->mp, "type %d agno %u agbno %u ret_ip %pS",
+ sc->sm->sm_type,
+ XFS_FSB_TO_AGNO(sc->mp, XFS_DADDR_TO_FSB(sc->mp, bp->b_bn)),
+ XFS_FSB_TO_AGBNO(sc->mp, XFS_DADDR_TO_FSB(sc->mp, bp->b_bn)),
+ fa);
trace_xchk_block_error(sc, bp->b_bn, fa);
}
@@ -1032,3 +1097,29 @@ xchk_fs_thaw(
mutex_unlock(&sc->mp->m_scrub_freeze);
return error;
}
+
+/* Complain about failures... */
+void
+xchk_whine(
+ const struct xfs_mount *mp,
+ const char *fmt,
+ ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int level;
+
+ va_start(args, fmt);
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ printk(KERN_INFO "XFS (%s) %pS: %pV\n", mp->m_super->s_id,
+ __return_address, &vaf);
+ va_end(args);
+
+ if (!kstrtoint(KERN_INFO, 0, &level) &&
+ level <= LOGLEVEL_ERR &&
+ xfs_error_level >= XFS_ERRLEVEL_HIGH)
+ xfs_stack_trace();
+}