Skip to content

Commit c5be5df

Browse files
Christoph Hellwigkeithbusch
authored andcommitted
nvme-multipath: pass queue_limits to blk_alloc_disk
The multipath disk starts out with the stacking default limits. The one interesting part here is that blk_set_stacking_limits sets the max_zone_append_sectorts to UINT_MAX, which fails the validation for non-zoned devices. With the old one call per limit scheme this was fine because no one verified this weird mismatch and it was fixed by blk_stack_limits a little later before I/O could be issued. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent e6c9b13 commit c5be5df

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/nvme/host/multipath.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ static void nvme_requeue_work(struct work_struct *work)
516516

517517
int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
518518
{
519+
struct queue_limits lim;
519520
bool vwc = false;
520521

521522
mutex_init(&head->lock);
@@ -532,7 +533,12 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
532533
!nvme_is_unique_nsid(ctrl, head) || !multipath)
533534
return 0;
534535

535-
head->disk = blk_alloc_disk(NULL, ctrl->numa_node);
536+
blk_set_stacking_limits(&lim);
537+
lim.dma_alignment = 3;
538+
if (head->ids.csi != NVME_CSI_ZNS)
539+
lim.max_zone_append_sectors = 0;
540+
541+
head->disk = blk_alloc_disk(&lim, ctrl->numa_node);
536542
if (IS_ERR(head->disk))
537543
return PTR_ERR(head->disk);
538544
head->disk->fops = &nvme_ns_head_ops;
@@ -553,11 +559,6 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
553559
ctrl->tagset->map[HCTX_TYPE_POLL].nr_queues)
554560
blk_queue_flag_set(QUEUE_FLAG_POLL, head->disk->queue);
555561

556-
/* set to a default value of 512 until the disk is validated */
557-
blk_queue_logical_block_size(head->disk->queue, 512);
558-
blk_set_stacking_limits(&head->disk->queue->limits);
559-
blk_queue_dma_alignment(head->disk->queue, 3);
560-
561562
/* we need to propagate up the VMC settings */
562563
if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
563564
vwc = true;

0 commit comments

Comments
 (0)