]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/xfs/xfs_error.c
Merge tag '5.6-rc-smb3-plugfest-patches' of git://git.samba.org/sfrench/cifs-2.6
[linux.git] / fs / xfs / xfs_error.c
index 849fd4476950af0cbe1086ab3bafdb860bc2c39e..331765afc53e427011c08fd4d9188447e9ded01d 100644 (file)
@@ -257,7 +257,7 @@ xfs_errortag_test(
 
        xfs_warn_ratelimited(mp,
 "Injecting error (%s) at file %s, line %d, on filesystem \"%s\"",
-                       expression, file, line, mp->m_fsname);
+                       expression, file, line, mp->m_super->s_id);
        return true;
 }
 
@@ -329,18 +329,39 @@ xfs_corruption_error(
        const char              *tag,
        int                     level,
        struct xfs_mount        *mp,
-       void                    *buf,
+       const void              *buf,
        size_t                  bufsize,
        const char              *filename,
        int                     linenum,
        xfs_failaddr_t          failaddr)
 {
-       if (level <= xfs_error_level)
+       if (buf && level <= xfs_error_level)
                xfs_hex_dump(buf, bufsize);
        xfs_error_report(tag, level, mp, filename, linenum, failaddr);
        xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
 }
 
+/*
+ * Complain about the kinds of metadata corruption that we can't detect from a
+ * verifier, such as incorrect inter-block relationship data.  Does not set
+ * bp->b_error.
+ */
+void
+xfs_buf_corruption_error(
+       struct xfs_buf          *bp)
+{
+       struct xfs_mount        *mp = bp->b_mount;
+
+       xfs_alert_tag(mp, XFS_PTAG_VERIFIER_ERROR,
+                 "Metadata corruption detected at %pS, %s block 0x%llx",
+                 __return_address, bp->b_ops->name, bp->b_bn);
+
+       xfs_alert(mp, "Unmount and run xfs_repair");
+
+       if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
+               xfs_stack_trace();
+}
+
 /*
  * Warnings specifically for verifier errors.  Differentiate CRC vs. invalid
  * values, and omit the stack trace unless the error level is tuned high.
@@ -350,7 +371,7 @@ xfs_buf_verifier_error(
        struct xfs_buf          *bp,
        int                     error,
        const char              *name,
-       void                    *buf,
+       const void              *buf,
        size_t                  bufsz,
        xfs_failaddr_t          failaddr)
 {
@@ -402,7 +423,7 @@ xfs_inode_verifier_error(
        struct xfs_inode        *ip,
        int                     error,
        const char              *name,
-       void                    *buf,
+       const void              *buf,
        size_t                  bufsz,
        xfs_failaddr_t          failaddr)
 {