]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
blk-mq: skip CPU offline notify on unmapped hctx
authorCong Zhang <cong.zhang@oss.qualcomm.com>
Tue, 30 Dec 2025 09:17:05 +0000 (17:17 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 30 Dec 2025 16:02:22 +0000 (09:02 -0700)
If an hctx has no software ctx mapped, blk_mq_map_swqueue() never
allocates tags and leaves hctx->tags NULL. The CPU hotplug offline
notifier can still run for that hctx, return early since hctx cannot
hold any requests.

Signed-off-by: Cong Zhang <cong.zhang@oss.qualcomm.com>
Fixes: bf0beec0607d ("blk-mq: drain I/O when all CPUs in a hctx are offline")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index 1978eef95dca3fb332a73aeff7b9613ee770a8a3..eff4f72ce83be80aac9da86aab35079be7d2b5e4 100644 (file)
@@ -3721,7 +3721,7 @@ static int blk_mq_hctx_notify_offline(unsigned int cpu, struct hlist_node *node)
                        struct blk_mq_hw_ctx, cpuhp_online);
        int ret = 0;
 
-       if (blk_mq_hctx_has_online_cpu(hctx, cpu))
+       if (!hctx->nr_ctx || blk_mq_hctx_has_online_cpu(hctx, cpu))
                return 0;
 
        /*