Commit 12843f03 authored by Jitendra Bhivare's avatar Jitendra Bhivare Committed by Martin K. Petersen

be2iscsi: Fix to synchronize tag allocation using spin_lock

alloc_mcc_tag needs to be done under mcc_lock.
Signed-off-by: default avatarJitendra Bhivare <jitendra.bhivare@avagotech.com>
Reviewed-by: default avatarHannes Reinicke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent cdde6682
...@@ -121,6 +121,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba) ...@@ -121,6 +121,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
{ {
unsigned int tag = 0; unsigned int tag = 0;
spin_lock(&phba->ctrl.mcc_lock);
if (phba->ctrl.mcc_tag_available) { if (phba->ctrl.mcc_tag_available) {
tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index]; tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index];
phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0; phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0;
...@@ -134,6 +135,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba) ...@@ -134,6 +135,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
else else
phba->ctrl.mcc_alloc_index++; phba->ctrl.mcc_alloc_index++;
} }
spin_unlock(&phba->ctrl.mcc_lock);
return tag; return tag;
} }
...@@ -254,7 +256,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba, ...@@ -254,7 +256,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag) 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; tag = tag & 0x000000FF;
ctrl->mcc_tag[ctrl->mcc_free_index] = tag; ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1)) 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) ...@@ -262,7 +264,7 @@ void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
else else
ctrl->mcc_free_index++; ctrl->mcc_free_index++;
ctrl->mcc_tag_available++; ctrl->mcc_tag_available++;
spin_unlock(&ctrl->mbox_lock); spin_unlock(&ctrl->mcc_lock);
} }
bool is_link_state_evt(u32 trailer) bool is_link_state_evt(u32 trailer)
......
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