# fgrep -B 2 10G /etc/ctl.conf lun 0 { blocksize 8192 size 10G # ctladm devlist LUN Backend Size (Blocks) BS Serial Number Device ID 0 block 262144 8192 MYSERIAL 0 MYDEVID 0 A guess, but by the looks of it, the value here is I'm guessing -1. Probably a return value from within the expand_number (-lutil) function or something along those lines.
One last comment. I added debugging information to track the lun length value and this is what I ended up with: DEBUG:: in parse.y line 1034: 10737418240 DEBUG:: in ctld.c line 1501: 2147483648 DEBUG:: in ctld.c line 1503: 2147483648 DEBUG:: in parse.y line 1036: 10737418240 I'll do more debugging as time permits.
sizeof(size_t) == 4 sizeof(uint64_t) == 8 The cast from uint64_t to size_t is killing the value. This small patch fixes the problem, though I'm not sure what ill effects this may have. diff -ur ctld.orig ctld diff -ur ctld.orig/ctld.c ctld/ctld.c --- ctld.orig/ctld.c 2016-11-27 22:12:27.525990000 -0500 +++ ctld/ctld.c 2016-11-27 22:09:25.798040000 -0500 @@ -1496,7 +1496,7 @@ } void -lun_set_size(struct lun *lun, size_t value) +lun_set_size(struct lun *lun, uint64_t value) { lun->l_size = value; } Only in ctld.orig: ctld.c.orig diff -ur ctld.orig/ctld.h ctld/ctld.h --- ctld.orig/ctld.h 2016-11-27 22:12:16.851553000 -0500 +++ ctld/ctld.h 2016-11-27 22:10:31.732258000 -0500 @@ -388,7 +388,7 @@ void lun_set_path(struct lun *lun, const char *value); void lun_set_scsiname(struct lun *lun, const char *value); void lun_set_serial(struct lun *lun, const char *value); -void lun_set_size(struct lun *lun, size_t value); +void lun_set_size(struct lun *lun, uint64_t value); void lun_set_ctl_lun(struct lun *lun, uint32_t value); struct option *option_new(struct options *os,
*** Bug 279684 has been marked as a duplicate of this bug. ***
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f26fe2c6669d56621ac85f5279aa85503cbf59bc commit f26fe2c6669d56621ac85f5279aa85503cbf59bc Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2025-01-17 17:36:08 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2025-01-17 21:43:09 +0000 ctld: correctly parse LUN size on 32-bit arches Disk offset values must always be 64-bit, not size_t. PR: 214874 Submitted by: pprocacci@gmail.com MFC after: 2 weeks Event: January 2025 Bug-busting session usr.sbin/ctld/ctld.c | 2 +- usr.sbin/ctld/ctld.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)