[PATCH 16/18] gfs2: wait for withdraw earlier during unmount

Andreas Gruenbacher <[email protected]> Mon, 13 Apr 2026 16:52:09 +0200
Newsgroups dev.linux.lists.gfs2
Message-ID <[email protected]>
During an unmount, wait for potential withdraw to complete before calling
gfs2_make_fs_ro().  This will allow gfs2_make_fs_ro() to skip much of its work.

Signed-off-by: Andreas Gruenbacher <[email protected]>
---
 fs/gfs2/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 83b5bab56377..b0b0bc5c9d20 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -596,6 +596,9 @@ static void gfs2_put_super(struct super_block *sb)
 	}
 	spin_unlock(&sdp->sd_jindex_spin);
 
+	/* Wait for withdraw to complete */
+	flush_work(&sdp->sd_withdraw_work);
+
 	if (!sb_rdonly(sb))
 		gfs2_make_fs_ro(sdp);
 	else {
@@ -605,8 +608,6 @@ static void gfs2_put_super(struct super_block *sb)
 		gfs2_quota_cleanup(sdp);
 	}
 
-	flush_work(&sdp->sd_withdraw_work);
-
 	/*  At this point, we're through modifying the disk  */
 
 	/*  Release stuff  */
-- 
2.53.0