]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xfs: report corruption only as a regular error
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 12 Apr 2023 04:26:20 +0000 (09:56 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:07:38 +0000 (12:07 +0200)
commit 4e8cf637ae11b548afdd216422ce457ceaeeea3c uptream.

[ Slightly modify fs/xfs/xfs_linux.h to resolve merge conflicts ]

Redefine XFS_IS_CORRUPT so that it reports corruptions only via
xfs_corruption_report.  Since these are on-disk contents (and not checks
of internal state), we don't ever want to panic the kernel.  This also
amends the corruption report to recommend unmounting and running
xfs_repair.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_error.c
fs/xfs/xfs_linux.h

index e9acd58248f90576c003ed9d6d54de69bb590200..182b70464b71ad962e303842d013ec8a90d23538 100644 (file)
@@ -335,7 +335,7 @@ xfs_corruption_error(
        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");
index f4f52ac5628c79fc440e9bf274b8bedf8c75faaf..4f6f09157f0d99f7c7eccbc50ae267f8b20bbab4 100644 (file)
@@ -217,6 +217,12 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count,
 #endif /* XFS_WARN */
 #endif /* DEBUG */
 
+#define XFS_IS_CORRUPT(mp, expr)       \
+       (unlikely(expr) ? xfs_corruption_error(#expr, XFS_ERRLEVEL_LOW, (mp), \
+                                              NULL, 0, __FILE__, __LINE__, \
+                                              __this_address), \
+                         true : false)
+
 #define STATIC static noinline
 
 #ifdef CONFIG_XFS_RT