diff options
Diffstat (limited to 'fs/xfs/scrub/common.c')
-rw-r--r-- | fs/xfs/scrub/common.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c index 3277c21bc914..121c05d234e1 100644 --- a/fs/xfs/scrub/common.c +++ b/fs/xfs/scrub/common.c @@ -33,6 +33,7 @@ #include "xfs_attr.h" #include "xfs_reflink.h" #include "xfs_rtrmap_btree.h" +#include "xfs_error.h" #include "scrub/xfs_scrub.h" #include "scrub/scrub.h" #include "scrub/common.h" @@ -91,6 +92,12 @@ __xchk_process_error( *error = 0; /* fall through */ default: + xfs_scrub_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; @@ -144,6 +151,13 @@ __xchk_fblock_process_error( *error = 0; /* fall through */ default: + xfs_scrub_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; @@ -216,6 +230,11 @@ xchk_block_set_corrupt( struct xfs_buf *bp) { sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; + xfs_scrub_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); } @@ -226,6 +245,11 @@ xchk_block_xref_set_corrupt( struct xfs_buf *bp) { sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; + xfs_scrub_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); } @@ -240,6 +264,8 @@ xchk_ino_set_corrupt( xfs_ino_t ino) { sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; + xfs_scrub_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); } @@ -250,6 +276,8 @@ xchk_ino_xref_set_corrupt( xfs_ino_t ino) { sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; + xfs_scrub_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); } @@ -261,6 +289,12 @@ xchk_fblock_set_corrupt( xfs_fileoff_t offset) { sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; + xfs_scrub_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); } @@ -272,6 +306,12 @@ xchk_fblock_xref_set_corrupt( xfs_fileoff_t offset) { sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; + xfs_scrub_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); } @@ -285,6 +325,8 @@ xchk_ino_set_warning( xfs_ino_t ino) { sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; + xfs_scrub_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); } @@ -296,6 +338,12 @@ xchk_fblock_set_warning( xfs_fileoff_t offset) { sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; + xfs_scrub_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); } @@ -738,6 +786,12 @@ xchk_get_inode( error = -EFSCORRUPTED; /* fall through */ default: + xfs_scrub_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), @@ -810,6 +864,10 @@ xchk_should_check_xref( } sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL; + xfs_scrub_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); /* @@ -840,6 +898,11 @@ xchk_buffer_recheck( if (!fa) return; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; + xfs_scrub_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); } @@ -1147,3 +1210,28 @@ xfs_scrub_foreach_live_inode( return error; } + +void +xfs_scrub_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) %pf: %pV\n", mp->m_fsname, __return_address, + &vaf); + va_end(args); + + if (!kstrtoint(KERN_INFO, 0, &level) && + level <= LOGLEVEL_ERR && + xfs_error_level >= XFS_ERRLEVEL_HIGH) + xfs_stack_trace(); +} |