Skip to contentSkip to conversation

gfs2: remove tr_num_revoke from assert clause

PATCH New Bob Peterson 1 participant 1 message Jan 6, 2020 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: remove tr_num_revoke from assert clause

Hi,

Patch e955537e326 ("gfs2: eliminate tr_num_revoke_rm") made it possible for tr_num_revoke to go negative. That's not a problem because any given transaction can add a revoke for changed metadata, but it may then remove several revoke bds that are queued off the superblock. So it may remove more than it added.

However, this sometimes caused this assert:

fatal: assertion "(nbuf <= tr->tr_blocks) &&
(tr->tr_num_revoke <= tr->tr_revokes)" failed function = gfs2_trans_end, file = gfs2/trans.c, line = 110

This patch makes tr_num_revoke a signed int rather than unsigned, and it removes the tr_num_revoke clause from the assert.

---
 fs/gfs2/incore.h | 2 +-
 fs/gfs2/trans.c  | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
fs/gfs2/incore.h +1 -1
index b5d9c11f4901..e09859384559 100644
@@ -504,7 +504,7 @@ struct gfs2_trans {
 	unsigned int tr_num_databuf_new;
 	unsigned int tr_num_buf_rm;
 	unsigned int tr_num_databuf_rm;
-	unsigned int tr_num_revoke;
+	int tr_num_revoke;
 
 	struct list_head tr_list;
 	struct list_head tr_databuf;
fs/gfs2/trans.c +2 -3
index 4d01fe19c125..60369f9950e2 100644
@@ -76,7 +76,7 @@ static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr)
 	fs_warn(sdp, "blocks=%u revokes=%u reserved=%u touched=%u\n",
 		tr->tr_blocks, tr->tr_revokes, tr->tr_reserved,
 		test_bit(TR_TOUCHED, &tr->tr_flags));
-	fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %u\n",
+	fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %d\n",
 		tr->tr_num_buf_new, tr->tr_num_buf_rm,
 		tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
 		tr->tr_num_revoke);
@@ -103,8 +103,7 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
 	nbuf -= tr->tr_num_buf_rm;
 	nbuf -= tr->tr_num_databuf_rm;
 
-	if (gfs2_assert_withdraw(sdp, (nbuf <= tr->tr_blocks) &&
-				       (tr->tr_num_revoke <= tr->tr_revokes)))
+	if (gfs2_assert_withdraw(sdp, (nbuf <= tr->tr_blocks)))
 		gfs2_print_trans(sdp, tr);
 
 	gfs2_log_commit(sdp, tr);