]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[iscsi] Avoid duplicate calls to iscsi_tx_done()
authorMichael Brown <mcb30@ipxe.org>
Wed, 29 Jun 2011 13:49:18 +0000 (14:49 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 29 Jun 2011 13:52:30 +0000 (14:52 +0100)
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>
src/net/tcp/iscsi.c

index 8781559924f704f944d0e6b91b52e368d9d3898f..8beeb87776863124bc646b2f2bb8763033421924 100644 (file)
@@ -1333,8 +1333,7 @@ static void iscsi_tx_resume ( struct iscsi_session *iscsi ) {
 static void iscsi_start_tx ( struct iscsi_session *iscsi ) {
 
        assert ( iscsi->tx_state == ISCSI_TX_IDLE );
-       assert ( ! process_running ( &iscsi->process ) );
-       
+
        /* Initialise TX BHS */
        memset ( &iscsi->tx_bhs, 0, sizeof ( iscsi->tx_bhs ) );
 
@@ -1476,8 +1475,8 @@ static void iscsi_tx_step ( struct iscsi_session *iscsi ) {
                        next_state = ISCSI_TX_IDLE;
                        break;
                case ISCSI_TX_IDLE:
-                       /* Stop processing */
-                       iscsi_tx_done ( iscsi );
+                       /* Nothing to do; pause processing */
+                       iscsi_tx_pause ( iscsi );
                        return;
                default:
                        assert ( 0 );
@@ -1504,6 +1503,12 @@ static void iscsi_tx_step ( struct iscsi_session *iscsi ) {
 
                /* Move to next state */
                iscsi->tx_state = next_state;
+
+               /* If we have moved to the idle state, mark
+                * transmission as complete
+                */
+               if ( iscsi->tx_state == ISCSI_TX_IDLE )
+                       iscsi_tx_done ( iscsi );
        }
 }