]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: add xfs_verifier_error()
authorDave Chinner <dchinner@redhat.com>
Thu, 6 Mar 2014 23:25:55 +0000 (10:25 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 6 Mar 2014 23:25:55 +0000 (10:25 +1100)
[userspace port]

We want to distinguish between corruption, CRC errors,
etc.  In addition, the full stack trace on verifier errors
seems less than helpful; it looks more like an oops than
corruption.

Create a new function to specifically alert the user to
verifier errors, which can differentiate between
EFSCORRUPTED and CRC mismatches.  It doesn't dump stack
unless the xfs error level is turned up high.

Define a new error message (EFSBADCRC) to clearly identify
CRC errors.  (Defined to EBADMSG, bad message)

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
include/darwin.h
include/freebsd.h
include/gnukfreebsd.h
include/irix.h
include/linux.h
libxfs/util.c
libxfs/xfs.h

index 97b8990d24df093e8cc77686e240a8737698235b..95f865b7d0ee0491f9e62992e42aa7e3d601382d 100644 (file)
@@ -150,6 +150,7 @@ typedef unsigned char       uchar_t;
 
 #define ENOATTR                989     /* Attribute not found */
 #define EFSCORRUPTED   990     /* Filesystem is corrupted */
+#define EFSBADCRC      991     /* Bad CRC detected */
 #define constpp                char * const *
 
 #define HAVE_FID       1
index 2e1ae4984ad8262fd2d25ec2c73fdc218a08174f..b51688b5e4ee7bdaf301cc16bf22109917d22c87 100644 (file)
@@ -45,6 +45,7 @@
 #define constpp        char * const *
 
 #define EFSCORRUPTED   990     /* Filesystem is corrupted */
+#define EFSBADCRC      991     /* Bad CRC detected */
 
 typedef off_t          xfs_off_t;
 typedef off_t          off64_t;
index 1ec291fdf162b9aed3456694f4ddeee1c720dded..2140acd4e3e343978057fb952ff46cfbd24bc659 100644 (file)
@@ -36,6 +36,7 @@
 #define constpp        char * const *
 
 #define EFSCORRUPTED   990     /* Filesystem is corrupted */
+#define EFSBADCRC      991     /* Bad CRC detected */
 
 typedef off_t          xfs_off_t;
 typedef __uint64_t     xfs_ino_t;
index a450684eca4d1dcb926709e225e41c05d2607c54..5040451892832f64d15dfe521560451a42d8cbee 100644 (file)
@@ -52,6 +52,8 @@ typedef char*         xfs_caddr_t;
 #define xfs_flock64    flock64
 #define xfs_flock64_t  struct flock64
 
+#define EFSBADCRC      991     /* Bad CRC detected */
+
 typedef struct xfs_error_injection {
        __int32_t       fd;
        __int32_t       errtag;
index 502fd1f819ccff6d45616d6bdd03319b1aef7b60..55862905a870ddef886731a152a82e884ef9865d 100644 (file)
@@ -136,6 +136,7 @@ platform_discard_blocks(int fd, uint64_t start, uint64_t len)
 
 #define ENOATTR                ENODATA /* Attribute not found */
 #define EFSCORRUPTED   EUCLEAN /* Filesystem is corrupted */
+#define EFSBADCRC      EBADMSG /* Bad CRC detected */
 
 typedef loff_t         xfs_off_t;
 typedef __uint64_t     xfs_ino_t;
index 8109ab3b7d183b93933b9403a3c80a348be77b65..1b0554067f23b1973c6e7ddef74d082d3096b6de 100644 (file)
@@ -730,3 +730,16 @@ cmn_err(int level, char *fmt, ...)
        fputs("\n", stderr);
        va_end(ap);
 }
+
+/*
+ * 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)
+{
+       xfs_alert(NULL, "Metadata %s detected at block 0x%llx/0x%x",
+                 bp->b_error == EFSBADCRC ? "CRC error" : "corruption",
+                 bp->b_bn, BBTOB(bp->b_length));
+}
index 364fd83e6de764e2e9edb6b6b6ccd031282e6fa5..5a21590b139f2afd95d7aa22d1bd6af98465423b 100644 (file)
@@ -449,3 +449,4 @@ int  xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int64_t, int);
 void xfs_trans_mod_sb(xfs_trans_t *, uint, long);
 void xfs_trans_init(struct xfs_mount *);
 int  xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
+void xfs_verifier_error(struct xfs_buf *bp);