git: 109acce70328 - releng/15.2 - ctld: Fix namespace IDs for exported NVMe namespaces part 2

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Thu, 19 Nov 2026 16:05:00 UTC
The branch releng/15.2 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=109acce7032852556feba5b15c5b623355a9823f

commit 109acce7032852556feba5b15c5b623355a9823f
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-11-12 15:43:55 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-11-19 16:04:33 +0000

    ctld: Fix namespace IDs for exported NVMe namespaces part 2
    
    This is the same fix as in commit
    9c8be6518e2e5f396055ecdab8098ce19c4b2218 just applied to another
    method that also accepts namespace IDs.  The original commit handled
    configuration statements assigning a named LUN to a namespace.  This
    change handles anonymous namespaces configured within a controller
    context.
    
    Approved by:    re (cperciva)
    Fixes:          66b5296f1b29 ("ctld: Add support for NVMe over Fabrics")
    Sponsored by:   Chelsio Communications
    (cherry picked from commit 9a99fa3932ddd794234becc6eab6519d56ae6947)
    (cherry picked from commit 469ac5a9c05f21526f81cb34833bfff53b07a7d5)
---
 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 a596d32d660c..689c3404af1a 100644
--- a/usr.sbin/ctld/nvmf.cc
+++ b/usr.sbin/ctld/nvmf.cc
@@ -413,9 +413,9 @@ nvmf_controller::start_namespace(u_int id)
 		return nullptr;
 	}
 
-	std::string lun_label = "namespace ID " + std::to_string(id - 1);
+	std::string lun_label = "namespace ID " + std::to_string(id);
 	std::string lun_name = freebsd::stringf("%s,nsid,%u", name(), id);
-	return target::start_lun(id, lun_label.c_str(), lun_name.c_str());
+	return target::start_lun(id - 1, lun_label.c_str(), lun_name.c_str());
 }
 
 struct portal_group *