diff options
| author | guolingxing <guolingxing@tju.edu.cn> | 2026-10-15 06:53:19 +0000 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-10-30 23:14:32 +0100 |
| commit | 4172be965c2ce887ebfb1117c634a68555be8c11 (patch) | |
| tree | a3cf99b3b3cb2cb4969324d98029300b02778997 /scripts/dummy-tools/python3 | |
| parent | b5af0db0ede2b3897a4313f2f5a4baa1476708c1 (diff) | |
btrfs: sysfs: restore NOFS context on early return in btrfs_sysfs_add_block_group_type()
btrfs_sysfs_add_block_group_type() sets up a NOFS context with
memalloc_nofs_save() because kobject_add() performs GFP_KERNEL
allocations deep in its call chain, and the function may be called
while holding a transaction handle or a lock required for a
transaction commit, where reclaim could deadlock.
Every other return path of this function calls memalloc_nofs_restore()
except the early return taken when another thread has already created
the kobject for the same raid index (this can happen when restriping).
Taking that path leaves PF_MEMALLOC_NOFS set on the calling task, so
all subsequent memory allocations performed by that task remain
restricted to the NOFS scope, which may lead to unexpected allocation
failures or deadlocks later on.
Restore the NOFS context before returning from that path.
Fixes: 49ea112da0e6 ("btrfs: do not create raid sysfs entries under any locks")
CC: stable@vger.kernel.org
Signed-off-by: guolingxing <guolingxing@tju.edu.cn>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'scripts/dummy-tools/python3')
0 files changed, 0 insertions, 0 deletions
