Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Work around a bug in the OpenSolaris iSCSI target.
We didn't specify values for MaxRecvDataSegmentLength and
MaxBurstLength (to save space, since we were happy with the
RFC-defined default values of 8kB and 256kB respectively).  However,
the OpenSolaris target (incorrectly) assumes default values of zero
for these parameters.

The upshot was that the OpenSolaris target would get stuck in an
endless loop trying to send us the first 512-byte sector, zero bytes
at a time, and would eventually run out of memory and core-dump.

Fixed by explicitly specifying the default values for these two
parameters.
  • Loading branch information
Michael Brown committed Nov 5, 2007
1 parent 755cb83 commit c194b0c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/net/tcp/iscsi.c
Expand Up @@ -421,8 +421,8 @@ static int iscsi_tx_data_out ( struct iscsi_session *iscsi ) {
* MaxConnections is irrelevant; we make only one connection anyway
* InitialR2T=Yes [1]
* ImmediateData is irrelevant; we never send immediate data
* MaxRecvDataSegmentLength=8192 (default; we don't care)
* MaxBurstLength=262144 (default; we don't care)
* MaxRecvDataSegmentLength=8192 (default; we don't care) [3]
* MaxBurstLength=262144 (default; we don't care) [3]
* FirstBurstLength=262144 (default; we don't care)
* DefaultTime2Wait=0 [2]
* DefaultTime2Retain=0 [2]
Expand All @@ -438,6 +438,11 @@ static int iscsi_tx_data_out ( struct iscsi_session *iscsi ) {
* [2] These ensure that we can safely start a new task once we have
* reconnected after a failure, without having to manually tidy up
* after the old one.
*
* [3] We are quite happy to use the RFC-defined default values for
* these parameters, but some targets (notably OpenSolaris)
* incorrectly assume a default value of zero, so we explicitly
* specify the default values.
*/
static int iscsi_build_login_request_strings ( struct iscsi_session *iscsi,
void *data, size_t len ) {
Expand Down Expand Up @@ -475,13 +480,15 @@ static int iscsi_build_login_request_strings ( struct iscsi_session *iscsi,
"HeaderDigest=None%c"
"DataDigest=None%c"
"InitialR2T=Yes%c"
"MaxRecvDataSegmentLength=8192%c"
"MaxBurstLength=262144%c"
"DefaultTime2Wait=0%c"
"DefaultTime2Retain=0%c"
"MaxOutstandingR2T=1%c"
"DataPDUInOrder=Yes%c"
"DataSequenceInOrder=Yes%c"
"ErrorRecoveryLevel=0%c",
0, 0, 0, 0, 0, 0, 0, 0, 0 );
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
}

return used;
Expand Down

0 comments on commit c194b0c

Please sign in to comment.