aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2013-09-06 12:22:38 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-09-10 20:31:49 -0400
commit164cecd1b9aed821d29ee9543ea4ad7435321823 (patch)
treebf336546a19fcfd4ffe275843d9b788650a0745c /drivers/scsi/lpfc
parentafbd8d8884325bcc4fc4c12fcb2eccbf9356feca (diff)
[SCSI] lpfc 8.3.42: Fixed inconsistent spin lock usage.
Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c8
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c26
2 files changed, 16 insertions, 18 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index c6f1333476fd..647f5bfb3bd3 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -3031,10 +3031,10 @@ lpfc_sli4_xri_sgl_update(struct lpfc_hba *phba)
3031 phba->sli4_hba.scsi_xri_max); 3031 phba->sli4_hba.scsi_xri_max);
3032 3032
3033 spin_lock_irq(&phba->scsi_buf_list_get_lock); 3033 spin_lock_irq(&phba->scsi_buf_list_get_lock);
3034 spin_lock_irq(&phba->scsi_buf_list_put_lock); 3034 spin_lock(&phba->scsi_buf_list_put_lock);
3035 list_splice_init(&phba->lpfc_scsi_buf_list_get, &scsi_sgl_list); 3035 list_splice_init(&phba->lpfc_scsi_buf_list_get, &scsi_sgl_list);
3036 list_splice(&phba->lpfc_scsi_buf_list_put, &scsi_sgl_list); 3036 list_splice(&phba->lpfc_scsi_buf_list_put, &scsi_sgl_list);
3037 spin_unlock_irq(&phba->scsi_buf_list_put_lock); 3037 spin_unlock(&phba->scsi_buf_list_put_lock);
3038 spin_unlock_irq(&phba->scsi_buf_list_get_lock); 3038 spin_unlock_irq(&phba->scsi_buf_list_get_lock);
3039 3039
3040 if (phba->sli4_hba.scsi_xri_cnt > phba->sli4_hba.scsi_xri_max) { 3040 if (phba->sli4_hba.scsi_xri_cnt > phba->sli4_hba.scsi_xri_max) {
@@ -3070,10 +3070,10 @@ lpfc_sli4_xri_sgl_update(struct lpfc_hba *phba)
3070 psb->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; 3070 psb->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri];
3071 } 3071 }
3072 spin_lock_irq(&phba->scsi_buf_list_get_lock); 3072 spin_lock_irq(&phba->scsi_buf_list_get_lock);
3073 spin_lock_irq(&phba->scsi_buf_list_put_lock); 3073 spin_lock(&phba->scsi_buf_list_put_lock);
3074 list_splice_init(&scsi_sgl_list, &phba->lpfc_scsi_buf_list_get); 3074 list_splice_init(&scsi_sgl_list, &phba->lpfc_scsi_buf_list_get);
3075 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); 3075 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put);
3076 spin_unlock_irq(&phba->scsi_buf_list_put_lock); 3076 spin_unlock(&phba->scsi_buf_list_put_lock);
3077 spin_unlock_irq(&phba->scsi_buf_list_get_lock); 3077 spin_unlock_irq(&phba->scsi_buf_list_get_lock);
3078 3078
3079 return 0; 3079 return 0;
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index c0117dd4b9cc..556bc7a54a1f 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -926,10 +926,10 @@ lpfc_sli4_repost_scsi_sgl_list(struct lpfc_hba *phba)
926 926
927 /* get all SCSI buffers need to repost to a local list */ 927 /* get all SCSI buffers need to repost to a local list */
928 spin_lock_irq(&phba->scsi_buf_list_get_lock); 928 spin_lock_irq(&phba->scsi_buf_list_get_lock);
929 spin_lock_irq(&phba->scsi_buf_list_put_lock); 929 spin_lock(&phba->scsi_buf_list_put_lock);
930 list_splice_init(&phba->lpfc_scsi_buf_list_get, &post_sblist); 930 list_splice_init(&phba->lpfc_scsi_buf_list_get, &post_sblist);
931 list_splice(&phba->lpfc_scsi_buf_list_put, &post_sblist); 931 list_splice(&phba->lpfc_scsi_buf_list_put, &post_sblist);
932 spin_unlock_irq(&phba->scsi_buf_list_put_lock); 932 spin_unlock(&phba->scsi_buf_list_put_lock);
933 spin_unlock_irq(&phba->scsi_buf_list_get_lock); 933 spin_unlock_irq(&phba->scsi_buf_list_get_lock);
934 934
935 /* post the list of scsi buffer sgls to port if available */ 935 /* post the list of scsi buffer sgls to port if available */
@@ -1137,22 +1137,21 @@ lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
1137{ 1137{
1138 struct lpfc_scsi_buf * lpfc_cmd = NULL; 1138 struct lpfc_scsi_buf * lpfc_cmd = NULL;
1139 struct list_head *scsi_buf_list_get = &phba->lpfc_scsi_buf_list_get; 1139 struct list_head *scsi_buf_list_get = &phba->lpfc_scsi_buf_list_get;
1140 unsigned long gflag = 0; 1140 unsigned long iflag = 0;
1141 unsigned long pflag = 0;
1142 1141
1143 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag); 1142 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, iflag);
1144 list_remove_head(scsi_buf_list_get, lpfc_cmd, struct lpfc_scsi_buf, 1143 list_remove_head(scsi_buf_list_get, lpfc_cmd, struct lpfc_scsi_buf,
1145 list); 1144 list);
1146 if (!lpfc_cmd) { 1145 if (!lpfc_cmd) {
1147 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, pflag); 1146 spin_lock(&phba->scsi_buf_list_put_lock);
1148 list_splice(&phba->lpfc_scsi_buf_list_put, 1147 list_splice(&phba->lpfc_scsi_buf_list_put,
1149 &phba->lpfc_scsi_buf_list_get); 1148 &phba->lpfc_scsi_buf_list_get);
1150 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); 1149 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put);
1151 list_remove_head(scsi_buf_list_get, lpfc_cmd, 1150 list_remove_head(scsi_buf_list_get, lpfc_cmd,
1152 struct lpfc_scsi_buf, list); 1151 struct lpfc_scsi_buf, list);
1153 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag); 1152 spin_unlock(&phba->scsi_buf_list_put_lock);
1154 } 1153 }
1155 spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, gflag); 1154 spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag);
1156 return lpfc_cmd; 1155 return lpfc_cmd;
1157} 1156}
1158/** 1157/**
@@ -1170,11 +1169,10 @@ static struct lpfc_scsi_buf*
1170lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) 1169lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
1171{ 1170{
1172 struct lpfc_scsi_buf *lpfc_cmd, *lpfc_cmd_next; 1171 struct lpfc_scsi_buf *lpfc_cmd, *lpfc_cmd_next;
1173 unsigned long gflag = 0; 1172 unsigned long iflag = 0;
1174 unsigned long pflag = 0;
1175 int found = 0; 1173 int found = 0;
1176 1174
1177 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, gflag); 1175 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, iflag);
1178 list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, 1176 list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next,
1179 &phba->lpfc_scsi_buf_list_get, list) { 1177 &phba->lpfc_scsi_buf_list_get, list) {
1180 if (lpfc_test_rrq_active(phba, ndlp, 1178 if (lpfc_test_rrq_active(phba, ndlp,
@@ -1185,11 +1183,11 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
1185 break; 1183 break;
1186 } 1184 }
1187 if (!found) { 1185 if (!found) {
1188 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, pflag); 1186 spin_lock(&phba->scsi_buf_list_put_lock);
1189 list_splice(&phba->lpfc_scsi_buf_list_put, 1187 list_splice(&phba->lpfc_scsi_buf_list_put,
1190 &phba->lpfc_scsi_buf_list_get); 1188 &phba->lpfc_scsi_buf_list_get);
1191 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); 1189 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put);
1192 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, pflag); 1190 spin_unlock(&phba->scsi_buf_list_put_lock);
1193 list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next, 1191 list_for_each_entry_safe(lpfc_cmd, lpfc_cmd_next,
1194 &phba->lpfc_scsi_buf_list_get, list) { 1192 &phba->lpfc_scsi_buf_list_get, list) {
1195 if (lpfc_test_rrq_active( 1193 if (lpfc_test_rrq_active(
@@ -1200,7 +1198,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
1200 break; 1198 break;
1201 } 1199 }
1202 } 1200 }
1203 spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, gflag); 1201 spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag);
1204 if (!found) 1202 if (!found)
1205 return NULL; 1203 return NULL;
1206 return lpfc_cmd; 1204 return lpfc_cmd;