- Add support to use /dev/* nodes instead of just iscsi devices.
- Create a dedicated test for the FUA/DPO flags
- Allow reusing the context after disconnect
- Fix non-randomness in rand_key()
- Add iscsi-perf tool
- Fix length bug when sending unsolicited data in iscsi_command
- Reqrite the reconnect logic to begome fully async
- Fix wrong checks for username in CHAP
- Support Bidirectional CHAP
- Improve handling of IMMEDIATE bit
- Cmdsn, statsn fixes+
- iscsi_which_events can return 0, which means that there are no events right
now but try again in a second or so.
- Ignore any ASYNC EVENTS we receive since we can not yet pass them back to
the application.
- Add initial make test support
- Various minor fixes to libiscsi and the test suite
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
if the freelist gets full we are likely in a low load situation so
we do not need to make all the work copying the pointers.
Signed-off-by: Peter Lieven <pl@kamp.de>
this variable was introduced for iscsi-test-cu only. This patch
makes it a generic environment variable that can be set per context.
Signed-off-by: Peter Lieven <pl@kamp.de>
the original idea of writing to the socket before reading was to put data
on the wire as early as possible and avoid potential latency increase due
to long taking callbacks invoked in iscsi_read_from_socket.
Benchmarking with libiscsi userland tools have shown that changing the
order increases throughput by about 5%.
The reason is that during POLLIN we might receive an updated MaxCmdSN
which might us allow to send new data out during POLLOUT.
For Qemu the change doesn't matter since POLLIN and POLLOUT are processed
independently.
Signed-off-by: Peter Lieven <pl@kamp.de>
this variable is a helper to tell libiscsi to not reset the nops_in_flight
on receival of a NOP-Out if the oldest element in the waitpdu queue is
not changed since the last NOP-Out.
The idea is that we can detect a command that the target silently dropped
by this mechanism and run into a NOP timeout forcing a reconnect.
This environment variable is not suitable if a command is send that is taking more than
the allowed timeout for a NOP-Out as a reply to a initiator generated NOP-In
(or several NOP-Outs if more than 1 in flight is allowed).
Signed-off-by: Peter Lieven <pl@kamp.de>
Extend struct scsi_sense with sense specific descriptor information,
introduce the function scsi_parse_sense_data() and let that function
parse the sense specific descriptor.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Before b152d26 it was possible to set iscsi->reconnect_max_retries to 0.
This allowed reconnects, but aborted as soon as the reconnect failed.
The same behaviour is currenltly only possible by setting iscsi->reconnect_max_retries
to 1. iscsi->reconnect_max_retries == 0 forbids reconnecting completly.
Signed-off-by: Peter Lieven <pl@kamp.de>
iscsi_realloc MUST NOT be called with a pointer that is in the freelist
of small allocations. First they are free and secondly a realloc
will change the size of the small allocation to an unknown size.
This reverts commit d8de6531f8.
Disable memory caching in libiscsi if the environment variable
LIBISCSI_CACHE_ALLOCATIONS has been set to zero. This makes
Valgrind reports more meaningful.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This patch improves the stability of libiscsi by avoiding that
stale pointers are passed to free().
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
the check was not quite correct. iscsi->pending_reconnect can be true but
we are still connected (and thus can disconnect). This is the case when
we receive an async logout request.
Signed-off-by: Peter Lieven <pl@kamp.de>
if reconnect is disabled then a failure in iscsi_service_reconnect_if_loggedin
can leak back to the application by iscsi_service returning an error
but the error string is not being updated.
Thus the applucation will print the last prevous error message that was set.
Change iscsi_service_reconnect_if_loggedin to print a less confusing
error message.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
If we are reconnecting and the connection is already established we
end up looping forever if there is a socket error before we finish
the login process. Fix this by invoking the reconnect callback if
there is an error and no new reconnect is scheduled.
Signed-off-by: Peter Lieven <pl@kamp.de>
those are part of the login process to consume UNIT_ATTENTIONS.
Its questionable if we should consume them at all, but iff we change
that behaviour we should do it for the initial login as well as
for a reconnect.
Signed-off-by: Peter Lieven <pl@kamp.de>
Just ignore any iSCSI AsyncMsg / SCSI Async Events we receive instead of
reconnecting. We can't pass the data back to the application anyway
with the current API.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
this is meant as a hint that there can be no event at the moment
and in this special case iscsi_service will return immediately.
We use this at the moment in the case of a wait for a reconnect
in which case we would enter a busy loop waiting for that
reconnect. The 0 means do not poll for the client application.
Do not poll, just wait a little (a few hundred ms) and call iscsi_which_events
again. The wait should be timer driven or at least non busy looping,
of course.
Signed-off-by: Peter Lieven <pl@kamp.de>
RFC3720 10.13.4. states that the statsn should explicitly set with
the first Login Repsonse. In theory the target could choose a StatSN
that is not greater than iscsi->statsn (zero at start) in Serial32
arithmetic.
Signed-off-by: Peter Lieven <pl@kamp.de>
RFC3720 10.19. NOP-In
NOP-In is either sent by a target as a response to a NOP-Out, as a
"ping" to an initiator, or as a means to carry a changed ExpCmdSN
and/or MaxCmdSN if another PDU will not be available for a long time
(as determined by the target).
...
Signed-off-by: Peter Lieven <pl@kamp.de>
originally NOPs where used to detect failures in the transport
layer. This is e.g. implemented in qemu since a few years now.
Recently I found a few vServers with hanging I/O where
the NOP mechanism could not detect the error.
The reason is most likely due to a bug in the target,
however if NOPs increase the CmdSN this could help
to detect such failures. If there are requests hanging
and the OS stops I/O before CmdSN > MaxCmdSN we can currently
send NOPs forever and they might still be answered. If
a NOP increases the CmdSN we will enter a point where CmdSN
is greater than MaxCmdSN. This is, of course, not the ideal check,
but it might detect some types of errors. Ideally we would
send out a Test-Unit-Ready command with attr=ordered, but
that requires a new API and/or modification of the tool
that uses libiscsi. This here comes with no modification for
the userspace.
Signed-off-by: Peter Lieven <pl@kamp.de>