]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
gfs2: initialize transaction tr_ailX_lists earlier
authorBob Peterson <rpeterso@redhat.com>
Fri, 5 Jun 2020 19:12:34 +0000 (14:12 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Sep 2020 08:46:33 +0000 (10:46 +0200)
commit cbcc89b630447ec7836aa2b9242d9bb1725f5a61 upstream.

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>
Cc: Salvatore Bonaccorso <carnil@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/glops.c
fs/gfs2/log.c
fs/gfs2/trans.c

index cdd1c5f06f452f70d6704c86ed87d4548ab7d315..f1844af4005b646415e0640ea62f32b704c2a3b7 100644 (file)
@@ -89,6 +89,8 @@ static void 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 f30418911e1bde09eca0b1bc68f38d0b887b51cf..b05c0ed36b6fe77ca9b40a0807c737d16378c6eb 100644 (file)
@@ -734,8 +734,6 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl,
        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))
                        gfs2_assert_withdraw(sdp, !tr->tr_num_buf_new && !tr->tr_num_databuf_new);
index 69e3402a3cc590d72419395831076ff02cb5935e..3a9abc3aac82c95a80ebbb79b5e0dfecf48ab341 100644 (file)
@@ -56,6 +56,8 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
                                                   sizeof(u64));
        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);