Commit 38170fa8 authored by Giridhar Malavali's avatar Giridhar Malavali Committed by James Bottomley

[SCSI] qla2xxx: Avoid depending on SCSI host_lock in queuecommand function.

Signed-off-by: default avatarGiridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: default avatarMadhuranath Iyengar <Madhu.Iyengar@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 9dac0d9a
...@@ -1538,6 +1538,10 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport) ...@@ -1538,6 +1538,10 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
if (!fcport) if (!fcport)
return; return;
/* Now that the rport has been deleted, set the fcport state to
FCS_DEVICE_DEAD */
atomic_set(&fcport->state, FCS_DEVICE_DEAD);
/* /*
* Transport has effectively 'deleted' the rport, clear * Transport has effectively 'deleted' the rport, clear
* all local references. * all local references.
...@@ -1547,10 +1551,6 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport) ...@@ -1547,10 +1551,6 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
*((fc_port_t **)rport->dd_data) = NULL; *((fc_port_t **)rport->dd_data) = NULL;
spin_unlock_irq(host->host_lock); spin_unlock_irq(host->host_lock);
/* Now that the rport has been deleted, set the fcport state to
FCS_DEVICE_DEAD */
atomic_set(&fcport->state, FCS_DEVICE_DEAD);
if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags)) if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags))
return; return;
......
...@@ -2928,8 +2928,8 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) ...@@ -2928,8 +2928,8 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT);
qla2x00_iidma_fcport(vha, fcport); qla2x00_iidma_fcport(vha, fcport);
atomic_set(&fcport->state, FCS_ONLINE);
qla2x00_reg_remote_port(vha, fcport); qla2x00_reg_remote_port(vha, fcport);
atomic_set(&fcport->state, FCS_ONLINE);
} }
/* /*
......
...@@ -545,6 +545,7 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) ...@@ -545,6 +545,7 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
srb_t *sp; srb_t *sp;
int rval; int rval;
spin_unlock_irq(vha->host->host_lock);
if (ha->flags.eeh_busy) { if (ha->flags.eeh_busy) {
if (ha->flags.pci_channel_io_perm_failure) if (ha->flags.pci_channel_io_perm_failure)
cmd->result = DID_NO_CONNECT << 16; cmd->result = DID_NO_CONNECT << 16;
...@@ -559,10 +560,6 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) ...@@ -559,10 +560,6 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
goto qc24_fail_command; goto qc24_fail_command;
} }
/* Close window on fcport/rport state-transitioning. */
if (fcport->drport)
goto qc24_target_busy;
if (!vha->flags.difdix_supported && if (!vha->flags.difdix_supported &&
scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) { scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) {
DEBUG2(qla_printk(KERN_ERR, ha, DEBUG2(qla_printk(KERN_ERR, ha,
...@@ -573,6 +570,7 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) ...@@ -573,6 +570,7 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
} }
if (atomic_read(&fcport->state) != FCS_ONLINE) { if (atomic_read(&fcport->state) != FCS_ONLINE) {
if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
atomic_read(&fcport->state) == FCS_DEVICE_LOST ||
atomic_read(&base_vha->loop_state) == LOOP_DEAD) { atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
cmd->result = DID_NO_CONNECT << 16; cmd->result = DID_NO_CONNECT << 16;
goto qc24_fail_command; goto qc24_fail_command;
...@@ -580,8 +578,6 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) ...@@ -580,8 +578,6 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
goto qc24_target_busy; goto qc24_target_busy;
} }
spin_unlock_irq(vha->host->host_lock);
sp = qla2x00_get_new_sp(base_vha, fcport, cmd, done); sp = qla2x00_get_new_sp(base_vha, fcport, cmd, done);
if (!sp) if (!sp)
goto qc24_host_busy_lock; goto qc24_host_busy_lock;
...@@ -603,9 +599,11 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) ...@@ -603,9 +599,11 @@ qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
return SCSI_MLQUEUE_HOST_BUSY; return SCSI_MLQUEUE_HOST_BUSY;
qc24_target_busy: qc24_target_busy:
spin_lock_irq(vha->host->host_lock);
return SCSI_MLQUEUE_TARGET_BUSY; return SCSI_MLQUEUE_TARGET_BUSY;
qc24_fail_command: qc24_fail_command:
spin_lock_irq(vha->host->host_lock);
done(cmd); done(cmd);
return 0; return 0;
...@@ -2613,12 +2611,12 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *vha, int defer) ...@@ -2613,12 +2611,12 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *vha, int defer)
if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD)
continue; continue;
if (atomic_read(&fcport->state) == FCS_ONLINE) { if (atomic_read(&fcport->state) == FCS_ONLINE) {
atomic_set(&fcport->state, FCS_DEVICE_LOST);
if (defer) if (defer)
qla2x00_schedule_rport_del(vha, fcport, defer); qla2x00_schedule_rport_del(vha, fcport, defer);
else if (vha->vp_idx == fcport->vp_idx) else if (vha->vp_idx == fcport->vp_idx)
qla2x00_schedule_rport_del(vha, fcport, defer); qla2x00_schedule_rport_del(vha, fcport, defer);
} }
atomic_set(&fcport->state, FCS_DEVICE_LOST);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment