- 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>
check_lun_is_wiped() verifies whether the 256 blocks following LBA
'lba' contain byte value 'c'. Modify the log messages such that these
refer to byte value 'c' instead of to zero. Change the argument type
of 'c' from char into unsigned char to avoid that 'c' is sign
extended in the log statements.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
The test_report_supported_opcodes_one_command() sends SCSI commands
to the target for which the target has to reply with ILLEGAL REQUEST
/ INVALID FIELD IN CDB. Avoid that such a reply is misinterpret as
"command not supported" by checking the field offset in the sense
descriptor. See also patch "test tool: Detect unsupported opcodes
correctly" (commit ID fe9620092c).
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
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>
Initialize the buffer with data from the medium to avoid to
trigger a miscompare and double the compareandwrite() xferlen
argument.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
The test:
"Test WRITESAME16 of 1-256 blocks at the end of the LUN by setting
number-of-blocks==0"
was passing 0 for the data length instead of the block count.
Signed-off-by: Chris Zankel <chris@zankel.net>
Some targets only support a single descriptor for unmap operations,
so skip (CU_PASS) the test cases that use multiple descriptors in
those cases. Only run the tests if maximum_unmap_block_descriptor_count
is less than 2.
Also the test
"Test UNMAP of 0 blocks at LBA:0-255 with one descriptor per block")
was passing one less descriptor.
Signed-off-by: Chris Zankel <chris@zankel.net>
Skip 0-block WRITE SAME tests for targets that don't support these
operations, ie. they have write_same_no_zero (WSNZ) set in the
block limits vpd.
Also, fix the test:
"Test WRITESAME10 of 1-256 blocks at the end of the LUN by setting
number-of-blocks==0"
to actually pass 0 blocks instead of the number of remaining blocks to the end.
Signed-off-by: Chris Zankel <chris@zankel.net>
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>
RFC 3720 is not clear about whether a target should return SUCCESS
or CHECK CONDITION if SPDTL > EDTL. Hence accept both. See also
Fred Knight, Re: [Ips] Data Out residual overflow/underflow handling,
IETF mailing list archive, 21 September 2012
(http://www.ietf.org/mail-archive/web/ips/current/msg02756.html).
This patch reworks the changes introduced via commit
cfce944b35 and applies similar changes
to the other WRITE and WRITE VERIFY tests.
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>
When scanning for the CONTROL mode page we must also check that SPF==0
since otherwise we might pick up CONTROL EXTENSIONS or other subpages
that may be returned.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
I didn't set up the transfer length properly for the vectored SG_IO
support in the previous patch, which makes some implementations
of the ioctl unhappy. Fix this up per the spec.
Command like PERSISTENT RESERVE OUT fill out DATA OUT data in their
CDB setup routine, but the SG_IO code doesn't look at that, leading
to a segfault when issueing such commands. Fix this by copying over
some code from the iSCSI path.
Signed-off-by: Christoph Hellwig <hch@lst.de>
We support SG_IO on various block devices, including but not limited to:
SCSI disks, CDROMs and tapes, virtio-blk and nvmve.
Instead of checking a filename prefix just treat anything that isn't
an iscsi:// url as a device node. The ioctl checks after open will weed
out devices (or files) that don't support SG_IO.
Signed-off-by: Christoph Hellwig <hch@lst.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>
Avoid that building libiscsi on a RHEL 5 system fails as follows:
configure.ac:7: error: possibly undefined macro: AM_SILENT_RULES
Avoid that the following warning is printed when building on a RHEL 5
system:
examples/Makefile.am:24: Libtool library used but `LIBTOOL' is undefined
examples/Makefile.am:24:
examples/Makefile.am:24: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
examples/Makefile.am:24: to `configure.ac' and run `aclocal' and `autoconf' again.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Avoid that autoconf prints the following warning if AM_PROG_AR
is not defined:
configure.ac:9: warning: macro `AM_PROG_AR' not found in library
See also commits 1deb4f8e4a, ace7f200fb, b9cf7e8cd2 and
6cdb47b9b4.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>