From: guanjunxiong@huawei.com (Guan Junxiong)
Subject: [PATCH] nvme: wwid_show: show uuid first if existed
Date: Tue, 25 Jul 2017 21:28:26 +0800 [thread overview]
Message-ID: <1500989306-18460-1-git-send-email-guanjunxiong@huawei.com> (raw)
The NGUID/EUI64 is not universal unique because a controller may reuse a non-zero NGUID
or EUI64 value for a new namespace after the original namespace using the value has been
deleted. Therefore, UUID of a namescpace prevails over NGUID/EUI64 for showing wwid.
Signed-off-by: Guan Junxiong <guanjunxiong at huawei.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 d70df1d..e609913 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1995,6 +1995,9 @@ static ssize_t wwid_show(struct device *dev, struct device_attribute *attr,
int serial_len = sizeof(ctrl->serial);
int model_len = sizeof(ctrl->model);
+ if (memchr_inv(ns->uuid, 0, sizeof(ns->uuid)))
+ return sprintf(buf, "uuid.%16phN\n", ns->uuid);
+
if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid)))
return sprintf(buf, "eui.%16phN\n", ns->nguid);
--
2.6.4.windows.1
next reply other threads:[~2017-07-25 13:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-25 13:28 Guan Junxiong [this message]
2017-07-25 14:04 ` [PATCH] nvme: wwid_show: show uuid first if existed Johannes Thumshirn
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=1500989306-18460-1-git-send-email-guanjunxiong@huawei.com \
--to=guanjunxiong@huawei.com \
/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