diff options
| author | Christoph Hellwig <hch@lst.de> | 2025-01-31 13:03:47 +0100 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-01-31 07:20:08 -0700 |
| commit | 1e1a9cecfab3f22ebef0a976f849c87be8d03c1c (patch) | |
| tree | 34fa7958ed94c56127aa0fc55347bb409574af3a /drivers/block/rbd.c | |
| parent | 14ef49657ff3b7156952b2eadcf2e5bafd735795 (diff) | |
| download | linux-next-1e1a9cecfab3f22ebef0a976f849c87be8d03c1c.tar.gz linux-next-1e1a9cecfab3f22ebef0a976f849c87be8d03c1c.zip | |
block: force noio scope in blk_mq_freeze_queue
When block drivers or the core block code perform allocations with a
frozen queue, this could try to recurse into the block device to
reclaim memory and deadlock. Thus all allocations done by a process
that froze a queue need to be done without __GFP_IO and __GFP_FS.
Instead of tying to track all of them down, force a noio scope as
part of freezing the queue.
Note that nvme is a bit of a mess here due to the non-owner freezes,
and they will be addressed separately.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250131120352.1315351-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/rbd.c')
| -rw-r--r-- | drivers/block/rbd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 5b393e4a1ddf..faafd7ff43d6 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -7281,9 +7281,10 @@ static ssize_t do_rbd_remove(const char *buf, size_t count) * Prevent new IO from being queued and wait for existing * IO to complete/fail. */ - blk_mq_freeze_queue(rbd_dev->disk->queue); + unsigned int memflags = blk_mq_freeze_queue(rbd_dev->disk->queue); + blk_mark_disk_dead(rbd_dev->disk); - blk_mq_unfreeze_queue(rbd_dev->disk->queue); + blk_mq_unfreeze_queue(rbd_dev->disk->queue, memflags); } del_gendisk(rbd_dev->disk); |
