xfs: lift setting __GFP_NOFAIL from xfs_buf_alloc_kmem to the caller

The current __GFP_NOFAIL setting is wrong in some cases.  Prepare
for fixing that by giving control to the caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Christoph Hellwig 2026-06-17 07:58:03 +02:00 committed by Carlos Maiolino
parent c752838874
commit 27d7d15184

View File

@ -145,7 +145,7 @@ xfs_buf_alloc_kmem(
ASSERT(is_power_of_2(size));
ASSERT(size < PAGE_SIZE);
bp->b_addr = kmalloc(size, gfp_mask | __GFP_NOFAIL);
bp->b_addr = kmalloc(size, gfp_mask);
if (!bp->b_addr)
return -ENOMEM;
@ -230,7 +230,7 @@ xfs_buf_alloc_backing_mem(
* smaller than PAGE_SIZE buffers used by XFS.
*/
if (size < PAGE_SIZE && is_power_of_2(size))
return xfs_buf_alloc_kmem(bp, size, gfp_mask);
return xfs_buf_alloc_kmem(bp, size, gfp_mask | __GFP_NOFAIL);
/*
* Don't bother with the retry loop for single PAGE allocations: vmalloc