[PATCH 11/18] gfs2: drain ail under sd_log_flush_lock

Andreas Gruenbacher <[email protected]> Mon, 13 Apr 2026 16:52:04 +0200
Newsgroups dev.linux.lists.gfs2
Message-ID <[email protected]>
When a withdraw is carried out, call gfs2_ail_drain() under the
sdp->sd_log_flush_lock.  This isn't strictly necessary but should be easier to
read, and more robust against possible future bugs.

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

diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 02603200846d..83b8bb6446e5 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -123,9 +123,8 @@ static void do_withdraw(struct gfs2_sbd *sdp)
 		return;
 	}
 	clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
-	up_write(&sdp->sd_log_flush_lock);
-
 	gfs2_ail_drain(sdp); /* frees all transactions */
+	up_write(&sdp->sd_log_flush_lock);
 
 	wake_up(&sdp->sd_logd_waitq);
 	wake_up(&sdp->sd_quota_wait);
-- 
2.53.0