Skip to content

Commit b0be23b

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: print details on transactions that aren't properly ended
If function gfs2_trans_begin is called with another transaction active it BUGs out, but it doesn't give any details about the duplicate. This patch moves function gfs2_print_trans and calls it when this situation arises for better debugging. Signed-off-by: Bob Peterson <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent b57bc0f commit b0be23b

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

fs/gfs2/trans.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,28 @@
2525
#include "util.h"
2626
#include "trace_gfs2.h"
2727

28+
static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr)
29+
{
30+
fs_warn(sdp, "Transaction created at: %pSR\n", (void *)tr->tr_ip);
31+
fs_warn(sdp, "blocks=%u revokes=%u reserved=%u touched=%u\n",
32+
tr->tr_blocks, tr->tr_revokes, tr->tr_reserved,
33+
test_bit(TR_TOUCHED, &tr->tr_flags));
34+
fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
35+
tr->tr_num_buf_new, tr->tr_num_buf_rm,
36+
tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
37+
tr->tr_num_revoke, tr->tr_num_revoke_rm);
38+
}
39+
2840
int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
2941
unsigned int revokes)
3042
{
3143
struct gfs2_trans *tr;
3244
int error;
3345

34-
BUG_ON(current->journal_info);
46+
if (current->journal_info) {
47+
gfs2_print_trans(sdp, current->journal_info);
48+
BUG();
49+
}
3550
BUG_ON(blocks == 0 && revokes == 0);
3651

3752
if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
@@ -72,18 +87,6 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
7287
return error;
7388
}
7489

75-
static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr)
76-
{
77-
fs_warn(sdp, "Transaction created at: %pSR\n", (void *)tr->tr_ip);
78-
fs_warn(sdp, "blocks=%u revokes=%u reserved=%u touched=%u\n",
79-
tr->tr_blocks, tr->tr_revokes, tr->tr_reserved,
80-
test_bit(TR_TOUCHED, &tr->tr_flags));
81-
fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
82-
tr->tr_num_buf_new, tr->tr_num_buf_rm,
83-
tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
84-
tr->tr_num_revoke, tr->tr_num_revoke_rm);
85-
}
86-
8790
void gfs2_trans_end(struct gfs2_sbd *sdp)
8891
{
8992
struct gfs2_trans *tr = current->journal_info;

0 commit comments

Comments
 (0)