]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: refactor inode buffer verifier error logging
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 18 Apr 2018 19:46:07 +0000 (14:46 -0500)
committerEric Sandeen <sandeen@redhat.com>
Wed, 18 Apr 2018 19:46:07 +0000 (14:46 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
libxfs/libxfs_priv.h
libxfs/xfs_inode_buf.c

index 9a019b7ef92c049a9dc09650d57f65f5f02c88aa..ab195f5f7b9dab8fd96b699a0811079dea1f20d5 100644 (file)
@@ -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);
index 2c805b342ea269816448011c66c1ba3261674c2d..36554b950dc4df77be002258a642e5cb5467c5f1 100644 (file)
@@ -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);