* [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
* [PATCH] nvme: wwid_show: show uuid first if existed
2017-07-25 13:28 [PATCH] nvme: wwid_show: show uuid first if existed Guan Junxiong
@ 2017-07-25 14:04 ` Johannes Thumshirn
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Thumshirn @ 2017-07-25 14:04 UTC (permalink / raw)
On Tue, Jul 25, 2017@09:28:26PM +0800, Guan Junxiong wrote:
> 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?
--
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
^ permalink raw reply [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