ctld segfaults after adding a large number of targets
I am using the REST API to create a large number of targets on FreeNAS 9.3. Once I hit the limit (CTL_MAX_PORTS = 256) ctld segfaults. This is caused by a NULL pointer dereference of oldtarg after kernel_port_add (which returns an error) gets called. This has already been fixed in FreeBSD master but has not been cherry picked into the TrueOS github repo.
#1 Updated by Alexander Motin over 5 years ago
- Status changed from Unscreened to Fix In Progress
Thank you for the notification. I've merged that and few more commits to the nightly branch and merge them to stable in few days.
That commit should probably fix ctld crash, but it still won't allow more then ~253 targets to be created. Do you need so many targets for some real purpose?
#2 Updated by Hans Woithe over 5 years ago
Thank you for following up.
Yes, there is a real purpose and need for this. In our system we can have many targets, some of them may be short lived. According to the FreeNAS user guide, there should be a 1:1 mapping of targets to extents. That would unfortunately limit us to ~253 simultaneous "mounts" across all of our servers. Imagine if each belongs to a jail that is doing some processing, like building a package. With 1:1 mapping you can easily get to ~253 targets.
#3 Updated by Alexander Motin over 5 years ago
"1:1 mapping of targets to extents" is not really a hard requirement, only an optimization, so that each extent/LUN has own independent iSCSI connection. CTL in present FreeNAS 9.3 supports up to 1024 extents/LUNs total, scattered over up to 253 targets, with up to 256 LUNs per target (the last limit is there only because many initiators don't support more then 256 LUNs per target). If your use scenario allows to have several LUNs per target, you may reach up to 1024 extents/LUNs.