Commit Graph

488 Commits

Author SHA1 Message Date
Ronnie Sahlberg
97dcf94d72 iSCSI: when reconnecting we should not automatically requeue any DATA-OUT PDUs
Dont requeue data-out pdus, or other pdus with the DELETE_WHEN_SENT flag, such
as nops.
These, like the DATA-OUT pdu will instead be automatically re-sent when the original write command is sent again.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-24 19:32:00 -07:00
Ronnie Sahlberg
a24aca8c50 Merge pull request #27 from plieven/master
small fixes + iscsi-readcapacity16 binary
2012-10-24 19:02:31 -07:00
Peter Lieven
2427926327 ISCSI-READCAPACITY16 modified copyright notice 2012-10-23 17:17:53 +02:00
Peter Lieven
fec061ac68 Add iscsi-readcapacity16 binary
This patch adds a small binary to read the size of an iscsi target. The value
is returned on stdout.
2012-10-23 15:59:28 +02:00
Peter Lieven
56b1e27980 LD_ISCSI fix whitespace 2012-10-23 10:59:07 +02:00
Peter Lieven
6e82c48185 RECONNECT fix read from freed iscsi context 2012-10-23 10:55:04 +02:00
Peter Lieven
c2836e2a9a DPRINTF add iscsi target_name if available
This patch adds the iscsi target name to the debug output
2012-10-23 10:53:14 +02:00
Ronnie Sahlberg
f74266146c Merge pull request #25 from plieven/master
Fix Compiler warnings + add setters for TCP keepalive values
2012-10-22 06:27:16 -07:00
Peter Lieven
afc963c312 LD_ISCSI: cache last result of get_lba_status
get_lba_status returns provisioning for a range of blocks starting
from given lba. Especially for sequential reads its likely that
the next block read is already covered by the last result.

In case there is write support added to ld_iscsi there needs
to be an invalidation code for the cache.
2012-10-21 20:29:39 +02:00
Peter Lieven
bfac1f85a3 LD_SCSI: Introduce get_lba_status in read()
For large continous reads I may be benifical to check if the blocks
that are going to be read are allocated. If they are not allocated
they do not need to be read which massivly speeds up the read.

This behaviour is optional and can be turned on with environment
variable LD_ISCSI_GET_LBA_STATUS=1
2012-10-21 09:24:19 +02:00
Peter Lieven
08bfabcd36 LD_ISCSI: Use readcapacity16 instead of readcapacity10
This allows for handling volumes larger than 2TB
2012-10-21 08:35:55 +02:00
Peter Lieven
8a3e312f06 LD_ISCSI: Fail open with O_NONBLOCK
Non-Blocking I/O is supported nowhere in the code. We should fail
until we have support for it.
2012-10-21 08:24:24 +02:00
Peter Lieven
bca635c75d LD_ISCSI: storage file mode for further usage 2012-10-21 08:22:17 +02:00
Peter Lieven
54d8aa0ab6 LD_ISCSI: use read16 instead of read10
Use READ16 to support for large volumes. READ16 takes a 64bit LBA offset instead
of 32bit.
2012-10-21 08:17:40 +02:00
Peter Lieven
86fa62558e LD_ISCSI: add debugging support 2012-10-21 08:13:16 +02:00
Peter Lieven
a26a6e12d5 Fix paramter to DPRINTF in tcp_set_user_timeout() 2012-10-20 19:13:53 +02:00
Peter Lieven
d30b279474 Unify paramters in tcp_set_user_timeout()
Use the same function definition as in the other tcp setters.
2012-10-20 19:12:13 +02:00
Peter Lieven
20cf2b279e Fix incorrect whitespaces
At a few places there where spaces where tabulators where appropriate
2012-10-20 19:08:57 +02:00
Peter Lieven
3f5a75ce5e Remove redundant code in iscsi_service() 2012-10-20 19:00:32 +02:00
Peter Lieven
881fc9743a Use generic tcp_set_sockopt function for tcp setsockopt operations 2012-10-20 18:54:46 +02:00
Peter Lieven
cbae6ae058 Remove accidently left debug message in iscsi_service 2012-10-20 18:44:43 +02:00
Peter Lieven
78a31ad4a1 Add iscsi_set_tcp_syncnt function
This patch adds support for setting TCP_SYNCNT to overwrite
the system default values. This allows indirect support
for a configurable connect timeout.

Linux uses a exponential backoff for SYN retries starting
with 1 second.

This means for a value n for TCP_SYNCNT, the connect will
effectively timeout after 2^(n+1)-1 seconds.
2012-10-20 18:43:48 +02:00
Peter Lieven
d1110b7515 Add various environment variables
This patch allows the following parameters inside libiscsi to be adjusted without code modification:
LIBISCSI_DEBUG
LIBISCSI_TCP_USER_TIMEOUT
LIBISCSI_TCP_KEEPIDLE
LIBISCSI_TCP_KEEPCNT
LIBISCSI_TCP_KEEPINTVL

You can now enable debugging of libiscsi inside e.g. qemu-kvm with
LIBISCSI_DEBUG=3 qemu-kvm -hda iscsi://...
2012-10-20 18:11:35 +02:00
Peter Lieven
236aaa011f Fix compiler warnings
These patch fixes 3 compiler warnings introduce by my recent patches.
2012-10-19 23:48:04 +02:00
Peter Lieven
ad9cd56b2d Add setters for TCP keepalive values
This patch adds 3 functions to set the 3 keepalive values TCP_KEEPIDLE, TCP_KEEPCNT
and TCP_KEEPINTVL. The values have to be set after iscsi context creation and are
then configured on the socket on each new connection.
2012-10-19 23:40:12 +02:00
Ronnie Sahlberg
abd20f3587 Use the literal ISCSI_STATUS_REDIRECT instead of the numeric value 2012-10-18 20:03:58 -07:00
Ronnie Sahlberg
fd4c7b7108 Merge pull request #24 from plieven/master
Various patches to libiscsi
2012-10-18 20:01:23 -07:00
Peter Lieven
cc2b0c9b1d Set SO_KEEPALIVE before TCP_USER_TIMEOUT
For TCP_USER_TIMEOUT to work it seems to be necessary that SO_KEEPALIVE is
enabled. RFC5482 section 4.2 also says that the TCP_USER_TIMEOUT has to be
less than the keepalive timeout. This means less than 30000 ms in the
current libiscsi default settings for TCP keepalives.
2012-10-18 14:31:09 +02:00
Peter Lieven
326b2ea49d Add backoff mechanism to iscsi_reconnect
This patch adds a linear backoff mechanishm + jitter in case
a reconnect fails. If there is a longer outage this is to
avoid a large amount of simultaneous connects to the storage.
2012-10-18 12:18:40 +02:00
Peter Lieven
f973608578 Add iscsi_tcp_set_user_timeout function
This patch adds a user configurable option to set the TCP_USER_TIMEOUT
socket option. With this timeout set a broken TCP session is shutdown
after a given timeout even there are unacked packets. SO_KEEPALIVE
seems not to work in this case.
2012-10-18 11:55:15 +02:00
Peter Lieven
cb6f2ce252 iSCSI Redirect support
This patch adds support for persistant portals like they are common
to storage arrays with different interfaces or physical members.
2012-10-18 10:48:52 +02:00
Peter Lieven
4cb845477d Add debugging framework
This patch adds a user configurable debug level. For testing
it includes connection info and reporting errors.
2012-10-18 10:36:26 +02:00
Peter Lieven
c4592550d6 Move iscsi_set_tcp_keepalive after socket creation
Socket options should be set directly after socket creation.
2012-10-18 09:40:05 +02:00
Peter Lieven
91267f5aaa Limit immediate and unsolicited data to FirstBurstLength
RFC3270 describes in section 12.14 that immediate and unsolicited data
sent from the initiator to the target must not exceed FristBurstLength
bytes in total.
2012-10-18 09:21:54 +02:00
Ronnie Sahlberg
b673d8ed57 CONNECT: export the iscsi_reconnect() function.
There are situations where you may want to trigger an iscsi reconnect
explicitely from an application so make this function exposed to applications.
2012-10-16 21:30:39 -07:00
Ronnie Sahlberg
676bf2372c TEST: Add test that target reset will release a RESERVE6 2012-10-04 21:37:41 -07:00
Ronnie Sahlberg
06e925f2fd TEST: Add a test to verify that reservation are dropped on session termination 2012-10-01 18:41:08 -07:00
Ronnie Sahlberg
4e35b808a2 Merge pull request #21 from jongrimm/master
Added test (to 420) to have Initiator 2 RELEASE6, when Initiator1 already has reserved.
2012-10-01 18:33:33 -07:00
Jon Grimm
a5cc1fdbe8 Fix merge conflicts 2012-10-01 09:57:06 -05:00
Ronnie Sahlberg
30a32b4335 TESTS: Add two tests that RESERVE6 is dropped on LUN-reset as well as session logout 2012-09-30 09:25:39 -07:00
Ronnie Sahlberg
add9607244 TEST: Add readme for the test tool 2012-09-30 08:43:56 -07:00
Ronnie Sahlberg
c57827fef4 TESTS: Add externs for the two initiator names 2012-09-30 08:31:15 -07:00
Ronnie Sahlberg
b160b95060 TESTS: Add 'initiator2' variable so we can run tests with two different initiatir names
Update the 0420 test to use different initiator names for the two sessions to the target.
2012-09-30 08:25:23 -07:00
Jon Grimm
2b6bc6c687 test: Add test to release from second initiator when already reserved by first initiator. 2012-09-30 07:29:31 -07:00
Jon Grimm
2a2f246615 test: reserve_basic: mem leak cleanup 2012-09-28 11:27:20 -05:00
Jon Grimm
32d9f760d2 test: Add test to release from second initiator when already reserved by first initiator. 2012-09-28 10:09:14 -05:00
Ronnie Sahlberg
da893b0cf9 TEST 0420 cosmetic printf change 2012-09-27 18:49:38 -07:00
Ronnie Sahlberg
0aa14bbe39 TEST: 0420 some cosmetic printf changes 2012-09-27 18:47:15 -07:00
Ronnie Sahlberg
c3adf1d814 Merge pull request #20 from jongrimm/master
RESERVE6/RELEASE6 Commands + testcase.
2012-09-27 18:39:22 -07:00
Ronnie Sahlberg
ce2db039a5 TEST: try to make 0410 nicer
0410 is the first test for the MMC commandset.
This commandset is in hindsight a bit more complex than other commandsets
in that we have to handle quite a lot of cases :
1, if it is not a MMC device, we should check we get INVALID_OPCODE and then
bail.
Then if it is a MMC device, there are at least three different cases we have to
handle:
2.a  If there is no medium in the device
2.b there is media, but the medium is blank
2.c there is readable medium

this makes MMC tests a lot more complex than other commandsets
so we have to try to get this one as nice and simple as possible so we can
reuse this test as the framework when adding other MMC tests.

(even the 2.b test is not 100% right,   since if the medium is BR, then a blank disk will fail with sense,  but blank pre-BD mediums will not fail the READTOC command)
2012-09-27 18:29:57 -07:00