From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: linux-xfs@vger.kernel.org, david@fromorbit.com, bfoster@redhat.com
Subject: [PATCH 3/3] xfs: don't let background reclaim forget sick inodes
Date: Wed, 02 Jun 2021 20:12:52 -0700 [thread overview]
Message-ID: <162268997239.2724138.6026093150916734925.stgit@locust> (raw)
In-Reply-To: <162268995567.2724138.15163777746481739089.stgit@locust>
From: Darrick J. Wong <djwong@kernel.org>
It's important that the filesystem retain its memory of sick inodes for
a little while after problems are found so that reports can be collected
about what was wrong. Don't let background inode reclamation free sick
inodes unless we're under memory pressure.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/xfs_icache.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 0e2b6c05e604..54285d1ad574 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -911,7 +911,8 @@ xfs_dqrele_all_inodes(
*/
static bool
xfs_reclaim_igrab(
- struct xfs_inode *ip)
+ struct xfs_inode *ip,
+ struct xfs_eofblocks *eofb)
{
ASSERT(rcu_read_lock_held());
@@ -922,6 +923,17 @@ xfs_reclaim_igrab(
spin_unlock(&ip->i_flags_lock);
return false;
}
+
+ /*
+ * Don't reclaim a sick inode unless we're under memory pressure or the
+ * filesystem is unmounting.
+ */
+ if (ip->i_sick && eofb == NULL &&
+ !(ip->i_mount->m_flags & XFS_MOUNT_UNMOUNTING)) {
+ spin_unlock(&ip->i_flags_lock);
+ return false;
+ }
+
__xfs_iflags_set(ip, XFS_IRECLAIM);
spin_unlock(&ip->i_flags_lock);
return true;
@@ -1606,7 +1618,8 @@ xfs_blockgc_free_quota(
static inline bool
xfs_icwalk_igrab(
enum xfs_icwalk_goal goal,
- struct xfs_inode *ip)
+ struct xfs_inode *ip,
+ struct xfs_eofblocks *eofb)
{
switch (goal) {
case XFS_ICWALK_DQRELE:
@@ -1614,7 +1627,7 @@ xfs_icwalk_igrab(
case XFS_ICWALK_BLOCKGC:
return xfs_blockgc_igrab(ip);
case XFS_ICWALK_RECLAIM:
- return xfs_reclaim_igrab(ip);
+ return xfs_reclaim_igrab(ip, eofb);
default:
return false;
}
@@ -1703,7 +1716,7 @@ xfs_icwalk_ag(
for (i = 0; i < nr_found; i++) {
struct xfs_inode *ip = batch[i];
- if (done || !xfs_icwalk_igrab(goal, ip))
+ if (done || !xfs_icwalk_igrab(goal, ip, eofb))
batch[i] = NULL;
/*
next prev parent reply other threads:[~2021-06-03 3:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-03 3:12 [PATCHSET v2 0/3] xfs: preserve inode health reports for longer Darrick J. Wong
2021-06-03 3:12 ` [PATCH 1/3] xfs: only reset incore inode health state flags when reclaiming an inode Darrick J. Wong
2021-06-03 4:21 ` Dave Chinner
2021-06-03 20:41 ` Darrick J. Wong
2021-06-03 12:22 ` Brian Foster
2021-06-03 20:41 ` Darrick J. Wong
2021-06-03 3:12 ` [PATCH 2/3] xfs: drop IDONTCACHE on inodes when we mark them sick Darrick J. Wong
2021-06-03 4:34 ` Dave Chinner
2021-06-03 20:49 ` Darrick J. Wong
2021-06-03 12:23 ` Brian Foster
2021-06-03 20:48 ` Darrick J. Wong
2021-06-03 3:12 ` Darrick J. Wong [this message]
2021-06-03 4:42 ` [PATCH 3/3] xfs: don't let background reclaim forget sick inodes Dave Chinner
2021-06-03 12:31 ` Brian Foster
2021-06-03 21:30 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=162268997239.2724138.6026093150916734925.stgit@locust \
--to=djwong@kernel.org \
--cc=bfoster@redhat.com \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox