summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorCong Zhang <cong.zhang@oss.qualcomm.com>2026-11-03 18:32:21 +0800
committerJens Axboe <axboe@kernel.dk>2026-11-03 07:06:41 -0700
commit6c6dec7883f8eb10b326bc9d109a4990c885d949 (patch)
treecb76457b6ec9d5e2ca8f36720c01fe45f6dd9ef9 /tools/lib/python
parent5a4236bf22622c291a96c139bfe54117f4cf1af6 (diff)
virtio_blk: use synchronous quiesce in virtblk_freeze_priv()
blk_mq_run_work_fn() can call blk_mq_sched_dispatch_requests() through blk_mq_run_dispatch_ops(). The dispatcher checks QUEUE_FLAG_QUIESCED while the flag is clear. It can then be preempted before it gets a request. At that time, it has no queue usage reference, so blk_mq_freeze_queue() does not wait for it. virtblk_freeze_priv() then calls blk_mq_quiesce_queue_nowait() and blk_mq_unfreeze_queue(). A new request can enter the queue. The old dispatcher can run again, use its old flag check, get the new request, and call virtio_queue_rq(). At the same time, virtblk_freeze_priv() can reset the device, delete the virtqueues, and free vblk->vqs. The old dispatcher can then use a deleted virtqueue or a NULL vblk->vqs, and the kernel can crash. Fix this by using blk_mq_quiesce_queue(), which waits for dispatch code that was already running. Keep the existing freeze and unfreeze order. The queue remains quiesced until virtblk_restore_priv() calls blk_mq_unquiesce_queue(). Fixes: 7678abee0867 ("virtio-blk: don't keep queue frozen during system suspend") Cc: stable@vger.kernel.org Acked-by: Jason Wang <jasowangio@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Cong Zhang <cong.zhang@oss.qualcomm.com> Link: https://lore.kernel.org/20260911-virtblk_sync_quiesce-v1-1-a883f8f31258@oss.qualcomm.com Link: https://patch.msgid.link/20261103-virtblk_sync_quiesce-v3-1-f40233f9bdd9@oss.qualcomm.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions