mirror of https://gitee.com/openkylin/linux.git
scsi: qla2xxx: Add lock protection around host lookup
Host lookup via btree is currently protected by the hardware_lock. Add hardware_lock when modifying btree to store host pointer. Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
a4239945b8
commit
9d1aa4e14e
|
@ -3939,6 +3939,7 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)
|
||||||
struct qla_hw_data *ha = vha->hw;
|
struct qla_hw_data *ha = vha->hw;
|
||||||
scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
|
scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
|
||||||
port_id_t id;
|
port_id_t id;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
/* Get host addresses. */
|
/* Get host addresses. */
|
||||||
rval = qla2x00_get_adapter_id(vha,
|
rval = qla2x00_get_adapter_id(vha,
|
||||||
|
@ -4020,7 +4021,9 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)
|
||||||
id.b.area = area;
|
id.b.area = area;
|
||||||
id.b.al_pa = al_pa;
|
id.b.al_pa = al_pa;
|
||||||
id.b.rsvd_1 = 0;
|
id.b.rsvd_1 = 0;
|
||||||
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
||||||
qlt_update_host_map(vha, id);
|
qlt_update_host_map(vha, id);
|
||||||
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
||||||
|
|
||||||
if (!vha->flags.init_done)
|
if (!vha->flags.init_done)
|
||||||
ql_log(ql_log_info, vha, 0x2010,
|
ql_log(ql_log_info, vha, 0x2010,
|
||||||
|
|
|
@ -50,11 +50,12 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
|
||||||
|
|
||||||
spin_lock_irqsave(&ha->vport_slock, flags);
|
spin_lock_irqsave(&ha->vport_slock, flags);
|
||||||
list_add_tail(&vha->list, &ha->vp_list);
|
list_add_tail(&vha->list, &ha->vp_list);
|
||||||
|
|
||||||
qlt_update_vp_map(vha, SET_VP_IDX);
|
|
||||||
|
|
||||||
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
||||||
|
|
||||||
|
spin_lock_irqsave(&ha->hardware_lock, flags);
|
||||||
|
qlt_update_vp_map(vha, SET_VP_IDX);
|
||||||
|
spin_unlock_irqrestore(&ha->hardware_lock, flags);
|
||||||
|
|
||||||
mutex_unlock(&ha->vport_lock);
|
mutex_unlock(&ha->vport_lock);
|
||||||
return vp_id;
|
return vp_id;
|
||||||
}
|
}
|
||||||
|
@ -158,9 +159,9 @@ qla24xx_disable_vp(scsi_qla_host_t *vha)
|
||||||
atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
|
atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
|
||||||
|
|
||||||
/* Remove port id from vp target map */
|
/* Remove port id from vp target map */
|
||||||
spin_lock_irqsave(&vha->hw->vport_slock, flags);
|
spin_lock_irqsave(&vha->hw->hardware_lock, flags);
|
||||||
qlt_update_vp_map(vha, RESET_AL_PA);
|
qlt_update_vp_map(vha, RESET_AL_PA);
|
||||||
spin_unlock_irqrestore(&vha->hw->vport_slock, flags);
|
spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
|
||||||
|
|
||||||
qla2x00_mark_vp_devices_dead(vha);
|
qla2x00_mark_vp_devices_dead(vha);
|
||||||
atomic_set(&vha->vp_state, VP_FAILED);
|
atomic_set(&vha->vp_state, VP_FAILED);
|
||||||
|
|
|
@ -7184,20 +7184,14 @@ qlt_update_vp_map(struct scsi_qla_host *vha, int cmd)
|
||||||
|
|
||||||
void qlt_update_host_map(struct scsi_qla_host *vha, port_id_t id)
|
void qlt_update_host_map(struct scsi_qla_host *vha, port_id_t id)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
|
||||||
struct qla_hw_data *ha = vha->hw;
|
|
||||||
|
|
||||||
if (!vha->d_id.b24) {
|
if (!vha->d_id.b24) {
|
||||||
spin_lock_irqsave(&ha->vport_slock, flags);
|
|
||||||
vha->d_id = id;
|
vha->d_id = id;
|
||||||
qlt_update_vp_map(vha, SET_AL_PA);
|
qlt_update_vp_map(vha, SET_AL_PA);
|
||||||
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
|
||||||
} else if (vha->d_id.b24 != id.b24) {
|
} else if (vha->d_id.b24 != id.b24) {
|
||||||
spin_lock_irqsave(&ha->vport_slock, flags);
|
|
||||||
qlt_update_vp_map(vha, RESET_AL_PA);
|
qlt_update_vp_map(vha, RESET_AL_PA);
|
||||||
vha->d_id = id;
|
vha->d_id = id;
|
||||||
qlt_update_vp_map(vha, SET_AL_PA);
|
qlt_update_vp_map(vha, SET_AL_PA);
|
||||||
spin_unlock_irqrestore(&ha->vport_slock, flags);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue