gfs2: initialize transaction tr_ailX_lists earlier
authorBob Peterson <rpeterso@redhat.com>
Fri, 5 Jun 2020 19:12:34 +0000 (14:12 -0500)
committerAndreas Gruenbacher <agruenba@redhat.com>
Fri, 5 Jun 2020 19:24:25 +0000 (21:24 +0200)
Since transactions may be freed shortly after they're created, before
a log_flush occurs, we need to initialize their ail1 and ail2 lists
earlier. Before this patch, the ail1 list was initialized in gfs2_log_flush().
This moves the initialization to the point when the transaction is first
created.

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

index 4862dae..224fb3b 100644 (file)
@@ -91,6 +91,8 @@ static int gfs2_ail_empty_gl(struct gfs2_glock *gl)
        memset(&tr, 0, sizeof(tr));
        INIT_LIST_HEAD(&tr.tr_buf);
        INIT_LIST_HEAD(&tr.tr_databuf);
+       INIT_LIST_HEAD(&tr.tr_ail1_list);
+       INIT_LIST_HEAD(&tr.tr_ail2_list);
        tr.tr_revokes = atomic_read(&gl->gl_ail_count);
 
        if (!tr.tr_revokes) {
index fcc7f58..a81af1b 100644 (file)
@@ -933,8 +933,6 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
        tr = sdp->sd_log_tr;
        if (tr) {
                sdp->sd_log_tr = NULL;
-               INIT_LIST_HEAD(&tr->tr_ail1_list);
-               INIT_LIST_HEAD(&tr->tr_ail2_list);
                tr->tr_first = sdp->sd_log_flush_head;
                if (unlikely (state == SFS_FROZEN))
                        if (gfs2_assert_withdraw_delayed(sdp,
index ffe8405..62a65ed 100644 (file)
@@ -52,6 +52,8 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
                tr->tr_reserved += gfs2_struct2blk(sdp, revokes);
        INIT_LIST_HEAD(&tr->tr_databuf);
        INIT_LIST_HEAD(&tr->tr_buf);
+       INIT_LIST_HEAD(&tr->tr_ail1_list);
+       INIT_LIST_HEAD(&tr->tr_ail2_list);
 
        sb_start_intwrite(sdp->sd_vfs);