Просмотр исходного кода

[iscsi] Avoid duplicate calls to iscsi_tx_done()

The iSCSI TX process can now be woken up by the TCP socket via
xfer_window_changed(), so it is no longer valid to assume that
iscsi_tx_step() can be called in state ISCSI_TX_IDLE only immediately
after completing a transmission.

Fix by calling iscsi_tx_done() only upon a transition into state
ISCSI_TX_IDLE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 лет назад
Родитель
Сommit
1b8984eb5d
1 измененных файлов: 9 добавлений и 4 удалений
  1. 9
    4
      src/net/tcp/iscsi.c

+ 9
- 4
src/net/tcp/iscsi.c Просмотреть файл

@@ -1333,8 +1333,7 @@ static void iscsi_tx_resume ( struct iscsi_session *iscsi ) {
1333 1333
 static void iscsi_start_tx ( struct iscsi_session *iscsi ) {
1334 1334
 
1335 1335
 	assert ( iscsi->tx_state == ISCSI_TX_IDLE );
1336
-	assert ( ! process_running ( &iscsi->process ) );
1337
-	
1336
+
1338 1337
 	/* Initialise TX BHS */
1339 1338
 	memset ( &iscsi->tx_bhs, 0, sizeof ( iscsi->tx_bhs ) );
1340 1339
 
@@ -1476,8 +1475,8 @@ static void iscsi_tx_step ( struct iscsi_session *iscsi ) {
1476 1475
 			next_state = ISCSI_TX_IDLE;
1477 1476
 			break;
1478 1477
 		case ISCSI_TX_IDLE:
1479
-			/* Stop processing */
1480
-			iscsi_tx_done ( iscsi );
1478
+			/* Nothing to do; pause processing */
1479
+			iscsi_tx_pause ( iscsi );
1481 1480
 			return;
1482 1481
 		default:
1483 1482
 			assert ( 0 );
@@ -1504,6 +1503,12 @@ static void iscsi_tx_step ( struct iscsi_session *iscsi ) {
1504 1503
 
1505 1504
 		/* Move to next state */
1506 1505
 		iscsi->tx_state = next_state;
1506
+
1507
+		/* If we have moved to the idle state, mark
1508
+		 * transmission as complete
1509
+		 */
1510
+		if ( iscsi->tx_state == ISCSI_TX_IDLE )
1511
+			iscsi_tx_done ( iscsi );
1507 1512
 	}
1508 1513
 }
1509 1514
 

Загрузка…
Отмена
Сохранить