On Sat, Sep 12, 2026 at 04:52:44PM +0800, Cong Zhang wrote: > Replace blk_mq_quiesce_queue_nowait() with blk_mq_quiesce_queue() in > virtblk_freeze_priv(). > > Keep the existing freeze and unfreeze order. The synchronous call waits > for dispatch code that was already running. 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") > > Signed-off-by: Cong Zhang > --- > 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. > --- > Changes in v2: > - Cc stable@vger.kernel.org. > - Link to v1: https://lore.kernel.org/20260911-virtblk_sync_quiesce-v1-1-a883f8f31258@oss.qualcomm.com > --- > drivers/block/virtio_blk.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Modulo Michael's comments about the commit message: Reviewed-by: Stefan Hajnoczi