Skip to contentSkip to conversation

fabrics: ignore hostnqn file if its empty

PATCH In review Sagi Grimberg 2 participants 3 messages Feb 12, 2020 – Feb 14, 2020 NVMe

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/2 fabrics: ignore hostnqn file if its empty

If we read an empty string from /etc/nvme/hostnqn we should ignore it instead of passing an empty string to the driver resulting in the error:

nvme_fabrics: unknown parameter or missing value 'hostnqn=' in ctrl creation request

---
 fabrics.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fabrics.c +2 -1
index 254a2be615ac..4b5c9669edc7 100644
@@ -677,7 +677,8 @@ static char *hostnqn_read_file(void)
 	if (f == NULL)
 		return false;
 
-	if (fgets(hostnqn, sizeof(hostnqn), f) == NULL)
+	if (fgets(hostnqn, sizeof(hostnqn), f) == NULL ||
+	    !strlen(hostnqn))
 		goto out;
 
 	ret = strndup(hostnqn, strcspn(hostnqn, "\n"));
Signature · 7 lines
2.20.1


_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
author maintainer
#1 lore raw

PATCH 2/2 fabrics: set keep_alive_tmo also for discovery controllers

We may use persistent discovery connections on referrals so don't restrict it for discovery controllers.

---
 fabrics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fabrics.c +1 -1
index 4b5c9669edc7..14b453d00e87 100644
@@ -1000,7 +1000,7 @@ retry:
 		p += len;
 	}
 
-	if (cfg.keep_alive_tmo && !discover) {
+	if (cfg.keep_alive_tmo) {
 		len = sprintf(p, ",keep_alive_tmo=%d", cfg.keep_alive_tmo);
 		if (len < 0)
 			return -EINVAL;
Signature · 7 lines
2.20.1


_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
maintainer
#2 lore raw
In reply to Sagi Grimberg
Quoted 7 lines · Sagi Grimberg

If we read an empty string from /etc/nvme/hostnqn we should ignore it instead of passing an empty string to the driver resulting in the error:

nvme_fabrics: unknown parameter or missing value 'hostnqn=' in ctrl creation request

Thanks, both patches applied.

_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme