gfs2: Use sb_start_intwrite in gfs2_ail_empty_gl
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 3 Feb 2021 15:15:27 +0000 (16:15 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 3 Feb 2021 15:33:16 +0000 (16:33 +0100)
Commit 2e60d7683c8d ("GFS2: update freeze code to use freeze/thaw_super
on all nodes") optimized away the sb_start_intwrite ... sb_end_intwrite
protection for the on-stack transactions in gfs2_ail_empty_gl with no
explanation.  I can't think of a valid reason for doing that, so revert
that change.  This simplifies the next commit.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glops.c
fs/gfs2/trans.c

index 3faa421..fd1f52f 100644 (file)
@@ -127,9 +127,12 @@ static int gfs2_ail_empty_gl(struct gfs2_glock *gl)
          * on the stack */
        tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes);
        tr.tr_ip = _RET_IP_;
+       sb_start_intwrite(sdp->sd_vfs);
        ret = gfs2_log_reserve(sdp, tr.tr_reserved);
-       if (ret < 0)
+       if (ret < 0) {
+               sb_end_intwrite(sdp->sd_vfs);
                return ret;
+       }
        WARN_ON_ONCE(current->journal_info);
        current->journal_info = &tr;
 
index 7705f04..ae040b5 100644 (file)
@@ -98,10 +98,9 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
 
        if (!test_bit(TR_TOUCHED, &tr->tr_flags)) {
                gfs2_log_release(sdp, tr->tr_reserved);
-               if (alloced) {
+               if (alloced)
                        gfs2_trans_free(sdp, tr);
-                       sb_end_intwrite(sdp->sd_vfs);
-               }
+               sb_end_intwrite(sdp->sd_vfs);
                return;
        }
 
@@ -121,8 +120,7 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
        if (sdp->sd_vfs->s_flags & SB_SYNCHRONOUS)
                gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_NORMAL |
                               GFS2_LFC_TRANS_END);
-       if (alloced)
-               sb_end_intwrite(sdp->sd_vfs);
+       sb_end_intwrite(sdp->sd_vfs);
 }
 
 static struct gfs2_bufdata *gfs2_alloc_bufdata(struct gfs2_glock *gl,