[PATCH] gfs2: Correct use of trans

Lizhi Xu posted 1 patch 2 months ago
fs/gfs2/trans.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] gfs2: Correct use of trans
Posted by Lizhi Xu 2 months ago
There are too many factors interfering with current->journal_info(for
example: dirty inode, write jdata batch, etc.). When trans begins, the
current->journal_info is set to a new value, but when trans ends, it is
set to NULL.

When revoking a trans, use the trans in bufdata directly.

Fixes: 75f2b879aeb3 ("GFS2: Merge revoke adding functions")
Reported-by: syzbot+f2b9fe431c853e793948@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f2b9fe431c853e793948
Tested-by: syzbot+f2b9fe431c853e793948@syzkaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
---
 fs/gfs2/trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 075f7e9abe47..d1a34f928a18 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -314,7 +314,7 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
 
 void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
 {
-	struct gfs2_trans *tr = current->journal_info;
+	struct gfs2_trans *tr = bd->bd_tr;
 
 	BUG_ON(!list_empty(&bd->bd_list));
 	gfs2_add_revoke(sdp, bd);
-- 
2.43.0