Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvme: fix queue freeze vs limits lock order

Match the locking order used by the core block code by only freezing
the queue after taking the limits lock.

Unlike most queue updates this does not use the
queue_limits_commit_update_frozen helper as the nvme driver want the
queue frozen for more than just the limits update.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20250110054726.1499538-8-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
473106dd c99f66e4

+5 -4
+5 -4
drivers/nvme/host/core.c
··· 2128 2128 struct queue_limits lim; 2129 2129 int ret; 2130 2130 2131 - blk_mq_freeze_queue(ns->disk->queue); 2132 2131 lim = queue_limits_start_update(ns->disk->queue); 2133 2132 nvme_set_ctrl_limits(ns->ctrl, &lim); 2133 + 2134 + blk_mq_freeze_queue(ns->disk->queue); 2134 2135 ret = queue_limits_commit_update(ns->disk->queue, &lim); 2135 2136 set_disk_ro(ns->disk, nvme_ns_is_readonly(ns, info)); 2136 2137 blk_mq_unfreeze_queue(ns->disk->queue); ··· 2178 2177 goto out; 2179 2178 } 2180 2179 2180 + lim = queue_limits_start_update(ns->disk->queue); 2181 + 2181 2182 blk_mq_freeze_queue(ns->disk->queue); 2182 2183 ns->head->lba_shift = id->lbaf[lbaf].ds; 2183 2184 ns->head->nuse = le64_to_cpu(id->nuse); 2184 2185 capacity = nvme_lba_to_sect(ns->head, le64_to_cpu(id->nsze)); 2185 - 2186 - lim = queue_limits_start_update(ns->disk->queue); 2187 2186 nvme_set_ctrl_limits(ns->ctrl, &lim); 2188 2187 nvme_configure_metadata(ns->ctrl, ns->head, id, nvm, info); 2189 2188 nvme_set_chunk_sectors(ns, id, &lim); ··· 2286 2285 struct queue_limits *ns_lim = &ns->disk->queue->limits; 2287 2286 struct queue_limits lim; 2288 2287 2288 + lim = queue_limits_start_update(ns->head->disk->queue); 2289 2289 blk_mq_freeze_queue(ns->head->disk->queue); 2290 2290 /* 2291 2291 * queue_limits mixes values that are the hardware limitations ··· 2303 2301 * the splitting limits in to make sure we still obey possibly 2304 2302 * lower limitations of other controllers. 2305 2303 */ 2306 - lim = queue_limits_start_update(ns->head->disk->queue); 2307 2304 lim.logical_block_size = ns_lim->logical_block_size; 2308 2305 lim.physical_block_size = ns_lim->physical_block_size; 2309 2306 lim.io_min = ns_lim->io_min;