Re: [PATCH 6/8] nvme: fix queue freeze vs limits lock order

Nilay Shroff
2025-01-07T08:45:28Z

On 1/7/25 1:52 PM, Christoph Hellwig wrote:
> On Tue, Jan 07, 2025 at 12:28:29PM +0530, Nilay Shroff wrote:
>>> - blk_mq_freeze_queue(ns->disk->queue);
>>> lim = queue_limits_start_update(ns->disk->queue);
>>> nvme_set_ctrl_limits(ns->ctrl, &lim);
>>> +
>>> + blk_mq_freeze_queue(ns->disk->queue);
>>> ret = queue_limits_commit_update(ns->disk->queue, &lim);
>>> set_disk_ro(ns->disk, nvme_ns_is_readonly(ns, info));
>>> blk_mq_unfreeze_queue(ns->disk->queue);
>>
>> I think we should freeze queue before nvme_set_ctrl_limits().
>
> Why?
>
The nvme_set_ctrl_limits() sets certain queue limits which are
also used during IO processing. For instance, ->max_segment_size
is used while submitting bio.
Also, if we look at the code before your patch, nvme_set_ctrl_limits()
is called when the queue is freezed.

Thanks,
--Nilay