git: 033c0cd3e89b - stable/15 - ctld: Fix namespace IDs for exported NVMe namespaces
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 19 Nov 2026 15:42:40 UTC
The branch stable/15 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=033c0cd3e89ba87f3d66ceea6436cf2a37148051
commit 033c0cd3e89ba87f3d66ceea6436cf2a37148051
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-10-08 15:24:45 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-11-19 15:42:20 +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
(cherry picked from commit 9c8be6518e2e5f396055ecdab8098ce19c4b2218)
---
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