Commit Graph

2061 Commits

Author SHA1 Message Date
Bart Van Assche
18de10174b test-tool/test_compareandwrite_simple(): Fix end-of-LUN test
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>
2018-03-02 14:02:22 -08:00
Bart Van Assche
8f468b14fc test-tool/test_compareandwrite_*: Stop at end of medium
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>
2018-03-02 14:02:18 -08:00
Bart Van Assche
fee9eb9423 test-tool/test_async_lu_reset_simple: Continue upon reconnect error
Instead of stopping all tests if a reconnect fails, only stop
test_async_lu_reset_simple.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:18 -08:00
Bart Van Assche
ba8cac6b05 test-tool, check_result(): Make failure output more informative
If a SCSI command fails, report the SCSI status code.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:18 -08:00
Bart Van Assche
3cd40965a0 libiscsi: Port to gcc 7
Avoid that building with gcc 7 fails as follows:

iscsi-dd.c: In function 'cscd_ident_inq':
iscsi-dd.c:405:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
     if (prev_type <= desig->designator_type) {
        ^
iscsi-dd.c:409:4: note: here
    default:
    ^~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:18 -08:00
Ronnie Sahlberg
7e459df828 Add iscsi_set_no_autoreconnect to the def and syms files
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-06 07:44:44 +10:00
Ronnie Sahlberg
0b5842f2c4 Merge pull request #256 from crawfxrd/no-auto-reconnect
Make iscsi_set_noautoreconnect public
2018-01-06 07:43:08 +10:00
Ronnie Sahlberg
fb498c9435 Merge pull request #258 from ddiss/fix_ws_0blk_unmap
test_writesame_unmap_until_end: fix unsupported fallback
2018-01-05 08:57:53 +10:00
Ronnie Sahlberg
fd6957736f Merge pull request #257 from avagin/opt
examples/iscsi-dd: parse the -x option
2018-01-05 08:37:15 +10:00
David Disseldorp
dc0c3c76c0 test_writesame_unmap_until_end: fix unsupported fallback
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>
2017-12-20 17:54:18 +01:00
Andrei Vagin
07d03d5046 examples/iscsi-dd: parse the -x option
Signed-off-by: Andrei Vagin <avagin@openvz.org>
2017-12-15 03:45:00 +03:00
Tim Crawford
32cfd3c2f8 Make iscsi_set_noautoreconnect public
In our use at Datto, we have come across several issues related to the
automatic reconnect logic (mainly its interaction with POLLHUP). This
allows us to disable the functionality, at the expense of writing our
own reconnect logic.

Related: #241
2017-12-13 16:24:20 -05:00
Ronnie Sahlberg
aa617d1e5e Merge pull request #254 from franciozzy/master
PDU cancellation fixes for sync connect calls
2017-12-06 10:49:37 +10:00
Ronnie Sahlberg
b3bc7b022e Merge pull request #253 from crawfxrd/windows-fixes
Fix compilation with VS2017
2017-11-30 09:52:40 +10:00
Tim Crawford
aba0f7da1a Replace WIN32 with _WIN32
Using WIN32 depends on the build environment defining the variable.
_WIN32 is a predefined MSVC macro and is always available.

Signed-off-by: Tim Crawford <crawfxrd@gmail.com>
2017-11-29 10:07:44 -05:00
Tim Crawford
cdb437c545 Fix compilation with VS2017
The primary issue is that in MSVC 14.00 (VS2015) Microsoft added
snprintf as a function to the standard library and prevents users from
defining it to something else (typically, this was _snprintf). So, only
define it when using _MSC_VER < 1900.

Other changes are:
- Fix macro definition of dup2
- Add macro for getpid
- Add function definition for win32_dup
- Add missing EXTERNs

Signed-off-by: Tim Crawford <crawfxrd@gmail.com>
2017-11-29 10:07:44 -05:00
Felipe Franciosi
25eb87c7ee sync: cancel pending pdus on error
The set of sync connect calls use a stack variable to track the
connection status. This is ok because such calls block on event_poll()
until the connection is established. However, event_poll may return
early in case of errors (or timeout) while PDUs are still queued on the
context (and pointing to a local stack).

This cancels any pending PDUs before returning from sync connect calls.

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2017-11-25 17:12:38 +00:00
Felipe Franciosi
3c4925e8da pdu: Introduce iscsi_cancel_pdus()
Introduce a helper exported from lib/pdu.c which cancels all pdus for a
given context. This patch eliminates repeated code from various other
files which have the same purpose. The only functional difference is
that the cancellation done from iscsi-command.c was (incorrectly) not
checking for iscsi->is_loggedin before issuing callbacks.

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2017-11-25 17:03:01 +00:00
Felipe Franciosi
5aafc29991 lib/pdu.c: Fix whitespace formatting
iscsi_queue_pdu used whitespaces for identation while the rest of the
file uses hard tabs.
2017-11-25 16:46:57 +00:00
Felipe Franciosi
28d0db9c96 lib/pdu.c: clean up empty lines
Remove some extra empty lines between functions.

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2017-11-25 16:44:30 +00:00
Sushil
0593ac20de 251_SCSI Executing with SCSI device only (no ISCSI URL) ProutRegister test case failed
<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.
2017-11-09 06:15:06 +10:00
Ronnie Sahlberg
f9d54c5e45 Merge branch 'master' of github.com:sahlberg/libiscsi 2017-06-14 08:25:58 -07:00
Ronnie Sahlberg
446a0f5d2f WIN32: Make dup2 a NO-OP under win32.
There is something wrong with dup2 under win32 and I do not know win32
well enough to fix it, thus this workaround.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-14 08:25:39 -07:00
Ronnie Sahlberg
64ffae4062 WIN32: Use send/recv instead of read/write
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-14 08:25:38 -07:00
Bart Van Assche
e5296920e9 test_multipathio_simple: Only compare if READ10 succeeded
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>
2017-06-14 08:25:38 -07:00
Bart Van Assche
0241fe8014 test_extended_copy_simple: Limit transfer size to half of the capacity
This avoids that the test fails for LUNs with less than 2048 blocks.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-14 08:25:38 -07:00
Bart Van Assche
1af120d2c3 test_extended_copy_simple: Fix buffer comparison code
Compare the buffers in their entirety instead of only a prefix of
the buffers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-14 08:25:38 -07:00
Bart Van Assche
e866dc36e0 test_async_*_simple: Fix a CUnit assertion failure
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>
2017-06-14 08:25:38 -07:00
Bart Van Assche
4591a82209 test_report_supported_opcodes_rctd: Fix a NULL pointer dereference
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>
2017-06-14 08:25:38 -07:00
Ronnie Sahlberg
cd32003a26 Merge pull request #249 from bvanassche/master
Five bug fixes for the iSCSI conformance test tool
2017-06-14 07:47:06 -07:00
Ronnie Sahlberg
6d6cb515fb Update the documentation for the --debug flag to iscsi-ls
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-03 11:36:04 -07:00
Ronnie Sahlberg
fb45f0343e Fix another compiler warning
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>
2017-06-03 11:33:51 -07:00
Ronnie Sahlberg
854e37aab7 Fix compiler warning/error under gcc7
Gcc7 complains about falling through from the previous case to the default arm

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-06-03 11:20:20 -07:00
Bart Van Assche
494bddc660 test_multipathio_simple: Only compare if READ10 succeeded
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>
2017-06-02 16:44:32 -07:00
Bart Van Assche
6332c5e3d1 test_extended_copy_simple: Limit transfer size to half of the capacity
This avoids that the test fails for LUNs with less than 2048 blocks.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-02 16:44:32 -07:00
Bart Van Assche
7658e5f0a5 test_extended_copy_simple: Fix buffer comparison code
Compare the buffers in their entirety instead of only a prefix of
the buffers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-06-02 16:44:31 -07:00
Bart Van Assche
cba570408e test_async_*_simple: Fix a CUnit assertion failure
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>
2017-06-02 16:44:31 -07:00
Bart Van Assche
1971294017 test_report_supported_opcodes_rctd: Fix a NULL pointer dereference
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>
2017-06-02 16:44:31 -07:00
Ronnie Sahlberg
12222077cc Add project file for iscsi-ls and make it build under visual studio
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-13 12:09:42 -07:00
Ronnie Sahlberg
bfd5bd944a Merge branch 'master' of github.com:sahlberg/libiscsi 2017-05-11 21:19:25 -07:00
Ronnie Sahlberg
f750101980 Add initial visual studio project files and fix the win32 build
Win32 has been rotting for a while. This patch adds vs17 build files
as well as fixing up all build errors that have accumulated.
There are still build warnings but those can be addressed in a followup
patch.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-11 21:19:14 -07:00
Ronnie Sahlberg
86fd53581e Merge pull request #244 from bvanassche/master
test tool: Set BYTCHK=1 if EDTL != 0
2017-05-03 15:31:55 -07:00
Bart Van Assche
7c10722449 test tool: Set BYTCHK=1 if EDTL != 0
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>
2017-03-20 12:15:44 -04:00
Ronnie Sahlberg
383e6572d4 Use srcdir to find the includes for the build
From Yuri Stotski <Yuri.Stotski@dell.com>
We need to include files relative to srcdir or else they can not be found
when building from a different directory.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-02-17 21:41:26 -08:00
Ronnie Sahlberg
cd0dcb5dae Make iscsi-ls default to HeaderDigest=None for its discovery session
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-02-17 18:18:08 -08:00
Ronnie Sahlberg
b1003dc75a Add URL arguments to enable/disable header digest
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-02-17 17:58:19 -08:00
Ronnie Sahlberg
a1cbd8a2ce Merge pull request #237 from bvanassche/master
Three libiscsi fixes
2017-02-05 07:41:12 -08:00
Bart Van Assche
71c797fd1c test-tool: Fix a segmentation fault in test_receive_copy_results_op_params()
Do not access the RECEIVE_COPY_RESULTS() output if this operation
failed.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-01-23 10:55:53 -08:00
Bart Van Assche
9df32565a6 test-tool/test_async_read.c: Allocate large arrays dynamically
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>
2017-01-23 10:55:53 -08:00
Bart Van Assche
38e6ab7582 Spelling fix: incase -> in case
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
2017-01-23 10:55:53 -08:00