From: Keith Busch <keith.busch@intel.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>, Jens Axboe <axboe@kernel.dk>,
Hannes Reinecke <hare@suse.de>,
Johannes Thumshirn <jthumshirn@suse.de>,
linux-nvme@lists.infradead.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 4/7] nvme: implement multipath access to nvme subsystems
Date: Thu, 9 Nov 2017 14:21:12 -0700 [thread overview]
Message-ID: <20171109212111.GA1718@localhost.localdomain> (raw)
In-Reply-To: <20171109174450.17142-5-hch@lst.de>
Ahh, I incorporated non-multipath disks into the mix and observing some
trouble. Details below:
On Thu, Nov 09, 2017 at 06:44:47PM +0100, Christoph Hellwig wrote:
> +#ifdef CONFIG_NVME_MULTIPATH
> + if (ns->head->disk) {
> + sprintf(disk_name, "nvme%dc%dn%d", ctrl->subsys->instance,
> + ctrl->cntlid, ns->head->instance);
> + flags = GENHD_FL_HIDDEN;
> + } else
> +#endif
> + sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
...
> +int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
> +{
> + struct request_queue *q;
> + bool vwc = false;
> +
> + bio_list_init(&head->requeue_list);
> + spin_lock_init(&head->requeue_lock);
> + INIT_WORK(&head->requeue_work, nvme_requeue_work);
> +
> + /*
> + * Add a multipath node if the subsystems supports multiple controllers.
> + * We also do this for private namespaces as the namespace sharing data could
> + * change after a rescan.
> + */
> + if (!(ctrl->subsys->cmic & (1 << 1)) || !multipath)
> + return 0;
...
> + sprintf(head->disk->disk_name, "nvme%dn%d",
> + ctrl->subsys->instance, head->instance);
If we've CMIC capabilities, we'll use the subsys->instance; if we don't
have CMIC, we use the ctrl->instance.
Since the two instances are independent of each other, they can create
duplicate names.
To fix, I think we'll need to always use the subsys instance for
consistency if CONFIG_NVME_MULTIPATH=y.
---
@@ -2837,8 +2826,10 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
ctrl->cntlid, ns->head->instance);
flags = GENHD_FL_HIDDEN;
} else
+ sprintf(disk_name, "nvme%dn%d", ctrl->subsys->instance, ns->head->instance);
+#else
+ sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
#endif
- sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) {
if (nvme_nvm_register(ns, disk_name, node)) {
--
This may confuse some people since the block device's name will not always
match up to the controller's chardev name, but I don't see another way
to do it.
WARNING: multiple messages have this Message-ID (diff)
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH 4/7] nvme: implement multipath access to nvme subsystems
Date: Thu, 9 Nov 2017 14:21:12 -0700 [thread overview]
Message-ID: <20171109212111.GA1718@localhost.localdomain> (raw)
In-Reply-To: <20171109174450.17142-5-hch@lst.de>
Ahh, I incorporated non-multipath disks into the mix and observing some
trouble. Details below:
On Thu, Nov 09, 2017@06:44:47PM +0100, Christoph Hellwig wrote:
> +#ifdef CONFIG_NVME_MULTIPATH
> + if (ns->head->disk) {
> + sprintf(disk_name, "nvme%dc%dn%d", ctrl->subsys->instance,
> + ctrl->cntlid, ns->head->instance);
> + flags = GENHD_FL_HIDDEN;
> + } else
> +#endif
> + sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
...
> +int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
> +{
> + struct request_queue *q;
> + bool vwc = false;
> +
> + bio_list_init(&head->requeue_list);
> + spin_lock_init(&head->requeue_lock);
> + INIT_WORK(&head->requeue_work, nvme_requeue_work);
> +
> + /*
> + * Add a multipath node if the subsystems supports multiple controllers.
> + * We also do this for private namespaces as the namespace sharing data could
> + * change after a rescan.
> + */
> + if (!(ctrl->subsys->cmic & (1 << 1)) || !multipath)
> + return 0;
...
> + sprintf(head->disk->disk_name, "nvme%dn%d",
> + ctrl->subsys->instance, head->instance);
If we've CMIC capabilities, we'll use the subsys->instance; if we don't
have CMIC, we use the ctrl->instance.
Since the two instances are independent of each other, they can create
duplicate names.
To fix, I think we'll need to always use the subsys instance for
consistency if CONFIG_NVME_MULTIPATH=y.
---
@@ -2837,8 +2826,10 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
ctrl->cntlid, ns->head->instance);
flags = GENHD_FL_HIDDEN;
} else
+ sprintf(disk_name, "nvme%dn%d", ctrl->subsys->instance, ns->head->instance);
+#else
+ sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
#endif
- sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) {
if (nvme_nvm_register(ns, disk_name, node)) {
--
This may confuse some people since the block device's name will not always
match up to the controller's chardev name, but I don't see another way
to do it.
next prev parent reply other threads:[~2017-11-09 21:17 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 17:44 nvme multipath support V7 Christoph Hellwig
2017-11-09 17:44 ` Christoph Hellwig
2017-11-09 17:44 ` [PATCH 1/7] nvme: track subsystems Christoph Hellwig
2017-11-09 17:44 ` Christoph Hellwig
2017-11-09 20:23 ` Martin K. Petersen
2017-11-09 20:23 ` Martin K. Petersen
2017-11-09 17:44 ` [PATCH 2/7] nvme: introduce a nvme_ns_ids structure Christoph Hellwig
2017-11-09 17:44 ` Christoph Hellwig
2017-11-09 20:25 ` Martin K. Petersen
2017-11-09 20:25 ` Martin K. Petersen
2017-11-09 17:44 ` [PATCH 3/7] nvme: track shared namespaces Christoph Hellwig
2017-11-09 17:44 ` Christoph Hellwig
2017-11-09 20:28 ` Martin K. Petersen
2017-11-09 20:28 ` Martin K. Petersen
2017-11-09 17:44 ` [PATCH 4/7] nvme: implement multipath access to nvme subsystems Christoph Hellwig
2017-11-09 17:44 ` Christoph Hellwig
2017-11-09 18:17 ` Keith Busch
2017-11-09 18:17 ` Keith Busch
2017-11-09 20:32 ` Martin K. Petersen
2017-11-09 20:32 ` Martin K. Petersen
2017-11-09 21:21 ` Keith Busch [this message]
2017-11-09 21:21 ` Keith Busch
2017-11-10 4:52 ` Christoph Hellwig
2017-11-10 4:52 ` Christoph Hellwig
2017-11-10 5:07 ` Christoph Hellwig
2017-11-10 5:07 ` Christoph Hellwig
2017-11-09 21:22 ` Mike Snitzer
2017-11-09 21:22 ` Mike Snitzer
2017-11-10 4:54 ` Christoph Hellwig
2017-11-10 4:54 ` Christoph Hellwig
2017-11-10 7:27 ` Hannes Reinecke
2017-11-10 7:27 ` Hannes Reinecke
2017-11-09 17:44 ` [PATCH 5/7] nvme: also expose the namespace identification sysfs files for mpath nodes Christoph Hellwig
2017-11-09 17:44 ` Christoph Hellwig
2017-11-09 20:33 ` Martin K. Petersen
2017-11-09 20:33 ` Martin K. Petersen
2017-11-10 8:21 ` Hannes Reinecke
2017-11-10 8:21 ` Hannes Reinecke
2017-11-09 17:44 ` [PATCH 6/7] block: create 'slaves' and 'holders' entries for hidden gendisks Christoph Hellwig
2017-11-09 17:44 ` Christoph Hellwig
2017-11-09 20:34 ` Martin K. Petersen
2017-11-09 20:34 ` Martin K. Petersen
2017-11-09 17:44 ` [PATCH 7/7] nvme: create 'slaves' and 'holders' entries for hidden controllers Christoph Hellwig
2017-11-09 17:44 ` Christoph Hellwig
2017-11-09 20:34 ` Martin K. Petersen
2017-11-09 20:34 ` Martin K. Petersen
2017-11-10 8:44 ` nvme multipath support V7 Christoph Hellwig
2017-11-10 8:44 ` Christoph Hellwig
2018-04-10 19:32 ` Gruher, Joseph R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171109212111.GA1718@localhost.localdomain \
--to=keith.busch@intel.com \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jthumshirn@suse.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.