File 0020-nvme-cli-fabrics-Fix-passing-host_traddr-for-all-tra.patch of Package nvme-cli.12152

From: Max Gurtovoy <maxg@mellanox.com>
Date: Thu, 8 Mar 2018 19:38:16 +0200
Subject: [PATCH] nvme-cli: fabrics: Fix passing "host_traddr" for all
 transports

Git-commit: 242012d1111817542582ff861d9507aa90f95e10
References: bsc#1090568

Currently only FC transport passes "host_traddr" to the kernel during
nvme connect-all command. Fix it for all transports.

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 fabrics.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fabrics.c b/fabrics.c
index d759e92..e48b834 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -621,6 +621,14 @@ static int connect_ctrl(struct nvmf_disc_rsp_page_entry *e)
 		p += len;
 	}
 
+	if (cfg.host_traddr) {
+		len = sprintf(p, ",host_traddr=%s", cfg.host_traddr);
+		if (len < 0)
+			return -EINVAL;
+		p+= len;
+	}
+
+
 	switch (e->trtype) {
 	case NVMF_TRTYPE_LOOP: /* loop */
 		len = sprintf(p, ",transport=loop");
@@ -666,11 +674,6 @@ static int connect_ctrl(struct nvmf_disc_rsp_page_entry *e)
 				return -EINVAL;
 			p += len;
 
-			len = sprintf(p, ",host_traddr=%s", cfg.host_traddr);
-			if (len < 0)
-				return -EINVAL;
-			p+= len;
-
 			len = sprintf(p, ",traddr=%.*s",
 				      space_strip_len(NVMF_TRADDR_SIZE, e->traddr),
 				      e->traddr);
-- 
2.13.7
openSUSE Build Service is sponsored by