summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-02-19 17:02:14 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-06-01 21:16:37 -0700
commit2a591297418b6f499acf322b537c5b27a3fe2298 (patch)
tree6585bf852a786a78b039e1d06f20aea39667225a /fs/xfs/xfs_inode.c
parent20b0990e84ba16c1191c747546ce2cbd8caa15b6 (diff)
xfs: remember sick inodes that get inactivated
If an unhealthy inode gets inactivated, remember this fact in the per-fs health summary. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 5ff02c57953f..40624bc09663 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -38,6 +38,7 @@
#include "xfs_health.h"
#include "xfs_dquot_item.h"
#include "xfs_dquot.h"
+#include "xfs_health.h"
kmem_zone_t *xfs_inode_zone;
@@ -1965,6 +1966,33 @@ xfs_inode_needs_inactivation(
}
/*
+ * Save health status somewhere, if we're dumping an inode with uncorrected
+ * errors and online repair isn't running.
+ */
+static inline void
+xfs_inactive_health(
+ struct xfs_inode *ip)
+{
+ struct xfs_mount *mp = ip->i_mount;
+ struct xfs_perag *pag;
+ unsigned int sick;
+ unsigned int checked;
+
+ xfs_inode_measure_sickness(ip, &sick, &checked);
+ if (!sick)
+ return;
+
+ trace_xfs_inode_unfixed_corruption(ip, sick);
+
+ if (sick & XFS_SICK_INO_FORGET)
+ return;
+
+ pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
+ xfs_ag_mark_sick(pag, XFS_SICK_AG_INODES);
+ xfs_perag_put(pag);
+}
+
+/*
* xfs_inactive
*
* This is called when the vnode reference count for the vnode
@@ -1996,6 +2024,8 @@ xfs_inactive(
if (mp->m_flags & XFS_MOUNT_RDONLY)
return;
+ xfs_inactive_health(ip);
+
/*
* Re-attach dquots prior to freeing EOF blocks or CoW staging extents.
* We dropped the dquot prior to inactivation (because quotaoff can't