Skip to contentSkip to conversation

gfs2: clear buf_in_tr when ending a transaction in sweep_bh_for_rgrps

PATCH New Bob Peterson 2 participants 2 messages Sep 12, 2019 – Sep 17, 2019 1 message not in the archive GFS2 file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 gfs2: clear buf_in_tr when ending a transaction in sweep_bh_for_rgrps

Hi,

In function sweep_bh_for_rgrps, which is a helper for punch_hole, it uses variable buf_in_tr to keep track of when it needs to commit pending block frees on a partial delete that overflows the transaction created for the delete. The problem is that the variable was initialized at the start of function sweep_bh_for_rgrps but it was never cleared, even when starting a new transaction.

This patch reinitializes the variable when the transaction is ended, so the next transaction starts out with it cleared.

---
 fs/gfs2/bmap.c | 1 +
 1 file changed, 1 insertion(+)
fs/gfs2/bmap.c +1 -0
index 9ef543dd38e2..f63df54a08c6 100644
@@ -1632,6 +1632,7 @@ static int sweep_bh_for_rgrps(struct gfs2_inode *ip, struct gfs2_holder *rd_gh,
 			brelse(dibh);
 			up_write(&ip->i_rw_mutex);
 			gfs2_trans_end(sdp);
+			buf_in_tr = false;
 		}
 		gfs2_glock_dq_uninit(rd_gh);
 		cond_resched();
#2 lore raw

PATCH 1/1 gfs2: clear buf_in_tr when ending a transaction in sweep_bh_for_rgrps

Quoted 9 lines · Bob Peterson

Hi,

In function sweep_bh_for_rgrps, which is a helper for punch_hole, it uses variable buf_in_tr to keep track of when it needs to commit pending block frees on a partial delete that overflows the transaction created for the delete. The problem is that the variable was initialized at the start of function sweep_bh_for_rgrps but it was never cleared, even when starting a new transaction.

Quoted 4 lines

This patch reinitializes the variable when the transaction is ended, so the next transaction starts out with it cleared.

I've put this onto for-next for the current merge window.

Thanks,
Andreas