Re: [PATCH] xfs: don't run inodegc flushes when inodegc is not active
From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2021-08-04 16:20:56
On Wed, Aug 04, 2021 at 08:46:16PM +1000, Dave Chinner wrote:
From: Dave Chinner <redacted> A flush trigger on a frozen filesystem (e.g. from statfs) will run queued inactivations and assert fail like this: XFS: Assertion failed: mp->m_super->s_writers.frozen < SB_FREEZE_FS, file: fs/xfs/xfs_icache.c, line: 1861 Bug exposed by xfs/011. Signed-off-by: Dave Chinner <redacted>
Odd that I didn't see any of these problems in my overnight tests, but the reasoning looks solid. Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D
quoted hunk ↗ jump to hunk
--- fs/xfs/xfs_icache.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 92006260fe90..f772f2a67a8b 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c@@ -1893,8 +1893,8 @@ xfs_inodegc_worker( * wait for the work to finish. Two pass - queue all the work first pass, wait * for it in a second pass. */ -void -xfs_inodegc_flush( +static void +__xfs_inodegc_flush( struct xfs_mount *mp) { struct xfs_inodegc *gc;@@ -1913,6 +1913,14 @@ xfs_inodegc_flush( } } +void +xfs_inodegc_flush( + struct xfs_mount *mp) +{ + if (xfs_is_inodegc_enabled(mp)) + __xfs_inodegc_flush(mp); +} + /* * Flush all the pending work and then disable the inode inactivation background * workers and wait for them to stop.@@ -1927,7 +1935,7 @@ xfs_inodegc_stop( if (!xfs_clear_inodegc_enabled(mp)) return; - xfs_inodegc_flush(mp); + __xfs_inodegc_flush(mp); for_each_online_cpu(cpu) { gc = per_cpu_ptr(mp->m_inodegc, cpu);