Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: wwid_show: show uuid first if existed
@ 2017-07-25 13:28 Guan Junxiong
  2017-07-25 14:04 ` Johannes Thumshirn
  0 siblings, 1 reply; 2+ messages in thread
From: Guan Junxiong @ 2017-07-25 13:28 UTC (permalink / 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-25 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-25 13:28 [PATCH] nvme: wwid_show: show uuid first if existed Guan Junxiong
2017-07-25 14:04 ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox