mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liguang Zhang <zhangliguang@linux.alibaba.com>
To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	Liguang Zhang <zhangliguang@linux.alibaba.com>
Subject: [PATCH] nvme: duplicate NQNs check if devices needed
Date: Mon, 29 Nov 2021 19:18:54 +0800	[thread overview]
Message-ID: <20211129111854.44006-1-zhangliguang@linux.alibaba.com> (raw)

If a device provides an NQN it is expected to be globally unique.
Unfortunately some firmware revisions for Intel P4500/P4510 and some
other old devices did not satisfy this requirement. If devices have the
same subnqn field, after a kernel upgrade from 4.19 to 5.10, if a system
has >1 affected device then only one device is enabled. Error like this:

nvme nvme2: Duplicate cntlid 0 with nvme0, rejecting
nvme nvme3: Duplicate cntlid 1 with nvme1, rejecting

In these circumstances, if subnqn did not begin with "nqn.", we assume
that devices did not need subnqn check.

Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 4c63564adeaa..80abb4526932 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2587,6 +2587,9 @@ static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn)
 
 	lockdep_assert_held(&nvme_subsystems_lock);
 
+	if (strncmp(subsysnqn, "nqn.", 4))
+		return NULL;
+
 	/*
 	 * Fail matches for discovery subsystems. This results
 	 * in each discovery controller bound to a unique subsystem.
-- 
2.19.1.6.gb485710b


             reply	other threads:[~2021-11-29 11:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 11:18 Liguang Zhang [this message]
2021-11-29 16:34 ` Keith Busch
2021-11-29 18:48   ` Chaitanya Kulkarni
2021-11-30  5:04   ` luanshi
2021-11-30  6:40     ` Christoph Hellwig
2021-11-30  6:58       ` luanshi

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=20211129111854.44006-1-zhangliguang@linux.alibaba.com \
    --to=zhangliguang@linux.alibaba.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®