summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorWenwu Hou <hwenwur@gmail.com>2026-01-17 14:52:43 +0800
committerCarlos Maiolino <cem@kernel.org>2026-01-21 12:59:10 +0100
commita1ca658d649a4d8972e2e21ac2625b633217e327 (patch)
tree7f0fc99da055600f65cf3a37569a0824088c932c /include
parent01a28961549ac9c387ccd5eb00d58be1d8c2794b (diff)
xfs: fix incorrect context handling in xfs_trans_roll
The memalloc_nofs_save() and memalloc_nofs_restore() calls are incorrectly paired in xfs_trans_roll. Call path: xfs_trans_alloc() __xfs_trans_alloc() // tp->t_pflags = memalloc_nofs_save(); xfs_trans_set_context() ... xfs_defer_trans_roll() xfs_trans_roll() xfs_trans_dup() // old_tp->t_pflags = 0; xfs_trans_switch_context() __xfs_trans_commit() xfs_trans_free() // memalloc_nofs_restore(tp->t_pflags); xfs_trans_clear_context() The code passes 0 to memalloc_nofs_restore() when committing the original transaction, but memalloc_nofs_restore() should always receive the flags returned from the paired memalloc_nofs_save() call. Before commit 3f6d5e6a468d ("mm: introduce memalloc_flags_{save,restore}"), calling memalloc_nofs_restore(0) would unset the PF_MEMALLOC_NOFS flag, which could cause memory allocation deadlocks[1]. Fortunately, after that commit, memalloc_nofs_restore(0) does nothing, so this issue is currently harmless. Fixes: 756b1c343333 ("xfs: use current->journal_info for detecting transaction recursion") Link: https://lore.kernel.org/linux-xfs/20251104131857.1587584-1-leo.lilong@huawei.com [1] Signed-off-by: Wenwu Hou <hwenwur@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions