diff options
author | Jitendra Bhivare <jitendra.bhivare@avagotech.com> | 2016-01-20 08:40:48 (GMT) |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-02-24 02:27:02 (GMT) |
commit | 12843f0361cbd879375d3a391e80923c1770d633 (patch) | |
tree | 3242f22ab278d51e768002405e873f52c419edd5 /drivers/scsi | |
parent | cdde6682ab61d24aae4e7f75757a2073e4bff3a3 (diff) | |
download | linux-12843f0361cbd879375d3a391e80923c1770d633.tar.xz |
be2iscsi: Fix to synchronize tag allocation using spin_lock
alloc_mcc_tag needs to be done under mcc_lock.
Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/be2iscsi/be_cmds.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c index 1913e9e..db03149 100644 --- a/drivers/scsi/be2iscsi/be_cmds.c +++ b/drivers/scsi/be2iscsi/be_cmds.c @@ -121,6 +121,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba) { unsigned int tag = 0; + spin_lock(&phba->ctrl.mcc_lock); if (phba->ctrl.mcc_tag_available) { tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index]; phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0; @@ -134,6 +135,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba) else phba->ctrl.mcc_alloc_index++; } + spin_unlock(&phba->ctrl.mcc_lock); return tag; } @@ -254,7 +256,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba, void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag) { - spin_lock(&ctrl->mbox_lock); + spin_lock(&ctrl->mcc_lock); tag = tag & 0x000000FF; ctrl->mcc_tag[ctrl->mcc_free_index] = tag; if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1)) @@ -262,7 +264,7 @@ void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag) else ctrl->mcc_free_index++; ctrl->mcc_tag_available++; - spin_unlock(&ctrl->mbox_lock); + spin_unlock(&ctrl->mcc_lock); } bool is_link_state_evt(u32 trailer) |