Skip to content

Commit

Permalink
gfs2: bypass log flush if the journal is not live
Browse files Browse the repository at this point in the history
Patch fe3e397 ("gfs2: Rework the log space allocation logic")
changed gfs2_log_flush to reserve a set of journal blocks in case no
transaction is active.  However, gfs2_log_flush also gets called in
cases where we don't have an active journal, for example, for spectator
mounts.  In that case, trying to reserve blocks would sleep forever, but
we want gfs2_log_flush to be a no-op instead.

Fixes: fe3e397 ("gfs2: Rework the log space allocation logic")
Signed-off-by: Bob Peterson <[email protected]>
Signed-off-by: Andreas Gruenbacher <[email protected]>
  • Loading branch information
AstralBob authored and Andreas Gruenbacher committed Mar 12, 2021
1 parent d5bf630 commit 0efc497
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/gfs2/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 0efc497

Please sign in to comment.