]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: report realtime metadata corruption errors to the health system
authorDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:32:44 +0000 (12:32 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:32:44 +0000 (12:32 -0800)
Whenever we encounter corrupt realtime metadat blocks, we should report
that to the health monitoring system for later reporting.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_rtbitmap.c
fs/xfs/xfs_rtalloc.c

index 1f6e05fc359b70c6ebdbeded7f560bc7b77d8c3b..f246d6dbf4eca8f7ac6d89c1928b020efb9dfa47 100644 (file)
@@ -17,6 +17,7 @@
 #include "xfs_rtalloc.h"
 #include "xfs_error.h"
 #include "xfs_rtbitmap.h"
+#include "xfs_health.h"
 
 /*
  * Realtime allocator bitmap functions shared with userspace.
@@ -115,13 +116,19 @@ xfs_rtbuf_get(
        if (error)
                return error;
 
-       if (XFS_IS_CORRUPT(mp, nmap == 0 || !xfs_bmap_is_written_extent(&map)))
+       if (XFS_IS_CORRUPT(mp, nmap == 0 || !xfs_bmap_is_written_extent(&map))) {
+               xfs_rt_mark_sick(mp, issum ? XFS_SICK_RT_SUMMARY :
+                                            XFS_SICK_RT_BITMAP);
                return -EFSCORRUPTED;
+       }
 
        ASSERT(map.br_startblock != NULLFSBLOCK);
        error = xfs_trans_read_buf(mp, args->tp, mp->m_ddev_targp,
                                   XFS_FSB_TO_DADDR(mp, map.br_startblock),
                                   mp->m_bsize, 0, &bp, &xfs_rtbuf_ops);
+       if (xfs_metadata_is_sick(error))
+               xfs_rt_mark_sick(mp, issum ? XFS_SICK_RT_SUMMARY :
+                                            XFS_SICK_RT_BITMAP);
        if (error)
                return error;
 
index b62b5c34413e7a084bc835e24080be9988fbef5e..e66f9bd5de5cff19f851f6b71655dd95f8af1a0d 100644 (file)
@@ -22,6 +22,8 @@
 #include "xfs_sb.h"
 #include "xfs_rtbitmap.h"
 #include "xfs_quota.h"
+#include "xfs_log_priv.h"
+#include "xfs_health.h"
 
 /*
  * Return whether there are any free extents in the size range given
@@ -1202,6 +1204,8 @@ xfs_rtmount_inodes(
 
        sbp = &mp->m_sb;
        error = xfs_iget(mp, NULL, sbp->sb_rbmino, 0, 0, &mp->m_rbmip);
+       if (xfs_metadata_is_sick(error))
+               xfs_rt_mark_sick(mp, XFS_SICK_RT_BITMAP);
        if (error)
                return error;
        ASSERT(mp->m_rbmip != NULL);
@@ -1211,6 +1215,8 @@ xfs_rtmount_inodes(
                goto out_rele_bitmap;
 
        error = xfs_iget(mp, NULL, sbp->sb_rsumino, 0, 0, &mp->m_rsumip);
+       if (xfs_metadata_is_sick(error))
+               xfs_rt_mark_sick(mp, XFS_SICK_RT_SUMMARY);
        if (error)
                goto out_rele_bitmap;
        ASSERT(mp->m_rsumip != NULL);