Skip to content

tree: read namespace UUID from the typed WWID - #1152

Merged
igaw merged 1 commit into
linux-nvme:masterfrom
ooonea:fix/namespace-uuid-wwid
Oct 14, 2026
Merged

igaw merged 1 commit into
linux-nvme:masterfrom
ooonea:fix/namespace-uuid-wwid

Conversation

@ooonea

@ooonea ooonea commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

The namespace uuid sysfs attribute falls back to the NGUID when no UUID is available. Consequently, nvme_ns_get_uuid() can return an NGUID as a UUID, and reading that compatibility attribute triggers a kernel warning.

Decode the UUID from the uuid. form of wwid instead. Linux v4.15 already prioritizes a real UUID in wwid, matching libnvme's minimum supported kernel. NGUID, EUI-64, vendor-specific and missing WWIDs leave the UUID empty; the independent NGUID attribute remains unchanged. This is separate from the string-decoding correction in #1115.

Validated against the upstream Meson suite: 43 passes, two expected failures and zero failures. Synthetic UUID, NGUID, EUI-64, vendor, missing and malformed WWID cases passed, including the pre-6.8 Identify path with a mocked command. A 1.16.1 backport including #1115 kept both real local namespaces visible and preserved their NGUIDs; syscall tracing confirmed no legacy uuid reads or NVMe device-node access. The full CI matrix was not run.

Fixes #1151.

AI disclosure: OpenAI Codex assisted the investigation, implementation, test scripts and this description.

The sysfs uuid attribute returns the NGUID when no UUID is available,
so nvme_ns_get_uuid() can report an NGUID as a UUID. The kernel also
warns when this compatibility fallback is read.

Read wwid instead and decode only its uuid. form. The kernel has preferred
the UUID in this attribute since before libnvme's minimum Linux v4.15,
and the existing nguid attribute continues to provide the NGUID.

Signed-off-by: ooonea <35407790+ooonea@users.noreply.github.com>
Assisted-by: OpenAI Codex
@igaw
igaw merged commit d2767df into linux-nvme:master Oct 14, 2026
11 of 12 checks passed
@igaw

igaw commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks!

We need a similar fix in nvme-cli 3 as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nvme_ns_get_uuid() reports an NGUID when a namespace has no UUID

2 participants