Преглед изворни кода

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.
tags/v0.9.3
Michael Brown пре 16 година
родитељ
комит
c194b0c4bf
1 измењених фајлова са 10 додато и 3 уклоњено
  1. 10
    3
      src/net/tcp/iscsi.c

+ 10
- 3
src/net/tcp/iscsi.c Прегледај датотеку

@@ -421,8 +421,8 @@ static int iscsi_tx_data_out ( struct iscsi_session *iscsi ) {
421 421
  *     MaxConnections is irrelevant; we make only one connection anyway
422 422
  *     InitialR2T=Yes [1]
423 423
  *     ImmediateData is irrelevant; we never send immediate data
424
- *     MaxRecvDataSegmentLength=8192 (default; we don't care)
425
- *     MaxBurstLength=262144 (default; we don't care)
424
+ *     MaxRecvDataSegmentLength=8192 (default; we don't care) [3]
425
+ *     MaxBurstLength=262144 (default; we don't care) [3]
426 426
  *     FirstBurstLength=262144 (default; we don't care)
427 427
  *     DefaultTime2Wait=0 [2]
428 428
  *     DefaultTime2Retain=0 [2]
@@ -438,6 +438,11 @@ static int iscsi_tx_data_out ( struct iscsi_session *iscsi ) {
438 438
  * [2] These ensure that we can safely start a new task once we have
439 439
  * reconnected after a failure, without having to manually tidy up
440 440
  * after the old one.
441
+ *
442
+ * [3] We are quite happy to use the RFC-defined default values for
443
+ * these parameters, but some targets (notably OpenSolaris)
444
+ * incorrectly assume a default value of zero, so we explicitly
445
+ * specify the default values.
441 446
  */
442 447
 static int iscsi_build_login_request_strings ( struct iscsi_session *iscsi,
443 448
 					       void *data, size_t len ) {
@@ -475,13 +480,15 @@ static int iscsi_build_login_request_strings ( struct iscsi_session *iscsi,
475 480
 				    "HeaderDigest=None%c"
476 481
 				    "DataDigest=None%c"
477 482
 				    "InitialR2T=Yes%c"
483
+				    "MaxRecvDataSegmentLength=8192%c"
484
+				    "MaxBurstLength=262144%c"
478 485
 				    "DefaultTime2Wait=0%c"
479 486
 				    "DefaultTime2Retain=0%c"
480 487
 				    "MaxOutstandingR2T=1%c"
481 488
 				    "DataPDUInOrder=Yes%c"
482 489
 				    "DataSequenceInOrder=Yes%c"
483 490
 				    "ErrorRecoveryLevel=0%c",
484
-				    0, 0, 0, 0, 0, 0, 0, 0, 0 );
491
+				    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
485 492
 	}
486 493
 
487 494
 	return used;

Loading…
Откажи
Сачувај