summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_health.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-02-22 23:32:18 +0300
committerDarrick J. Wong <djwong@kernel.org>2024-02-22 23:32:18 +0300
commitca14c0968c1f693ab4bcb5368c800c33e7a2ad7e (patch)
treef7d5afbf2de3956a8b17939837538a3288314842 /fs/xfs/xfs_health.c
parenta78d10f45b23149f1b23019a4f4fb57dcf852e39 (diff)
downloadlinux-ca14c0968c1f693ab4bcb5368c800c33e7a2ad7e.tar.xz
xfs: report dir/attr block corruption errors to the health system
Whenever we encounter corrupt directory or extended attribute 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>
Diffstat (limited to 'fs/xfs/xfs_health.c')
-rw-r--r--fs/xfs/xfs_health.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c
index e9338c05ea23..568300ae8555 100644
--- a/fs/xfs/xfs_health.c
+++ b/fs/xfs/xfs_health.c
@@ -15,6 +15,8 @@
#include "xfs_health.h"
#include "xfs_ag.h"
#include "xfs_btree.h"
+#include "xfs_da_format.h"
+#include "xfs_da_btree.h"
/*
* Warn about metadata corruption that we detected but haven't fixed, and
@@ -545,3 +547,40 @@ xfs_btree_mark_sick(
xfs_ag_mark_sick(cur->bc_ag.pag, mask);
}
+
+/*
+ * Record observations of dir/attr btree corruption with the health tracking
+ * system.
+ */
+void
+xfs_dirattr_mark_sick(
+ struct xfs_inode *ip,
+ int whichfork)
+{
+ unsigned int mask;
+
+ switch (whichfork) {
+ case XFS_DATA_FORK:
+ mask = XFS_SICK_INO_DIR;
+ break;
+ case XFS_ATTR_FORK:
+ mask = XFS_SICK_INO_XATTR;
+ break;
+ default:
+ ASSERT(0);
+ return;
+ }
+
+ xfs_inode_mark_sick(ip, mask);
+}
+
+/*
+ * Record observations of dir/attr btree corruption with the health tracking
+ * system.
+ */
+void
+xfs_da_mark_sick(
+ struct xfs_da_args *args)
+{
+ xfs_dirattr_mark_sick(args->dp, args->whichfork);
+}