From: Darrick J. Wong Date: Wed, 18 Apr 2018 19:46:07 +0000 (-0500) Subject: xfs: refactor inode buffer verifier error logging X-Git-Tag: v4.17.0-rc1~44^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43f7ceb50b3024bba6edcd951ec9e14575e71c30;p=thirdparty%2Fxfsprogs-dev.git xfs: refactor inode buffer verifier error logging Source kernel commit: 6edb181053f067cee64d4239830062cb40ddab00 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 Reviewed-by: Brian Foster Signed-off-by: Eric Sandeen --- diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index 9a019b7ef..ab195f5f7 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -540,6 +540,9 @@ void xfs_inode_verifier_error(struct xfs_inode *ip, int error, const char *name, void *buf, size_t bufsz, xfs_failaddr_t failaddr); +#define xfs_buf_verifier_error(bp,e,n,bu,bus,fa) \ + xfs_verifier_error(bp, e, fa) + /* XXX: this is clearly a bug - a shared header needs to export this */ /* xfs_rtalloc.c */ int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t); diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index 2c805b342..36554b950 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -111,13 +111,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); } } xfs_inobp_check(mp, bp);