diff options
author | Quinn Tran <quinn.tran@cavium.com> | 2017-12-28 21:33:27 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-01-04 05:41:06 +0100 |
commit | 9d1aa4e14e0ba10f946dafd46679f16f93013d58 (patch) | |
tree | 3c357cb0e7c4a2945a468f07ac21796f0d3413b2 /drivers/scsi/qla2xxx/qla_mid.c | |
parent | scsi: qla2xxx: Add switch command to simplify fabric discovery (diff) | |
download | linux-9d1aa4e14e0ba10f946dafd46679f16f93013d58.tar.xz linux-9d1aa4e14e0ba10f946dafd46679f16f93013d58.zip |
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>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mid.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mid.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 2570146beae4..bf365f8a9d32 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -50,10 +50,11 @@ qla24xx_allocate_vp_id(scsi_qla_host_t *vha) spin_lock_irqsave(&ha->vport_slock, flags); list_add_tail(&vha->list, &ha->vp_list); + 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->vport_slock, flags); + spin_unlock_irqrestore(&ha->hardware_lock, flags); mutex_unlock(&ha->vport_lock); return vp_id; @@ -158,9 +159,9 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); /* 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); - spin_unlock_irqrestore(&vha->hw->vport_slock, flags); + spin_unlock_irqrestore(&vha->hw->hardware_lock, flags); qla2x00_mark_vp_devices_dead(vha); atomic_set(&vha->vp_state, VP_FAILED); |