Skip to contentSkip to conversation

nvme: wwid_show: show uuid first if existed

PATCH New Guan Junxiong 2 participants 2 messages Jul 25, 2017 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: wwid_show: show uuid first if existed

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(+)
drivers/nvme/host/core.c +3 -0
index d70df1d..e609913 100644
@@ -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);
 
Signature · 1 line
2.6.4.windows.1
#1 lore raw

PATCH 1/1 nvme: wwid_show: show uuid first if existed

Quoted 3 lines · Guan Junxiong

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.

I've already sent a patch for this:
http://lists.infradead.org/pipermail/linux-nvme/2017-July/011905.html

@Christoph, did this miss the last pull to Jens?

Signature · 6 lines
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850