]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: report realtime metadata corruption errors to the health system
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 17:00:55 +0000 (10:00 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:36 +0000 (11:37 -0700)
Source kernel commit: 8368ad49aaf771a6283840140149440b958b20fb

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>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
libxfs/util.c
libxfs/xfs_rtbitmap.c

index 6d8847363433ef6818a8c57b8376a8a5b5aecc86..841f4b963f18d4bc958c3c2345fd8985757d5f72 100644 (file)
@@ -737,3 +737,4 @@ void xfs_btree_mark_sick(struct xfs_btree_cur *cur) { }
 void xfs_dirattr_mark_sick(struct xfs_inode *ip, int whichfork) { }
 void xfs_da_mark_sick(struct xfs_da_args *args) { }
 void xfs_inode_mark_sick(struct xfs_inode *ip, unsigned int mask) { }
+void xfs_rt_mark_sick(struct xfs_mount *mp, unsigned int mask) { }
index 146e06bd880aa21d4d6add1bb9d4e1457d27ba39..543cfd2fb9c54d3772397656555d81a355af57a6 100644 (file)
@@ -15,6 +15,7 @@
 #include "xfs_bmap.h"
 #include "xfs_trans.h"
 #include "xfs_rtbitmap.h"
+#include "xfs_health.h"
 
 /*
  * Realtime allocator bitmap functions shared with userspace.
@@ -113,13 +114,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;