[PATCH v2 0/2] xfs: restore nofs context unconditionally in xfs_trans_roll
From: Yun Zhou
Date: Sun Jul 19 2026 - 05:59:58 EST
xfs_trans_roll() loses the NOFS allocation context on the error path,
causing a circular lock dependency between xfs_nondir_ilock_class and
fs_reclaim reported by syzbot. Fix this by transferring the nofs
context from the old transaction to the new one in xfs_trans_dup(),
so it remains active regardless of commit success or failure.
v2:
- Instead of moving xfs_trans_set_context() before the error check,
transfer the nofs context in xfs_trans_dup() via a new
memalloc_flags_move() helper, as suggested by Darrick.
- Change t_pflags from unsigned long to unsigned int to match mm API.
v1: https://lore.kernel.org/all/20260713035505.1635191-1-yun.zhou@xxxxxxxxxxxxx/T/
Yun Zhou (2):
mm: introduce memalloc_flags_move() for transferring allocation scopes
xfs: restore nofs context unconditionally in xfs_trans_roll
fs/xfs/xfs_trans.c | 9 +++------
fs/xfs/xfs_trans.h | 2 +-
include/linux/sched/mm.h | 17 +++++++++++++++++
3 files changed, 21 insertions(+), 7 deletions(-)
--
2.43.0