All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagi@grimberg.me>
To: linux-nvme@lists.infradead.org, Keith Busch <kbusch@kernel.org>
Subject: [PATCH 1/2] fabrics: ignore hostnqn file if its empty
Date: Wed, 12 Feb 2020 12:01:57 -0800	[thread overview]
Message-ID: <20200212200158.14237-1-sagi@grimberg.me> (raw)

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

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 fabrics.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fabrics.c b/fabrics.c
index 254a2be615ac..4b5c9669edc7 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -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"));
-- 
2.20.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

             reply	other threads:[~2020-02-12 20:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 20:01 Sagi Grimberg [this message]
2020-02-12 20:01 ` [PATCH 2/2] fabrics: set keep_alive_tmo also for discovery controllers Sagi Grimberg
2020-02-14 14:29 ` [PATCH 1/2] fabrics: ignore hostnqn file if its empty Keith Busch

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=20200212200158.14237-1-sagi@grimberg.me \
    --to=sagi@grimberg.me \
    --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 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.