blk-mq: fix queue quiescing
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest7 patches 7 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | blk-mq: introduce blk_mq_unquiesce_queueblock/ include/ | +14 | 0 replies | |
| 2/7 | block: introduce flag of QUEUE_FLAG_QUIESCEDinclude/ | +2 | 0 replies | |
| 3/7 | dm: use the introduced blk_mq_unquiesce_queue()drivers/ | +1 | 0 replies | |
| 4/7 | nvme: use the introduced blk_mq_unquiesce_queue()drivers/ | +1 | 0 replies | |
| 5/7 | scsi: use the introduced blk_mq_unquiesce_queue()drivers/ | +4 | 0 replies | |
| 6/7 | blk-mq: quiesce queue via percpu_refblock/ include/ include/ | +77 | 0 replies | |
| 7/7 | blk-mq: update comments on blk_mq_quiesce_queue()block/ | +3 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/7] blk-mq: fix queue quiescing
Hi,
One big problem of blk_mq_quiesce_queue() is that it can't prevent .queue_rq() in direct issue path from being run even though hw queues are stopped by blk_mq_quiesce_queue().
It is observed that request double-free/use-after-free
can be triggered easily when canceling NVMe requests via blk_mq_tagset_busy_iter(...nvme_cancel_request) in nvme_dev_disable(). The reason is that blk_mq_quiesce_queue() can't prevent direct issue from being run.
This patchset implements queue quiescing via percpu_ref and fixes the above issue.
Actually we have to quiesce queue for canceling dispatched requests via blk_mq_tagset_busy_iter(), otherwise use-after-free can be made easily. This way of canceling dispatched requests has been used in several drivers, only NVMe uses blk_mq_quiesce_queue() to avoid the issue, and others need to be fixed too.
Also this patchset cleans up the code much, and the fat 'srcu_struct' can be removed from 'struct blk_mq_hw_ctx'.
Thanks,
Ming
Ming Lei (7):
blk-mq: introduce blk_mq_unquiesce_queue
block: introduce flag of QUEUE_FLAG_QUIESCED
dm: use the introduced blk_mq_unquiesce_queue()
nvme: use the introduced blk_mq_unquiesce_queue()
scsi: use the introduced blk_mq_unquiesce_queue()
blk-mq: quiesce queue via percpu_ref
blk-mq: update comments on blk_mq_quiesce_queue()
block/blk-mq.c | 131 +++++++++++++++++++++++++++++++---------------- drivers/md/dm-rq.c | 2 +- drivers/nvme/host/core.c | 2 +- drivers/scsi/scsi_lib.c | 5 +- include/linux/blk-mq.h | 2 - include/linux/blkdev.h | 8 +++ 6 files changed, 102 insertions(+), 48 deletions(-)
Signature · 1 line
2.9.4