Skip to content

Commit 8f676b8

Browse files
sagigrimbergaxboe
authored andcommitted
nvme: make sure ns head inherits underlying device limits
Whenever we update ns_head info, we need to make sure it is still compatible with all underlying backing devices because although nvme multipath doesn't have any explicit use of these limits, other devices can still be stacked on top of it which may rely on the underlying limits. Start with unlimited stacking limits, and every info update iterate over siblings and adjust queue limits. Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 21d3bbd commit 8f676b8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,8 +1519,10 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
15191519
if (ns->ndev)
15201520
nvme_nvm_update_nvm_info(ns);
15211521
#ifdef CONFIG_NVME_MULTIPATH
1522-
if (ns->head->disk)
1522+
if (ns->head->disk) {
15231523
nvme_update_disk_info(ns->head->disk, ns, id);
1524+
blk_queue_stack_limits(ns->head->disk->queue, ns->queue);
1525+
}
15241526
#endif
15251527
}
15261528

drivers/nvme/host/multipath.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
285285
blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
286286
/* set to a default value for 512 until disk is validated */
287287
blk_queue_logical_block_size(q, 512);
288+
blk_set_stacking_limits(&q->limits);
288289

289290
/* we need to propagate up the VMC settings */
290291
if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)

0 commit comments

Comments
 (0)