# 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,