this patch adds an non-RFC extenstion to the redirect login response which allows
a target to temporarily redirect not only to a different target address but also to
a different targetname.
This is needed to allow scenarious in active/active storage clusters where each
node had its own targetname, but maps the same volumes behind equal LUN ids.
For this non-RFC behaviour the environment variable LIBISCSI_ALLLOW_TARGETNAME_REDIRECT
has to be set.
Signed-off-by: Peter Lieven <pl@dlhnet.de>
this patch adds a read of VPD page 0x80 (unit serial number) after successful login.
The serial is then validated on secutive reconnects to avoid the accidental mismatch
of LUN ids if some kind of remapping appears between loss of connection and a later
reconnect.
An additional url parameter force_usn is added to enforce the usn right from the beginning.
If not set via url or the new iscsi_set_unit_serial_number function the usn is learned
at the first successful login.
Signed-off-by: Peter Lieven <pl@dlhnet.de>
Only show time stats if clock_gettime(3) is available.
It's actually possible to have clock_gettime(3) and not yet support
CLOCK_MONOTONIC on legacy systems, however on macOS, they all arrived
together in macOS 10.12. Rather than add new configure checks for
CLOCK_MONOTONIC, I opted to use the existing HAVE_CLOCK_GETTIME.
When queueing the first PDU to an idle socket, immediately try to write
it to the socket instead of waiting for the event-loop to
timeout/notice there is work to do.
Various other small bugfixes.
Signed-off-by: sahlberg <sahlberg@r10-0-1.rocky10.sahlberg>
Fixing a potential fall-through in switch in data unmarshal function
for maintenance-in commands. The fall-through never happens for valid
commands, but the build tools may complain about it.
Apple do not support spinlocks so we must remap to the much slower
mutexes instead if we think we are compiling for apple.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
After we have called iscsi_queue_pdu from iscsi_scsi_command_async
the pdu might have already completed if we are using multithreading
so we should not dereference pdu at that point.
Move the assignment of task->cmdsn and task->itt we need for
task management into iscsi_pdu_set_cmdsn instead.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
IF qe queue a new PDU to an empty outqueue then the mt service thread
will still be stuck in poll() until it timesout or the socket becomes
readable.
Fix this by sending SIGUSR1 to the service thread when we queue a PDU
to an empty queue. This will break out of poll() and we can immediately
go and write to the socket.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This is a tool to create multiple contexts and threads and run read operations on all
of them in a loop.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>