linux/block
Ming Lei 046be7e596 blk-mq: use BLK_POLL_ONESHOT for synchronous poll completion
blk_execute_rq() with polling is used in kernel code paths such as
NVMe controller connect. The aggressive spinning in blk_hctx_poll()
can prevent the completion task from getting a chance to run, causing
a lockup.

The spinning with cpu_relax() doesn't yield CPU, so need_resched()
only becomes true on timer tick. This causes unnecessary spinning
while the completion task is already waiting to run.

Before commit f22ecf9c14, the loop would exit early because
task_is_running() was always true. After that commit removed the
check, the loop now spins until need_resched().

Fix this by using BLK_POLL_ONESHOT in blk_rq_poll_completion(). This
causes blk_hctx_poll() to poll once and return immediately, letting
the outer loop's cond_resched() yield CPU so the completion task can
run.

Fixes: f22ecf9c14 ("blk-mq: delete task running check in blk_hctx_poll()")
Cc: Diangang Li <lidiangang@bytedance.com>
Cc: Fengnan Chang <changfengnan@bytedance.com>
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-01-22 07:24:17 -07:00
..
partitions block: use min() instead of min_t() 2025-11-20 07:44:29 -07:00
Kconfig
Kconfig.iosched
Makefile
badblocks.c
bdev.c vfs-6.19-rc1.inode 2025-12-01 09:02:34 -08:00
bfq-cgroup.c block,bfq: fix aux stat accumulation destination 2025-12-28 09:03:51 -07:00
bfq-iosched.c block: fix race between wbt_enable_default and IO submission 2025-12-12 12:51:11 -07:00
bfq-iosched.h block, bfq: update outdated comment 2026-01-01 08:57:37 -07:00
bfq-wf2q.c
bio-integrity-auto.c block: zero non-PI portion of auto integrity buffer 2026-01-10 10:22:07 -07:00
bio-integrity.c block: make bio auto-integrity deadlock safe 2025-11-04 12:41:50 -07:00
bio.c block: prohibit calls to bio_chain_endio 2025-12-09 10:20:03 -07:00
blk-cgroup-fc-appid.c
blk-cgroup-rwstat.c
blk-cgroup-rwstat.h
blk-cgroup.c block: Remove elevator_lock usage from blkg_conf frozen operations 2025-10-15 08:00:19 -06:00
blk-cgroup.h
blk-core.c block: fix typos in comments and strings in blk-core 2025-11-25 10:39:49 -07:00
blk-crypto-fallback.c
blk-crypto-internal.h
blk-crypto-profile.c
blk-crypto-sysfs.c
blk-crypto.c blk-crypto: use BLK_STS_INVAL for alignment errors 2025-10-30 08:52:57 -06:00
blk-flush.c
blk-ia-ranges.c
blk-integrity.c block: don't merge bios with different app_tags 2026-01-06 19:10:08 -07:00
blk-ioc.c
blk-iocost.c block: use min() instead of min_t() 2025-11-20 07:44:29 -07:00
blk-iolatency.c
blk-ioprio.c
blk-ioprio.h
blk-lib.c block: fix memory leak in __blkdev_issue_zero_pages 2025-12-04 15:43:28 -07:00
blk-map.c block: use bio_alloc_bioset for passthru IO by default 2025-12-04 07:18:54 -07:00
blk-merge.c Revert "block: consider discard merge last" 2025-11-18 15:00:12 -07:00
blk-mq-cpumap.c
blk-mq-debugfs.c
blk-mq-debugfs.h
blk-mq-dma.c blk-mq-dma: always initialize dma state 2025-12-10 13:41:11 -07:00
blk-mq-sched.c block: use {alloc|free}_sched data methods 2025-11-13 09:27:49 -07:00
blk-mq-sched.h block: use {alloc|free}_sched data methods 2025-11-13 09:27:49 -07:00
blk-mq-sysfs.c
blk-mq-tag.c blk-mq: use array manage hctx map instead of xarray 2025-11-28 09:09:19 -07:00
blk-mq.c blk-mq: use BLK_POLL_ONESHOT for synchronous poll completion 2026-01-22 07:24:17 -07:00
blk-mq.h blk-mq: use queue_hctx in blk_mq_map_queue_type 2025-12-01 07:18:31 -07:00
blk-pm.c
blk-pm.h
blk-rq-qos.c
blk-rq-qos.h blk-rq-qos: Remove unlikely() hints from QoS checks 2026-01-06 19:08:23 -07:00
blk-settings.c block: validate interval_exp integrity limit 2025-12-18 09:51:49 -07:00
blk-stat.c
blk-stat.h
blk-sysfs.c block: fix race between wbt_enable_default and IO submission 2025-12-12 12:51:11 -07:00
blk-throttle.c block/blk-throttle: Remove throtl_slice from struct throtl_data 2025-11-17 09:39:48 -07:00
blk-throttle.h
blk-timeout.c
blk-wbt.c block: fix race between wbt_enable_default and IO submission 2025-12-12 12:51:11 -07:00
blk-wbt.h block: fix race between wbt_enable_default and IO submission 2025-12-12 12:51:11 -07:00
blk-zoned.c block: Fix an error path in disk_update_zone_resources() 2026-01-19 11:04:06 -07:00
blk.h block: unify elevator tags and type xarrays into struct elv_change_ctx 2025-11-13 09:27:49 -07:00
bsg-lib.c
bsg.c
disk-events.c
early-lookup.c
elevator.c block: fix race between wbt_enable_default and IO submission 2025-12-12 12:51:11 -07:00
elevator.h block: fix race between wbt_enable_default and IO submission 2025-12-12 12:51:11 -07:00
fops.c block: enable per-cpu bio cache by default 2025-12-04 07:19:24 -07:00
genhd.c block: Remove references to __device_add_disk() 2025-11-25 10:36:37 -07:00
holder.c
ioctl.c block: add allocation size check in blkdev_pr_read_keys() 2025-12-17 07:35:22 -07:00
ioprio.c
kyber-iosched.c block: define alloc_sched_data and free_sched_data methods for kyber 2025-11-13 09:27:49 -07:00
mq-deadline.c block/mq-deadline: Switch back to a single dispatch list 2025-10-20 10:37:42 -06:00
opal_proto.h
sed-opal.c
t10-pi.c