aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 495ccbc7f8cb..9b5a10ac3e25 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -366,6 +366,12 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
366 goto qc_fail_command; 366 goto qc_fail_command;
367 } 367 }
368 368
369 /* Close window on fcport/rport state-transitioning. */
370 if (!*(fc_port_t **)rport->dd_data) {
371 cmd->result = DID_IMM_RETRY << 16;
372 goto qc_fail_command;
373 }
374
369 if (atomic_read(&fcport->state) != FCS_ONLINE) { 375 if (atomic_read(&fcport->state) != FCS_ONLINE) {
370 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || 376 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
371 atomic_read(&ha->loop_state) == LOOP_DEAD) { 377 atomic_read(&ha->loop_state) == LOOP_DEAD) {
@@ -421,6 +427,12 @@ qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
421 goto qc24_fail_command; 427 goto qc24_fail_command;
422 } 428 }
423 429
430 /* Close window on fcport/rport state-transitioning. */
431 if (!*(fc_port_t **)rport->dd_data) {
432 cmd->result = DID_IMM_RETRY << 16;
433 goto qc24_fail_command;
434 }
435
424 if (atomic_read(&fcport->state) != FCS_ONLINE) { 436 if (atomic_read(&fcport->state) != FCS_ONLINE) {
425 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || 437 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
426 atomic_read(&ha->loop_state) == LOOP_DEAD) { 438 atomic_read(&ha->loop_state) == LOOP_DEAD) {
@@ -1675,11 +1687,13 @@ qla2x00_schedule_rport_del(struct scsi_qla_host *ha, fc_port_t *fcport,
1675 spin_lock_irqsave(&fcport->rport_lock, flags); 1687 spin_lock_irqsave(&fcport->rport_lock, flags);
1676 fcport->drport = rport; 1688 fcport->drport = rport;
1677 fcport->rport = NULL; 1689 fcport->rport = NULL;
1690 *(fc_port_t **)rport->dd_data = NULL;
1678 spin_unlock_irqrestore(&fcport->rport_lock, flags); 1691 spin_unlock_irqrestore(&fcport->rport_lock, flags);
1679 set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags); 1692 set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags);
1680 } else { 1693 } else {
1681 spin_lock_irqsave(&fcport->rport_lock, flags); 1694 spin_lock_irqsave(&fcport->rport_lock, flags);
1682 fcport->rport = NULL; 1695 fcport->rport = NULL;
1696 *(fc_port_t **)rport->dd_data = NULL;
1683 spin_unlock_irqrestore(&fcport->rport_lock, flags); 1697 spin_unlock_irqrestore(&fcport->rport_lock, flags);
1684 fc_remote_port_delete(rport); 1698 fc_remote_port_delete(rport);
1685 } 1699 }