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")
Signed-off-by: Bob Peterson <rpete...@redhat.com>
---
 fs/gfs2/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 760af666576c..6410281546f9 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -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 */

Reply via email to