Thread (47 messages) 47 messages, 2 authors, 2021-08-04
STALE1789d

[PATCH] xfs: don't run inodegc flushes when inodegc is not active

From: Dave Chinner <david@fromorbit.com>
Date: 2021-08-04 10:46:42
Subsystem: filesystems (vfs and infrastructure), the rest, xfs filesystem · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds, Carlos Maiolino

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>
---
 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);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help