Skip to content

Commit a31b4ec

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
Revert "gfs2: eliminate tr_num_revoke_rm"
This reverts commit e955537. Before patch e955537, tr_num_revoke tracked the number of revokes added to the transaction, and tr_num_revoke_rm tracked how many revokes were removed. But since revokes are queued off the sdp (superblock) pointer, some transactions could remove more revokes than they added. (e.g. revokes added by a different process). Commit e955537 eliminated transaction variable tr_num_revoke_rm, but in order to do so, it changed the accounting to always use tr_num_revoke for its math. Since you can remove more revokes than you add, tr_num_revoke could now become a negative value. This negative value broke the assert in function gfs2_trans_end: if (gfs2_assert_withdraw(sdp, (nbuf <=3D tr->tr_blocks) && (tr->tr_num_revoke <=3D tr->tr_revokes))) One way to fix this is to simply remove the tr_num_revoke clause from the assert and allow the value to become negative. Andreas didn't like that idea, so instead, we decided to revert e955537. Signed-off-by: Bob Peterson <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent c04f2e0 commit a31b4ec

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

fs/gfs2/incore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ struct gfs2_trans {
503503
unsigned int tr_num_buf_rm;
504504
unsigned int tr_num_databuf_rm;
505505
unsigned int tr_num_revoke;
506+
unsigned int tr_num_revoke_rm;
506507

507508
struct list_head tr_list;
508509
struct list_head tr_databuf;

fs/gfs2/log.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,7 @@ static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new)
895895
old->tr_num_buf_rm += new->tr_num_buf_rm;
896896
old->tr_num_databuf_rm += new->tr_num_databuf_rm;
897897
old->tr_num_revoke += new->tr_num_revoke;
898+
old->tr_num_revoke_rm += new->tr_num_revoke_rm;
898899

899900
list_splice_tail_init(&new->tr_databuf, &old->tr_databuf);
900901
list_splice_tail_init(&new->tr_buf, &old->tr_buf);
@@ -916,7 +917,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
916917
set_bit(TR_ATTACHED, &tr->tr_flags);
917918
}
918919

919-
sdp->sd_log_committed_revoke += tr->tr_num_revoke;
920+
sdp->sd_log_committed_revoke += tr->tr_num_revoke - tr->tr_num_revoke_rm;
920921
reserved = calc_reserved(sdp);
921922
maxres = sdp->sd_log_blks_reserved + tr->tr_reserved;
922923
gfs2_assert_withdraw(sdp, maxres >= reserved);

fs/gfs2/trans.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr)
7676
fs_warn(sdp, "blocks=%u revokes=%u reserved=%u touched=%u\n",
7777
tr->tr_blocks, tr->tr_revokes, tr->tr_reserved,
7878
test_bit(TR_TOUCHED, &tr->tr_flags));
79-
fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %u\n",
79+
fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
8080
tr->tr_num_buf_new, tr->tr_num_buf_rm,
8181
tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
82-
tr->tr_num_revoke);
82+
tr->tr_num_revoke, tr->tr_num_revoke_rm);
8383
}
8484

8585
void gfs2_trans_end(struct gfs2_sbd *sdp)
@@ -264,7 +264,7 @@ void gfs2_trans_remove_revoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len)
264264
if (bd->bd_gl)
265265
gfs2_glock_remove_revoke(bd->bd_gl);
266266
kmem_cache_free(gfs2_bufdata_cachep, bd);
267-
tr->tr_num_revoke--;
267+
tr->tr_num_revoke_rm++;
268268
if (--n == 0)
269269
break;
270270
}

0 commit comments

Comments
 (0)