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>
These tests depends on not yet released version on TGTD to allow running
both TGTD and TGTADM as unprivileged users to set up and configure
targets to test against during make test.
Update TGTD to tip of master before running these tests.
See STGT mailinglist for patches.
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>
Avoid that Valgrind reports complaints similar to the following:
Syscall param writev(vector[...]) points to uninitialised byte(s)
at 0x5567087: writev (writev.c:49)
by 0x5265AE0: iscsi_iovector_readv_writev (socket.c:492)
by 0x52666B5: iscsi_write_to_socket (socket.c:710)
by 0x5266CCC: iscsi_service (socket.c:852)
by 0x526751F: event_loop (sync.c:67)
by 0x5269B41: iscsi_scsi_command_sync (sync.c:1153)
by 0x4050F6: send_scsi_command (iscsi-support.c:245)
by 0x408007: compareandwrite (iscsi-support.c:1512)
by 0x40B6AD: test_compareandwrite_dpofua (test_compareandwrite_dpofua.c:69)
by 0x503EC99: ??? (in /usr/lib/libcunit.so.1.0.1)
by 0x503EF27: ??? (in /usr/lib/libcunit.so.1.0.1)
by 0x503F2A5: CU_run_all_tests (in /usr/lib/libcunit.so.1.0.1)
Address 0xffeffff10 is on thread 1's stack
in frame #8, created by test_compareandwrite_dpofua (test_compareandwrite_dpofua.c:30)
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Avoid that the DPO / DPOFUA tests triggers a NULL pointer dereference
if the MODE SENSE command in these tests fails.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Avoid that Valgrind reports complaints similar to the following:
Conditional jump or move depends on uninitialised value(s)
at 0x405097: send_scsi_command (iscsi-support.c:240)
by 0x40904B: reserve6_conflict (iscsi-support.c:1915)
by 0x42231C: test_reserve6_logout (test_reserve6_logout.c:63)
by 0x503EC99: ??? (in /usr/lib/libcunit.so.1.0.1)
by 0x503EF27: ??? (in /usr/lib/libcunit.so.1.0.1)
by 0x503F2A5: CU_run_all_tests (in /usr/lib/libcunit.so.1.0.1)
by 0x404B43: main (iscsi-test-cu.c:1292)
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
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>
While running the test tool I noticed that a significant number
of CPU cycles was spent in test_writesame10_unmap(). Rewrite the
comparison loop such that it needs fewer CPU cycles. Use the same
comparison code in test_writesame16_unmap().
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
this adds a switch to define max_reconnects instead of just aborting
after a NOP timeout. It is now also possible to force an exit
if CTRL-C is pressed twice.
Signed-off-by: Peter Lieven <pl@kamp.de>
This allows all tests to properly work on /dev/sg nodes instead
of segfaulting when a test is written the iSCSI-specific APIs.
Signed-off-by: Christoph Hellwig <hch@lst.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>