From: Sagi Grimberg <sagi@grimberg.me>
To: linux-nvme@lists.infradead.org
Cc: Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
Daniel Wagner <dwagner@suse.de>, Hannes Reinecke <hare@suse.de>
Subject: [PATCH rfc 5/6] nvme-rdma: re-resolve traddr upon reconnect in case it is a dns name
Date: Mon, 24 Jul 2023 12:20:21 +0300 [thread overview]
Message-ID: <20230724092023.708335-6-sagi@grimberg.me> (raw)
In-Reply-To: <20230724092023.708335-1-sagi@grimberg.me>
In case traddr is a dns name, it may describe a different address
during the controller lifetime. The classic example would be
a discovery-service dns name that may be load-balanced via dns over
multiple addresses.
So try to re-resolve the controller address. There is no dns query
in case the traddr provided is an ip address.
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
drivers/nvme/host/rdma.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 797bd192a413..2a4109bbd4a2 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -777,9 +777,22 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl)
static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
bool new)
{
+ struct nvmf_ctrl_options *opts = ctrl->ctrl.opts;
bool pi_capable = false;
int error;
+ /*
+ * it is possible that the controller traddr may be a dns name which
+ * may have changed its ip address since it was last resolved in prior
+ * connect. Try to re-resolve the address in this case.
+ */
+ error = nvmf_resolve_ip_address(opts, &ctrl->addr);
+ if (error) {
+ dev_warn(ctrl->ctrl.device, "unable to resolve address: %s:%s\n",
+ opts->traddr, opts->trsvcid);
+ return error;
+ }
+
error = nvme_rdma_alloc_queue(ctrl, 0, NVME_AQ_DEPTH);
if (error)
return error;
@@ -2230,13 +2243,6 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
opts->mask |= NVMF_OPT_TRSVCID;
}
- ret = nvmf_resolve_ip_address(opts, &ctrl->addr);
- if (ret) {
- pr_err("malformed address passed: %s:%s\n",
- opts->traddr, opts->trsvcid);
- goto out_free_ctrl;
- }
-
if (opts->mask & NVMF_OPT_HOST_TRADDR) {
ret = inet_pton_with_scope(&init_net, AF_UNSPEC,
opts->host_traddr, NULL, &ctrl->src_addr);
--
2.41.0
next prev parent reply other threads:[~2023-07-24 9:20 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 9:20 [PATCH rfc 0/6] support traddr as dns names for ip based transports Sagi Grimberg
2023-07-24 9:20 ` [PATCH rfc 1/6] nvme-fabrics: add helper to resolve ipv4/ipv6 or dns name Sagi Grimberg
2023-08-10 13:29 ` Hannes Reinecke
2023-08-13 12:54 ` Sagi Grimberg
2023-07-24 9:20 ` [PATCH rfc 2/6] nvme-tcp: use nvmf_resolve_address helper Sagi Grimberg
2023-08-10 13:30 ` Hannes Reinecke
2023-08-13 12:55 ` Sagi Grimberg
2023-07-24 9:20 ` [PATCH rfc 3/6] nvme-tcp: re-resolve traddr upon reconnect in case it is a dns name Sagi Grimberg
2023-08-10 13:30 ` Hannes Reinecke
2023-07-24 9:20 ` [PATCH rfc 4/6] nvme-rdma: use nvmf_resolve_address helper Sagi Grimberg
2023-08-10 13:31 ` Hannes Reinecke
2023-07-24 9:20 ` Sagi Grimberg [this message]
2023-08-10 13:31 ` [PATCH rfc 5/6] nvme-rdma: re-resolve traddr upon reconnect in case it is a dns name Hannes Reinecke
2023-07-24 9:20 ` [PATCH rfc 6/6] nvme-fabrics: expose support for traddr as dns names to userspace Sagi Grimberg
2023-08-10 13:33 ` Hannes Reinecke
2023-08-13 13:07 ` Sagi Grimberg
2023-08-17 9:11 ` Sagi Grimberg
2023-08-17 9:41 ` Hannes Reinecke
2023-08-17 10:37 ` Sagi Grimberg
2023-08-17 10:48 ` Hannes Reinecke
2023-08-17 11:09 ` Sagi Grimberg
2023-08-17 14:39 ` Daniel Wagner
2023-08-20 10:55 ` Sagi Grimberg
2023-08-21 6:08 ` Daniel Wagner
2023-08-21 7:44 ` Sagi Grimberg
2023-07-24 9:20 ` [PATCH rfc libnvme 7/6] fabrics: pass traddr dns name if the kernel supports it Sagi Grimberg
2023-08-10 12:03 ` [PATCH rfc 0/6] support traddr as dns names for ip based transports Sagi Grimberg
2023-08-10 12:33 ` Daniel Wagner
2023-08-10 13:24 ` Hannes Reinecke
2023-08-10 13:29 ` Belanger, Martin
2023-08-10 13:30 ` Belanger, Martin
2023-08-10 13:34 ` Hannes Reinecke
2023-08-13 13:09 ` Sagi Grimberg
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=20230724092023.708335-6-sagi@grimberg.me \
--to=sagi@grimberg.me \
--cc=dwagner@suse.de \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).