diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 115c4ac457e9..7bba7951dbdb 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -1169,11 +1169,13 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) * never queued onto any of the ail lists. Here we add it to * ail1 just so that ail_drain() will find and free it. */ - spin_lock(&sdp->sd_ail_lock); - if (tr && list_empty(&tr->tr_list)) - list_add(&tr->tr_list, &sdp->sd_ail1_list); - spin_unlock(&sdp->sd_ail_lock); - tr = NULL; + if (gfs2_withdrawing(sdp)) { + spin_lock(&sdp->sd_ail_lock); + if (tr && list_empty(&tr->tr_list)) + list_add(&tr->tr_list, &sdp->sd_ail1_list); + spin_unlock(&sdp->sd_ail_lock); + tr = NULL; + } goto out_end; }