Commit Graph

1334 Commits

Author SHA1 Message Date
Ronnie Sahlberg
aedced3b95 login.c: dont modify pdu->flags directly from iscsi_logout_async_internal
We no longer need to modify pdu->flags directly any more from
iscsi_logout_async_internal. We can just pass these as extra flags to
iscsi_allocate_pdu().

We also always set ISCSI_PDU_DROP_ON_RECONNECT unconditionally so there is
no need to pass this flag in from the callers in pdu.c .

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-23 20:39:37 -08:00
Ronnie Sahlberg
63c2e7583d task_mgmt.c: drop tmgmt pdus on reconnect
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-23 20:31:25 -08:00
Ronnie Sahlberg
0a9bd03b2d login.c: drop login PDUs on reconnect
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-23 20:31:25 -08:00
Ronnie Sahlberg
44c5089a21 discovery.c: drop discovery requests on reconnect instead or re-queuing them
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-23 20:31:25 -08:00
Ronnie Sahlberg
511c2fdbd1 pdu.c: remove iscsi_allocate_pdu_with_itt_flags()
Remove iscsi_allocate_pdu() which is just a wrapper.
Rename iscsi_allocate_pdu_with_itt_flags() to iscsi_allocate_pdu()
and update all callers.

This only removes a wrapper function and contains no logic changes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-23 20:26:22 -08:00
Peter Lieven
de7b38d9a0 use MIN and MAX macros at some places
Signed-off-by: Peter Lieven <pl@kamp.de>
2015-02-23 08:03:27 +01:00
Peter Lieven
dd6831a50f iscsi-command: fix unsolicited data-out length
the recent implementation allows to send
iscsi->first_burst_length + iscsi->target_max_recv_data_segment_length
bytes if immediate and unsolicited data-out is send and
iscsi->target_max_recv_data_segment_length < iscsi->first_burst_length.

RFC3720 defines the length as:

Length=(min(FirstBurstLength, Expected Data
   Transfer Length) - Received Immediate Data Length).

so that immediate data and unsolicited data-out are together
FirstBurstLength at maximum.

Signed-off-by: Peter Lieven <pl@kamp.de>
2015-02-23 07:53:41 +01:00
Peter Lieven
c94fb840bc iscsi-private: add MIN and MAX macros
Signed-off-by: Peter Lieven <pl@kamp.de>
2015-02-23 07:48:29 +01:00
Ronnie Sahlberg
2f5d21b09c iscsi-command.c: Use common function to write unsolicited data-out pdus.
We write unsolicited data-out PDUs from two places;
when we originally write the command in iscsi_scsi_command_async()
but also when we re-queue the PDUs during a session reconnect.

The re-queuing during the session re-connect was recently (almost) fixed
but was still buggy in that it did not correctly clamp the amount of written
data as per first burst length restriction.
This attempts to fix that.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-20 20:51:14 -08:00
Ronnie Sahlberg
831ecb3656 iscsi-command.c: use pdu->expxferlen instead of pdu->expxferlen
Both are the same value at this point but it is better to
do the computation only based on pdy-> fields.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-20 20:39:51 -08:00
Sebastian Herbszt
7dfd42ebfe test-tool: fix unregister of initiator 2 in test_prout_reserve_access
Initiator 2 registered with key2.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2015-02-17 19:21:46 -08:00
Ronnie Sahlberg
b001d980ef reconnect: we must re-queue any missing data-outs during reconnect
If we have writes that do not have the Final bit set during reconnect
we must send out any missing data-out PDU.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-17 06:46:58 -08:00
Ronnie Sahlberg
8ae706630e iscsi-command.c: Better fix for the length bug for immediatedata
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-16 17:36:58 -08:00
Ronnie Sahlberg
db7924fc90 iscsi_command: fix length bug when sending unsolicited data.
If we have send unsolicited immediate data and are ALSO sending
unsilocoted data-out, then we have to exclude the length of data we have already sent.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-16 17:27:56 -08:00
Ronnie Sahlberg
51bd0ce3ec test-tool: remove the --usb argument and use BLCSECTGET to read max xfer
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-16 16:04:28 -08:00
Sebastian Herbszt
cb7882a84c test-tool: fix SG_IO
Handle io_hdr.resid and adjust datain.size.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2015-02-16 15:39:31 -08:00
Sebastian Herbszt
4fbf802d32 update .gitignore
Update .gitignore.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2015-02-16 15:38:39 -08:00
Ronnie Sahlberg
6422fad7de RPM: add iscsi-perf to the package
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-11 06:11:44 -08:00
Ronnie Sahlberg
db4757766d README: add links to useful xml stuff
Suggested-by: CyberLoiter <yanming.xiao@gmail.com>
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-10 17:02:14 -08:00
Ronnie Sahlberg
68acbb7c3f rand_key: fix non-randomness in rand_key()
If rand_key() is called twive within the same second it would return the
same key both times. Not very random.
Redo how rand_key() works to make it more likely to be random and more likely
that two consequtive calls do not yield the same result.

Reported-by: CyberLoiter <yanming.xiao@gmail.com>
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-10 16:57:22 -08:00
Ronnie Sahlberg
bff95df881 Merge branch 'master' of github.com:sahlberg/libiscsi 2015-01-26 17:56:34 -08:00
Ronnie Sahlberg
d69d955fa6 test-tool: SEGV when dereferencing a NULL pointer ascq array
ascq is NULL if there are no ascqs provided for this failure mode.
Do not try to dereference the 0-th element in this array before checking
that the array has at least one element.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-26 17:56:12 -08:00
Ronnie Sahlberg
b84119611c test-tool: fix segv in reserve6_2initiators
Fix a SEGV in one of the reserve6 tests.

Signed-off-by: Vadim Finkelstein <vadim@pi-coral.com>
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-26 17:56:12 -08:00
Ronnie Sahlberg
004f16675e Merge pull request #141 from plieven/iscsi-io
util: introduce iscsi-perf
2015-01-23 06:18:11 -08:00
Ronnie Sahlberg
7dc0ea200d socket.c: allow re-using a context after disconnect
From Adam Endrodi <adam.endrodi@nsn.com>
Fix a bug and clear is_corked during socket disconnect so that we
can re-use the context for a new connection.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-09 15:13:58 -08:00
Ronnie Sahlberg
1971188764 Merge pull request #142 from cuinutanix/master
set_tcp_* functions should be static
2015-01-08 07:31:06 -08:00
Mike Cui
2284a8763c set_tcp_* functions should be static since they are not used anywhere else.
set_tcp_sockopt in particular conflicts with libnfs's function of the same
name and prevents a a program from statically linking against both libnfs and
libiscsi.

Similar fix should also go into libnfs.
2015-01-05 09:24:01 -08:00
Ronnie Sahlberg
52d9d84f9c README: update the readme and describe the family/suite/test better
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-30 19:54:56 -08:00
Ronnie Sahlberg
d33a0438a4 TESTS: replace read* flags tests with dedicated dpo/fua tests
Remove the flags tests for READ* and replace them with a test for the DPO
and FUA bits.
IF the device claims DPOFUA support in modesense then the READ* CDBs
MUST allow these two flags. IF the device does NOT claim DPOFUA then any
READ* CDB with these flags must fail with invalod field in cdb.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-22 20:05:29 -08:00
Ronnie Sahlberg
3aef8a0d4f README: mention that we can test against /dev/sg devices
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-21 15:14:29 -08:00
Ronnie Sahlberg
7865a8a26e Merge branch 'sgio' 2014-12-21 15:07:40 -08:00
Ronnie Sahlberg
646c8b963d New version 1.13.0
- Fix UNMAP tests
 - Build updates
 - Check residuals also when status != GOOD
 - Add WSNZ bit to the tests
 - Various test updates
 - Fix bug in scsi_create_task so it sets cdb_len correctly
 - Add a getter function for scsi task status and sense
 - Fixes and workarounds for Dell Equallogic issues
 - Be more flexible when allowing for unit attentions during connect time

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-21 14:58:46 -08:00
Ronnie Sahlberg
8c4a579cda SCSI: scsi_task_get_status add getter function for task status and sense
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-19 08:33:21 -08:00
Ronnie Sahlberg
0c6e3bffb3 SCSI: scsi_create_task must set task->cdb_size
We forgot to set task->cdb_size which means all tasks we create with this
function becomes test unit ready :-(

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-18 09:20:17 -08:00
Ronnie Sahlberg
9eabebd78a iscsi.h: remove obsolete scsi_get_data_[in|out]_buffer symbols
These two functions do not exist. Remove them from the header.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-18 05:51:23 -08:00
Ronnie Sahlberg
e07498e5c3 connect.c: improve the error message when iscsi_connect_async fails
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-07 10:08:38 -08:00
Peter Lieven
433b3384e6 util: introduce iscsi-perf
this adds the very first version of iscsi-perf to measure throughput
to and performance of an iscsi LUN.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-11-25 16:08:29 +01:00
Ronnie Sahlberg
fc601fd228 Merge pull request #140 from plieven/vc
pdu: add workaround for DELL Equallogic FW bugs 71409 & 73732
2014-10-29 12:59:27 -07:00
Peter Lieven
ac46262afa pdu: add workaround for DELL Equallogic FW bugs 71409 & 73732
Dell Equallogic storages may redirect connections from one member of a multi member storage
group to another. When the member that has the volume lead changes the storage issues
an async disconnect request message. The correct behaviour would be to either fail all I/O requests
with a check condition (waiting for logout) or fullfil requests until the time specified
in the disconnect request message has elapsed and then drop the connection. In firwamre 7.x
however the storage sometimes cancels requests with SENSE KEY:ILLEGAL_REQUEST(5)
ASCQ:LOGICAL_UNIT_NOT_SUPPORTED(0x2500). This leads to I/O errors propagated to the application.
This patch was reported in May 2014 to Dell and the initial bug 71409 has been fixed in 7.0.7.
However, the first fix did not entirely solve the problem and bug 73732 has been raised.

This patch adds an environment variable LIBISCSI_DROP_CONN_ON_ASYNC_EVENT1 which if set leads
to an immediate drop of the connection when such an async event is received. This is ugly, but
works around the I/O errors.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-10-28 09:20:05 +01:00
Ronnie Sahlberg
3d6c2be342 configure: only build the test tool and ld-iscsi iff we have shared libraries
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-10-22 17:44:03 -07:00
Ronnie Sahlberg
58f06b0e74 TESTS: get rid of a sanitize helper
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-10-14 19:39:27 -07:00
Ronnie Sahlberg
8ac7d64082 TESTS: convert most of SANITIZE to new saner api
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-10-14 19:25:17 -07:00
Bart Van Assche
fe9620092c test tool: Detect unsupported opcodes correctly
There is no agreement among the T10 committee whether a SCSI target should
report "invalid opcode", "invalid field in CDB" or "invalid field in
parameter list" if the opcode consists of two bytes. Hence accept all three
sense codes for two-byte opcodes. For more information see also Frederick
Knight, RE: INVALID COMMAND OPERATION CODE, T10 Reflector, 16 May 2008
(http://t10.org/ftp/t10/t10r/2008/r0805167.htm).

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-10-14 18:51:56 -07:00
Bart Van Assche
30355f8cc0 test_inquiry_block_limits: Only query VPD page B2h if LBPME = 1
In the READ CAPACITY response support for logical block provisioning
is indicated via the LBPME (logical block provisioning management
enabled) bit. Since the logical block provisioning VPD page (B2h)
is optional, only query it if LBPME = 1.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-10-14 18:03:45 -07:00
Bart Van Assche
eee66727a7 test_iscsi_datasn_invalid: Make terminology consistent with RFC 3720
According to RFC 3720 the data associated with a SCSI WRITE command
is sent via Data-Out PDU's. Update log texts accordingly and also
make the capitalization of DataSN consistent with RFC 3720.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-10-14 18:02:48 -07:00
Bart Van Assche
0763dc5743 libiscsi: Clear PS bit before sending MODE SELECT
A quote from SPC-4: "When using the MODE SENSE command, a
parameters saveable (PS) bit set to one indicates that the mode
page may be saved by the logical unit in a nonvolatile, vendor
specific location. A PS bit set to zero indicates that the device
server is not able to save the supported parameters. When using
the MODE SELECT command, the PS bit is reserved."

Hence clear the PS bit after having queried a mode page via MODE
SENSE and before changing it via MODE SELECT.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2014-10-14 17:56:40 -07:00
Ronnie Sahlberg
14461757c4 TESTS: Allow Hardware/Software write protect as valid ASCQ
Add 0x2701/0x2702 to the list of valid ASCQ values we accept for devices
that are write protected.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-10-08 06:23:43 -07:00
Ronnie Sahlberg
d411f12bbc TESTS: tweak inquiry blocklimits test
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-27 12:54:34 -07:00
Ronnie Sahlberg
f3205bb095 scsi-lowlevel.c: check that task/datain are valid before we unmarshalling
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-27 09:49:52 -07:00
Ronnie Sahlberg
9e514fbf44 scsi-lowlevel.c: check that task/datain are valid before we unmarshalling
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-09-27 09:48:16 -07:00