Skip to content

Commit

Permalink
xfs: drop IDONTCACHE on inodes when we mark them sick
Browse files Browse the repository at this point in the history
When we decide to mark an inode sick, clear the DONTCACHE flag so that
the incore inode will be kept around until memory pressure forces it out
of memory.  This increases the chances that the sick status will be
caught by someone compiling a health report later on.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
  • Loading branch information
Darrick J. Wong committed Jun 8, 2021
1 parent 255794c commit 7975e46
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fs/xfs/xfs_health.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ xfs_inode_mark_sick(
ip->i_sick |= mask;
ip->i_checked |= mask;
spin_unlock(&ip->i_flags_lock);

/*
* Keep this inode around so we don't lose the sickness report. Scrub
* grabs inodes with DONTCACHE assuming that most inode are ok, which
* is not the case here.
*/
spin_lock(&VFS_I(ip)->i_lock);
VFS_I(ip)->i_state &= ~I_DONTCACHE;
spin_unlock(&VFS_I(ip)->i_lock);
}

/* Mark parts of an inode healed. */
Expand Down

0 comments on commit 7975e46

Please sign in to comment.