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>
wr_buf was hardcoded with blocksize 512, resulting in incorrect behavior
for larger block sizes, and buffer overflow. Use the block_size global.
Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
clear_pr() can be called before connect_scsi_device() has been invoked
on each MPIO sdev. This results in a NULL pointer dereference in the
send_scsi_command() MPIO NOP-responder code-path.
Fix this by invoking clear_pr() after the MPIO connect_scsi_device()
loop has run. clear_pr() also only needs to be invoked via a single
path, so do so via the first path only.
Link: https://github.com/sahlberg/libiscsi/issues/289
Fixes: 16435a9 ("iscsi-test-cu: Improve persistent reservation clearing")
Signed-off-by: David Disseldorp <ddiss@suse.de>
Clear persistent reservations before sending the first SCSI command to the
target to avoid that that command fails due to persistent reservations left
behind by a previous run of the test tool.
Avoid that a subsequent test fails if a test did not remove the persistent
reservations it obtained.
Make sure that clear_pr() returns -1 if clearing persistent reservations
fails.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
When target claim it support maximum writesame length to the total blocks number, when
we trigger 0blocks writesame opertion, we should expect it to be succeed instread of failure.
This test registers PR key and then sends a PR-In read-keys request with
an ALLOCATION LENGTH value that forces response truncation. Ensure that
the ADDITIONAL LENGTH is *not* modified as a result of the truncation.
This test currently passes against TGT but fails against LIO (fix
pending).
Signed-off-by: David Disseldorp <ddiss@suse.de>
Accepting an Allocation Length parameter allows us to test for
truncation of response data, as per SPC5r17 4.2.5.6:
The device server shall terminate transfers to the Data-In Buffer when
the number of bytes or blocks specified by the ALLOCATION LENGTH field
have been transferred or when all available data have been
transferred, whichever is less.
With this change, all existing prin_read_keys() callers continue to use
same ALLOCATION LENGTH value as earlier (16K).
Signed-off-by: David Disseldorp <ddiss@suse.de>
The helper function -2 return paths already print this message, so the
duplicate in the caller can be dropped.
Signed-off-by: David Disseldorp <ddiss@suse.de>
Make sure that the end-of-LUN test happens at the end of the LUN instead
of at the start of the LUN.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Since the argument num_blocks - i is passed as the LBA argument
to COMPAREANDWRITE(), avoid that a negative number is passed.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2e947cc1de added logic to check that
targets missing zero block writesame support return INVALID_FIELD_IN_CDB
to such requests. However, this change incorrectly set the writesame
number_of_logical_blocks field to one.
Signed-off-by: David Disseldorp <ddiss@suse.de>
<iscsi-url> parameter absent handled for SCSI devices.
* Verbose logging segfault fixed.
* For ioctl case, if reservation conflicts hits it is not considered as
test case failure.
Since the data in the read buffer is not valid if READ10() failed,
only compare the data in the read buffer if READ10() succeeded.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Using any of the CU_ASSERT macros after a test has finished causes
the test tool to abort. This patch adds an iSCSI logout to two tests
to avoid that the test tool aborts e.g. as follows:
==11578== Process terminating with default action of signal 6 (SIGABRT)
==11578== at 0x54BB77F: raise (raise.c:58)
==11578== by 0x54BD379: abort (abort.c:89)
==11578== by 0x54B3B46: __assert_fail_base (assert.c:92)
==11578== by 0x54B3BF1: __assert_fail (assert.c:101)
==11578== by 0x504213E: CU_assertImplementation (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1)
==11578== by 0x16FA36: test_async_abort_cb (test_async_abort_simple.c:67)
==11578== by 0x5274B82: iscsi_process_task_mgmt_reply (task_mgmt.c:100)
==11578== by 0x525E226: iscsi_process_pdu (pdu.c:598)
==11578== by 0x526F2AA: iscsi_read_from_socket (socket.c:677)
==11578== by 0x5270015: iscsi_tcp_service (socket.c:963)
==11578== by 0x52700A5: iscsi_service (socket.c:980)
==11578== by 0x52707E1: event_loop (sync.c:69)
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Avoid that the test tool crashes due to a NULL pointer dereference
if unmarshalling the Data-In buffer fails.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
We do need a default: arm here as the switch is not supposed to deal with
all possible values for the enum.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
From SBC-4: BYTCHK = 0 means that the Data-Out buffer contents
must not be used. BYTCHK = 1 means that the Data-Out buffer must
be compared against the data on the storage medium. Hence set
BYTCHK to 1 if EDTL != 0.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This patch avoids that Valgrind complains about the memset() call
that was used to initialize the array that it triggers an invalid
write.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
With SPC-4, the 0xE4 descriptor LU ID TYPE field should be ignored, and
the NUL bit is obsolete. Update the ValidTgtDescr accordingly.
Signed-off-by: David Disseldorp <ddiss@suse.de>
ExtendedCopy.DescrLimits currently attempts to test Maximum Descriptor
List Length bounds checking by issuing a request with
(max_target_desc_count + 1 + max_segment_desc_count + 1) descriptors.
Maximum Descriptor List Length is a separately advertised field, that
may not be exceeded with the above logic, e.g. LIO advertises:
- Max Target Desc Count = 2
- Max Segment Desc Count = 1
- Max Desc List Len = 1024
Calculate the number of descriptors using the advertised Maximum
Descriptor List Length value, to explicitly test bounds checking.
Signed-off-by: David Disseldorp <ddiss@suse.de>
We need to use iovectors for iSER to work as it requires that the vectors
are attached to the task before we queue the task.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Dispatch a write and subsequently reset the logical unit via iSCSI TMF.
This is based on the AbortTaskSimpleAsync test.
Signed-off-by: David Disseldorp <ddiss@suse.de>