git: 9c8be6518e2e - main - ctld: Fix namespace IDs for exported NVMe namespaces
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 08 Oct 2026 15:25:00 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=9c8be6518e2e5f396055ecdab8098ce19c4b2218
commit 9c8be6518e2e5f396055ecdab8098ce19c4b2218
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-10-08 15:24:45 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-10-08 15:24:45 +0000
ctld: Fix namespace IDs for exported NVMe namespaces
NVMe namespace IDs are 1-based, but CTL LUN IDs are 0-based. The
in-kernel NVMe ctl(4) target accounts for this by adding one to the
LUN ID to compute a namespace ID. ctld was attempting to handle this
by translating namespace IDs from config files to internal LUN IDs,
but it did this incorrectly resulting in the namespace configured for
as namespace N actually showing up as namespace N + 1.
Fixes: 66b5296f1b29 ("ctld: Add support for NVMe over Fabrics")
Sponsored by: Chelsio Communications
---
usr.sbin/ctld/nvmf.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr.sbin/ctld/nvmf.cc b/usr.sbin/ctld/nvmf.cc
index e1ecf8ccc552..a596d32d660c 100644
--- a/usr.sbin/ctld/nvmf.cc
+++ b/usr.sbin/ctld/nvmf.cc
@@ -371,8 +371,8 @@ nvmf_controller::add_namespace(u_int id, const char *lun_name)
return false;
}
- std::string lun_label = "namespace ID " + std::to_string(id - 1);
- return target::add_lun(id, lun_label.c_str(), lun_name);
+ std::string lun_label = "namespace ID " + std::to_string(id);
+ return target::add_lun(id - 1, lun_label.c_str(), lun_name);
}
bool