|
@@ -182,9 +182,10 @@ static void iscsi_close_connection ( struct iscsi_session *iscsi, int rc ) {
|
182
|
182
|
static void iscsi_scsi_done ( struct iscsi_session *iscsi, int rc ) {
|
183
|
183
|
|
184
|
184
|
assert ( iscsi->tx_state == ISCSI_TX_IDLE );
|
|
185
|
+ assert ( iscsi->command != NULL );
|
185
|
186
|
|
|
187
|
+ iscsi->command->rc = rc;
|
186
|
188
|
iscsi->command = NULL;
|
187
|
|
- iscsi->rc = rc;
|
188
|
189
|
}
|
189
|
190
|
|
190
|
191
|
/****************************************************************************
|
|
@@ -1550,32 +1551,24 @@ static int iscsi_command ( struct scsi_device *scsi,
|
1550
|
1551
|
container_of ( scsi->backend, struct iscsi_session, refcnt );
|
1551
|
1552
|
int rc;
|
1552
|
1553
|
|
|
1554
|
+ /* Abort immediately if we have a recorded permanent failure */
|
|
1555
|
+ if ( iscsi->instant_rc )
|
|
1556
|
+ return iscsi->instant_rc;
|
|
1557
|
+
|
1553
|
1558
|
/* Record SCSI command */
|
1554
|
1559
|
iscsi->command = command;
|
1555
|
1560
|
|
1556
|
|
- /* Abort immediately if we have a recorded permanent failure */
|
1557
|
|
- if ( iscsi->instant_rc ) {
|
1558
|
|
- rc = iscsi->instant_rc;
|
1559
|
|
- goto done;
|
1560
|
|
- }
|
1561
|
|
-
|
1562
|
1561
|
/* Issue command or open connection as appropriate */
|
1563
|
1562
|
if ( iscsi->status ) {
|
1564
|
1563
|
iscsi_start_command ( iscsi );
|
1565
|
1564
|
} else {
|
1566
|
|
- if ( ( rc = iscsi_open_connection ( iscsi ) ) != 0 )
|
1567
|
|
- goto done;
|
|
1565
|
+ if ( ( rc = iscsi_open_connection ( iscsi ) ) != 0 ) {
|
|
1566
|
+ iscsi->command = NULL;
|
|
1567
|
+ return rc;
|
|
1568
|
+ }
|
1568
|
1569
|
}
|
1569
|
1570
|
|
1570
|
|
- /* Wait for command to complete */
|
1571
|
|
- iscsi->rc = -EINPROGRESS;
|
1572
|
|
- while ( iscsi->rc == -EINPROGRESS )
|
1573
|
|
- step();
|
1574
|
|
- rc = iscsi->rc;
|
1575
|
|
-
|
1576
|
|
- done:
|
1577
|
|
- iscsi->command = NULL;
|
1578
|
|
- return rc;
|
|
1571
|
+ return 0;
|
1579
|
1572
|
}
|
1580
|
1573
|
|
1581
|
1574
|
static int iscsi_detached_command ( struct scsi_device *scsi __unused,
|