block: fix GFP_ flags confusion in bio_integrity_alloc_buf
authorChristoph Hellwig <hch@lst.de>
Wed, 24 Jun 2026 08:00:02 +0000 (10:00 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 24 Jun 2026 12:53:25 +0000 (06:53 -0600)
commite7c1627afda2484baf65449be15873c2550f917a
tree5b5fcad6bff1278a922ce86dda853b3d048a4829
parent3ca4f4e3ae811d414076a491cbf0dfcdae0dc01e
block: fix GFP_ flags confusion in bio_integrity_alloc_buf

bio_integrity_alloc_buf usage of GFP_ flags is messed up.  For one it
mixes GFP_NOFS and GFP_NOIO for neighbouring allocations, but it also
makes the allocations fail more often than needed.  That code was copied
from bio_alloc_bioset which needs to do that so that it can punt to the
rescuer workqueue, but none of that is needed for the integrity
allocations that either sits in the file system or at the very bottom
of the I/O stack.  Failing early means we'll do a fully waiting
allocation from the mempool ->alloc callback which is usually much
larger than required.

Fix this by passing a gfp_t so that the file system path can pass
GFP_NOFS and the auto-integrity code can pass GFP_NOIO, and don't
modify the allocation type except for disabling warnings.

Fixes: ec7f31b2a2d3 ("block: make bio auto-integrity deadlock safe")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://patch.msgid.link/20260624080014.1998650-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio-integrity-auto.c
block/bio-integrity-fs.c
block/bio-integrity.c
include/linux/bio-integrity.h