Skip to contentSkip to conversation

gfs2: Bypass log flush if the journal is not live

PATCH New Bob Peterson 1 participant 1 message Mar 12, 2021 1 message not in the archive GFS2 file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 gfs2: Bypass log flush if the journal is not live

Patch fe3e397668775 ("gfs2: Rework the log space allocation logic") changed the log flush logic such that it reserves a set of journal blocks for cases in which log_flush has no active transaction but still needs blocks for revokes. However, these blocks were still requested even if the journal is not active, for example, for spectator mounts. In fact, the log_flush should be bypassed entirely in these cases. This patch adds a check to gfs2_log_flush so the function is bypassed if the journal is not active.

Fixes fe3e397668775 ("gfs2: Rework the log space allocation logic")
---
 fs/gfs2/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/log.c +1 -1
index 760af666576c..6410281546f9 100644
@@ -1036,7 +1036,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
 	 * Do this check while holding the log_flush_lock to prevent new
 	 * buffers from being added to the ail via gfs2_pin()
 	 */
-	if (gfs2_withdrawn(sdp))
+	if (gfs2_withdrawn(sdp) || !test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
 		goto out;
 
 	/* Log might have been flushed while we waited for the flush lock */