From: Darrick J. Wong Date: Mon, 7 Jun 2021 16:34:50 +0000 (-0700) Subject: xfs: drop IDONTCACHE on inodes when we mark them sick X-Git-Tag: v5.14-rc1~97^2~30^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7975e465af6b46e9d0eaf94f764922dc92b28d9c;p=thirdparty%2Fkernel%2Flinux.git xfs: drop IDONTCACHE on inodes when we mark them sick 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 Reviewed-by: Dave Chinner Reviewed-by: Carlos Maiolino --- diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c index 5de3195f6cb25..eb10eacabc8fd 100644 --- a/fs/xfs/xfs_health.c +++ b/fs/xfs/xfs_health.c @@ -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. */