From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/9] xfs: refactor inode buffer verifier error logging
Date: Wed, 21 Mar 2018 09:55:30 -0400 [thread overview]
Message-ID: <20180321135530.GE11127@bfoster.bfoster> (raw)
In-Reply-To: <152107379476.19571.15155451515464003337.stgit@magnolia>
On Wed, Mar 14, 2018 at 05:29:54PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> When the inode buffer verifier encounters an error, it's much more
> helpful to print a buffer from the offending inode instead of just the
> start of the inode chunk buffer.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/libxfs/xfs_inode_buf.c | 4 +++-
> fs/xfs/xfs_error.c | 29 ++++++++++++++++++++++++-----
> fs/xfs/xfs_error.h | 3 +++
> 3 files changed, 30 insertions(+), 6 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
> index 4fe17b3..51019e5 100644
> --- a/fs/xfs/libxfs/xfs_inode_buf.c
> +++ b/fs/xfs/libxfs/xfs_inode_buf.c
> @@ -115,13 +115,15 @@ xfs_inode_buf_verify(
> return;
> }
>
> - xfs_verifier_error(bp, -EFSCORRUPTED, __this_address);
> #ifdef DEBUG
> xfs_alert(mp,
> "bad inode magic/vsn daddr %lld #%d (magic=%x)",
> (unsigned long long)bp->b_bn, i,
> be16_to_cpu(dip->di_magic));
> #endif
> + xfs_buf_verifier_error(bp, -EFSCORRUPTED,
> + __func__, dip, sizeof(*dip),
> + NULL);
Why not continue to pass __this_address? Otherwise looks fine:
Reviewed-by: Brian Foster <bfoster@redhat.com>
> }
> }
> xfs_inobp_check(mp, bp);
> diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
> index ccf520f..a63f508 100644
> --- a/fs/xfs/xfs_error.c
> +++ b/fs/xfs/xfs_error.c
> @@ -347,27 +347,32 @@ xfs_corruption_error(
> * values, and omit the stack trace unless the error level is tuned high.
> */
> void
> -xfs_verifier_error(
> +xfs_buf_verifier_error(
> struct xfs_buf *bp,
> int error,
> + const char *name,
> + void *buf,
> + size_t bufsz,
> xfs_failaddr_t failaddr)
> {
> struct xfs_mount *mp = bp->b_target->bt_mount;
> xfs_failaddr_t fa;
> + int sz;
>
> fa = failaddr ? failaddr : __return_address;
> __xfs_buf_ioerror(bp, error, fa);
>
> - xfs_alert(mp, "Metadata %s detected at %pS, %s block 0x%llx",
> + xfs_alert(mp, "Metadata %s detected at %pS, %s block 0x%llx %s",
> bp->b_error == -EFSBADCRC ? "CRC error" : "corruption",
> - fa, bp->b_ops->name, bp->b_bn);
> + fa, bp->b_ops->name, bp->b_bn, name);
>
> xfs_alert(mp, "Unmount and run xfs_repair");
>
> if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
> + sz = min_t(size_t, XFS_CORRUPTION_DUMP_LEN, bufsz);
> xfs_alert(mp, "First %d bytes of corrupted metadata buffer:",
> - XFS_CORRUPTION_DUMP_LEN);
> - xfs_hex_dump(xfs_buf_offset(bp, 0), XFS_CORRUPTION_DUMP_LEN);
> + sz);
> + xfs_hex_dump(buf, sz);
> }
>
> if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
> @@ -375,6 +380,20 @@ xfs_verifier_error(
> }
>
> /*
> + * Warnings specifically for verifier errors. Differentiate CRC vs. invalid
> + * values, and omit the stack trace unless the error level is tuned high.
> + */
> +void
> +xfs_verifier_error(
> + struct xfs_buf *bp,
> + int error,
> + xfs_failaddr_t failaddr)
> +{
> + return xfs_buf_verifier_error(bp, error, "", xfs_buf_offset(bp, 0),
> + XFS_CORRUPTION_DUMP_LEN, failaddr);
> +}
> +
> +/*
> * Warnings for inode corruption problems. Don't bother with the stack
> * trace unless the error level is turned up high.
> */
> diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
> index 7e728c5..ce39134 100644
> --- a/fs/xfs/xfs_error.h
> +++ b/fs/xfs/xfs_error.h
> @@ -26,6 +26,9 @@ extern void xfs_error_report(const char *tag, int level, struct xfs_mount *mp,
> extern void xfs_corruption_error(const char *tag, int level,
> struct xfs_mount *mp, void *p, const char *filename,
> int linenum, xfs_failaddr_t failaddr);
> +extern void xfs_buf_verifier_error(struct xfs_buf *bp, int error,
> + const char *name, void *buf, size_t bufsz,
> + xfs_failaddr_t failaddr);
> extern void xfs_verifier_error(struct xfs_buf *bp, int error,
> xfs_failaddr_t failaddr);
> extern void xfs_inode_verifier_error(struct xfs_inode *ip, int error,
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-03-21 13:55 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-15 0:29 [PATCH v2 0/9] xfs-4.17: online scrub fixes Darrick J. Wong
2018-03-15 0:29 ` [PATCH 1/9] xfs: sanity-check the unused space before trying to use it Darrick J. Wong
2018-03-21 13:52 ` Brian Foster
2018-03-21 17:44 ` Darrick J. Wong
2018-03-22 5:59 ` [PATCH v2 " Darrick J. Wong
2018-03-22 14:33 ` Brian Foster
2018-03-22 17:23 ` Darrick J. Wong
2018-03-22 22:04 ` Dave Chinner
2018-03-22 17:53 ` [PATCH v3 " Darrick J. Wong
2018-03-22 22:21 ` [PATCH v4 " Darrick J. Wong
2018-03-23 12:29 ` Brian Foster
2018-03-15 0:29 ` [PATCH 2/9] xfs: refactor bmap record valiation Darrick J. Wong
2018-03-21 13:55 ` Brian Foster
2018-03-21 20:30 ` Darrick J. Wong
2018-03-22 6:01 ` [PATCH v2 " Darrick J. Wong
2018-03-22 14:33 ` Brian Foster
2018-03-15 0:29 ` [PATCH 3/9] xfs: refactor inode verifier error logging Darrick J. Wong
2018-03-21 13:55 ` Brian Foster
2018-03-15 0:29 ` [PATCH 4/9] xfs: refactor inode buffer " Darrick J. Wong
2018-03-21 13:55 ` Brian Foster [this message]
2018-03-21 18:03 ` Darrick J. Wong
2018-04-24 19:51 ` Eric Sandeen
2018-03-15 0:30 ` [PATCH 5/9] xfs: bmap scrubber should do rmap xref with bmap for sparse files Darrick J. Wong
2018-03-21 17:42 ` Brian Foster
2018-03-21 18:11 ` Darrick J. Wong
2018-03-22 6:02 ` [PATCH v2 " Darrick J. Wong
2018-03-22 14:33 ` Brian Foster
2018-03-22 17:35 ` Darrick J. Wong
2018-03-15 0:30 ` [PATCH 6/9] xfs: inode scrubber shouldn't bother with raw checks Darrick J. Wong
2018-03-21 17:42 ` Brian Foster
2018-03-21 20:37 ` Darrick J. Wong
2018-03-15 0:30 ` [PATCH 7/9] xfs: remove xfs_buf parameter from inode scrub methods Darrick J. Wong
2018-03-21 17:42 ` Brian Foster
2018-03-15 0:30 ` [PATCH 8/9] xfs: record inode buf errors as a xref error in inode scrubber Darrick J. Wong
2018-03-21 17:42 ` Brian Foster
2018-03-21 20:50 ` Darrick J. Wong
2018-03-22 14:34 ` Brian Foster
2018-03-22 6:24 ` [PATCH v2 " Darrick J. Wong
2018-03-22 14:34 ` Brian Foster
2018-03-15 0:30 ` [PATCH 9/9] xfs: move inode extent size hint validation to libxfs Darrick J. Wong
2018-03-21 17:42 ` Brian Foster
2018-03-21 3:21 ` [PATCH 10/9] xfs: don't accept inode buffers with suspicious unlinked chains Darrick J. Wong
2018-03-21 17:43 ` Brian Foster
2018-03-21 20:52 ` Darrick J. Wong
2018-03-22 6:08 ` [PATCH v2 " Darrick J. Wong
2018-03-22 14:34 ` Brian Foster
2018-03-21 3:21 ` [PATCH 11/9] xfs: flag inode corruption if parent ptr doesn't get us a real inode Darrick J. Wong
2018-03-22 14:34 ` Brian Foster
2018-03-22 17:49 ` Darrick J. Wong
2018-03-22 17:57 ` [PATCH v2 " Darrick J. Wong
2018-03-23 12:29 ` Brian Foster
2018-03-22 6:19 ` [PATCH 12/9] xfs: xfs_scrub_iallocbt_xref_rmap_inodes should use xref_set_corrupt Darrick J. Wong
2018-03-22 14:34 ` Brian Foster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180321135530.GE11127@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).