]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: lift setting __GFP_NOFAIL from xfs_buf_alloc_kmem to the caller
authorChristoph Hellwig <hch@lst.de>
Wed, 17 Jun 2026 05:58:03 +0000 (07:58 +0200)
committerCarlos Maiolino <cem@kernel.org>
Mon, 29 Jun 2026 07:37:05 +0000 (09:37 +0200)
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>
fs/xfs/xfs_buf.c

index d1b7729559f00a6f2ebe47650317ba84cd326514..538ae441e21265835b26ee6bfeb8e70d546ef2c0 100644 (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