Skip to contentSkip to conversation

gfs2: initialize tr_ail1_list when creating transactions

PATCH New Bob Peterson 2 participants 3 messages Nov 14, 2019 – Nov 15, 2019 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2: initialize tr_ail1_list when creating transactions

Hi,

In function gfs2_trans_begin, new transactions were created but their ail1 list, tr_ail1_list was never initialized. Therefore it relied upon other circumstances when the list became empty.
This patch adds proper initialization of the list.

---
 fs/gfs2/trans.c | 1 +
 1 file changed, 1 insertion(+)
fs/gfs2/trans.c +1 -0
index 9d4227330de4..d0efa322f940 100644
@@ -53,6 +53,7 @@ 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);
 
 	sb_start_intwrite(sdp->sd_vfs);
 
#1 lore raw

PATCH 1/1 gfs2: initialize tr_ail1_list when creating transactions

Quoted 4 lines · Bob Peterson

In function gfs2_trans_begin, new transactions were created but their ail1 list, tr_ail1_list was never initialized. Therefore it relied upon other circumstances when the list became empty.
This patch adds proper initialization of the list.

Could you please give a better explanation for this change?

Quoted 11 lines
---
 fs/gfs2/trans.c | 1 +
 1 file changed, 1 insertion(+)
fs/gfs2/trans.c +0 -0
index 9d4227330de4..d0efa322f940 100644

fs/gfs2/trans.c int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, · line 59

Quoted 7 lines
fs/gfs2/trans.c +1 -0
@@ -53,6 +53,7 @@ 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);
 
        sb_start_intwrite(sdp->sd_vfs);
 

What code path accesses tr_ail1_list before it is initialized in gfs2_log_flush? Should the INIT_LIST_HEAD(&tr->tr_ail1_list) in gfs2_log_flush consequently be removed?

Thanks,
Andreas

#2 lore raw

PATCH 1/1 gfs2: initialize tr_ail1_list when creating transactions

----- Original Message -----

Quoted 7 lines · Bob Peterson
Quoted 4 lines

In function gfs2_trans_begin, new transactions were created but their ail1 list, tr_ail1_list was never initialized. Therefore it relied upon other circumstances when the list became empty.
This patch adds proper initialization of the list.

Could you please give a better explanation for this change?

Let's drop it for now. I'll reevaluate if it's still needed.

Bob