As reported by Sitsofe Wheeler, the WRITE SAME commands with zero blocks are
only issued if WSNZ == 0. WSNZ == 0 means that zero in the NUMBER OF LOGICAL
BLOCKS field means that all logical blocks until the end are affected. In
other words, the original code was fine. Hence revert commit dfff7e9d16.
Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
This test checks regular sense/ascq values on miscompare as well as
the Information sense field, which should be set as follows:
sense key set to MISCOMPARE and the additional sense code set to
MISCOMPARE DURING VERIFY OPERATION. In the sense data (see 4.18 and
SPC-5) the offset from the start of the Data-Out Buffer to the first
byte of data that was not equal shall be reported in the INFORMATION
field.
Signed-off-by: David Disseldorp <ddiss@suse.de>
If device claims SBC-3 version in its version descriptors it won't be marked as SBC-3 compliant.
This commit adds checks for:
* SBC-3 T10/BSR INCITS 514 revision 35
* SBC-3 T10/BSR INCITS 514 revision 36
* SBC-3 ANSI INCITS 514-2014
After commit 10868c491d CmdSN tests no
longer work because iscsi->cmdsn is incremented during the second test
phase (sending "good" TUR after "bad" TUR), so the resulting CmdSN is
not ExpCmdSN, but ExpCmdSN + 1 that is not acknowledged by the target.
This commit fixes the issue by setting iscsi->cmdsn to iscsi->expcmdsn - 1.
Affected tests:
* iSCSI.iSCSIcmdsn.iSCSICmdSnTooLow
* iSCSI.iSCSIcmdsn.iSCSICmdSnTooHigh
In the test iSCSI.iSCSITMF.LUNResetSimpleAsync
CU_ASSERT_EQUAL(reconnect_succeeded, 1) must be called after the async
TMF command completes. Hence move that assert into the TMF completion
callback.
This patch fixes a race condition.
[bvanassche: edited commit message]
This attempts to reproduce upstream LIO reports of a use after free bug
when logout occurs alongside concurrent I/O.
Signed-off-by: David Disseldorp <ddiss@suse.de>
Since the NUMBER OF LOGICAL BLOCKS field in the COMPARE AND WRITE command
is an 8 bit field, the maximum value that can be encoded is 255.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Assign the NUMBER OF LOGICAL BLOCKS field in the COMPARE AND WRITE PDU
directly. Use the terminology from SBC-4, namely NUMBER OF LOGICAL BLOCKS
instead of TL.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Check for 0x0A descriptor support via SCSI_COPY_RESULTS_OP_PARAMS. If
supported, perform a 0x0A type XCOPY using target's
maximum_segment_length (or 256M if larger).
Signed-off-by: David Disseldorp <ddiss@suse.de>
Type 0x0A segment descriptors provide a 32-bit wide number-of-bytes
field, allowing for much larger copy offloads with a single segment
descriptor.
Signed-off-by: David Disseldorp <ddiss@suse.de>
The SPC4r37 specification defines XCOPY Segment Descriptor lengths for
each SD type. The spec defined SD lengths don't account for the four SD
header bytes. To make it easier to match the spec to the implementation,
use the spec defined lengths in get_desc_len() with a four byte SD
header addition.
Signed-off-by: David Disseldorp <ddiss@suse.de>
Declare dynamically allocated strings as 'char *' instead of 'const char *'.
Remove the discard_const() macro. Do not test whether or not a pointer is
NULL before calling free() because it is allowed to pass NULL to free().
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Since the test tool can't proceed in a meaningful way if the block size
is zero, give up if the SCSI target reports that the block size is zero.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Without this, linking fails on Fedora rawhide. Example:
...
/usr/bin/ld: test_async_lu_reset_simple.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:59: multiple definition of `param_list_len_err_ascqs'; iscsi-test-cu.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:59: first defined here
/usr/bin/ld: test_async_lu_reset_simple.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:58: multiple definition of `invalid_cdb_ascqs'; iscsi-test-cu.o:/root/libiscsi/libiscsi.git/test-tool/iscsi-support.h:58: first defined here
...
Signed-off-by: Cole Robinson <crobinso@redhat.com>
In my tests I hit a stack overflow caused by infinite recursion of
.queue_pdu() calls, caused by .queue_pdu() not being restored in an
error path. Make the approach for restoring .queue_pdu() more robust.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
iscsi_logout_sync in lu_reset_simple will still refer to wtask in the
case that we bail out due to reconnect failure.
abort_simple would sometimes refer to wtask during iscsi_logout_sync,
even if the test passed.
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
Since it is easy to trigger a stack overflow with variable-length arrays,
use dynamic memory allocation instead of VLAs. Add -Wvla to the compiler
options such that no new VLAs get introduced.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
The iSCSICHAP.Simple test ensures that CHAP_A comma separated lists
are correctly handled. iSCSICHAP.Invalid tests a range of invalid
CHAP_A parameters.
Signed-off-by: David Disseldorp <ddiss@suse.de>
For now this only changes iSCSIDataSnInvalid to use
iscsi_pdu_set_datasn() instead of scsi_set_uint32().
iSCSICmdSnTooHigh/Low changes should also be possible, as noted, but
haven't been converted yet.
Signed-off-by: David Disseldorp <ddiss@suse.de>
libiscsipriv.la exposes all symbols, so allows tests to perform low
level PDU manipulation, etc. without duplicating code.
As a trade-off, this results in a larger iscsi-test-cu, with libiscsi.so
linking removed.
Link: https://github.com/sahlberg/libiscsi/issues/297
Signed-off-by: David Disseldorp <ddiss@suse.de>
All users have now been changed to overload via the iscsi_ctx transport
callback, so the dlsym based overloading can now be dropped.
Signed-off-by: David Disseldorp <ddiss@suse.de>
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.
Signed-off-by: David Disseldorp <ddiss@suse.de>
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.
Signed-off-by: David Disseldorp <ddiss@suse.de>
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.
Signed-off-by: David Disseldorp <ddiss@suse.de>
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.
This commit also removes a number of unnecessary "WRITE10 is not
implemented" checks, which should all be caught by the first check.
Signed-off-by: David Disseldorp <ddiss@suse.de>
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.
Signed-off-by: David Disseldorp <ddiss@suse.de>
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert this test to use the regular transport driver
callback for this purpose.
Signed-off-by: David Disseldorp <ddiss@suse.de>
In preparation for removing the test-tool iscsi_queue_pdu() dlsym
overload hack, convert the Compare&Write InvalidDataOutSize test to use
the regular transport driver callback for this purpose.
Signed-off-by: David Disseldorp <ddiss@suse.de>