[PATCH 2/3] block: Fix __blk_mq_update_nr_hw_queues() queue freeze and limits lock order
Christoph Hellwig
hch at lst.de
Mon Jan 6 00:30:14 PST 2025
On Sat, Jan 04, 2025 at 10:25:21PM +0900, Damien Le Moal wrote:
> __blk_mq_update_nr_hw_queues() freezes a device queues during operation,
> which also includes updating the BLK_FEAT_POLL feature flag for the
> device queues using queue_limits_start_update() and
> queue_limits_commit_update(). This call order thus creates an invalid
> ordering of a queue freeze and queue limit locking which can lead to a
> deadlock when the device driver must issue commands to probe the device
> when revalidating its limits.
>
> Avoid this issue by moving the update of the BLK_FEAT_POLL feature flag
> out of the main queue remapping loop to the end of
> __blk_mq_update_nr_hw_queues(), after the device queues have been
> unfrozen.
What happens if I/O is queued after the unfreeze, but before clearing
the poll flag?
More information about the Linux-nvme
mailing list