public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: use GFP_NOFS in __xfs_trans_alloc
@ 2026-03-12  7:22 Morduan Zang
  2026-03-12 14:26 ` Darrick J. Wong
  2026-03-12 20:25 ` Dave Chinner
  0 siblings, 2 replies; 10+ messages in thread
From: Morduan Zang @ 2026-03-12  7:22 UTC (permalink / raw)
  To: cem
  Cc: zhanjun, hch, dchinner, stable, linux-xfs, linux-kernel,
	Morduan Zang, syzbot+d78ace33ad4ee69329d5

__xfs_trans_alloc() allocates the transaction structure before
xfs_trans_set_context() establishes the nofs context. If memory reclaim
enters XFS through xfs_vn_sync_lazytime(), this GFP_KERNEL allocation can
trigger a warning from the reclaim path.

Use GFP_NOFS for the transaction allocation to avoid filesystem reclaim
recursion before the nofs context is set.

Link: https://syzkaller.appspot.com/bug?extid=d78ace33ad4ee69329d5
Fixes: 83a80e95e797 ("xfs: decouple xfs_trans_alloc_empty from xfs_trans_alloc")
Reported-by: syzbot+d78ace33ad4ee69329d5@syzkaller.appspotmail.com

Signed-off-by: Zhan Jun <zhanjun@uniontech.com>
Signed-off-by: Morduan Zang <zhangdandan@uniontech.com>
---
 fs/xfs/xfs_trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index bcc470f56e46..0d347cff7317 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -217,7 +217,7 @@ __xfs_trans_alloc(
 
 	ASSERT(!(flags & XFS_TRANS_RES_FDBLKS) || xfs_has_lazysbcount(mp));
 
-	tp = kmem_cache_zalloc(xfs_trans_cache, GFP_KERNEL | __GFP_NOFAIL);
+	tp = kmem_cache_zalloc(xfs_trans_cache, GFP_NOFS | __GFP_NOFAIL);
 	if (!(flags & XFS_TRANS_NO_WRITECOUNT))
 		sb_start_intwrite(mp->m_super);
 	xfs_trans_set_context(tp);
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-03-25 11:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12  7:22 [PATCH] xfs: use GFP_NOFS in __xfs_trans_alloc Morduan Zang
2026-03-12 14:26 ` Darrick J. Wong
2026-03-12 20:28   ` Dave Chinner
2026-03-12 20:25 ` Dave Chinner
2026-03-16  9:18   ` Christoph Hellwig
2026-03-18 21:01     ` Dave Chinner
2026-03-20 10:03       ` [PATCH] xfs: defer lazytime timestamp updates to inodegc during eviction Morduan Zang
2026-03-24 15:14         ` Jan Kara
2026-03-25  6:38           ` Christoph Hellwig
2026-03-25 11:34             ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox