diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-01-05 17:43:51 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-08-25 22:25:56 -0700 |
commit | 8fb235a2da43d415d754d92b8e2a42b2507c1d1d (patch) | |
tree | 7596535bacf38bc6e979c5d8d8d3f560048f3470 /fs/xfs/xfs_inode.c | |
parent | 2d563f4304078b8e419bedceda06ce9c8aea179e (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 <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 9f478dc885a0..a68ebf2215f7 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -36,6 +36,7 @@ #include "xfs_reflink.h" #include "xfs_ag.h" #include "xfs_health.h" +#include "xfs_health.h" kmem_zone_t *xfs_inode_zone; @@ -1695,6 +1696,33 @@ xfs_inode_needs_inactive( } /* + * 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 @@ -1722,6 +1750,8 @@ xfs_inactive( mp = ip->i_mount; ASSERT(!xfs_iflags_test(ip, XFS_IRECOVERY)); + xfs_inactive_health(ip); + /* If this is a read-only mount, don't do this (would generate I/O) */ if (mp->m_flags & XFS_MOUNT_RDONLY) goto out; |