Skip to content

Commit 2409207

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "This is the same set of patches sent in the merge window as the final pull except that Martin's read only rework is replaced with a simple revert of the original change that caused the regression. Everything else is an obvious fix or small cleanup" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: Revert "scsi: sd: Keep disk read-only when re-reading partition" scsi: bnx2fc: fix incorrect cast to u64 on shift operation scsi: smartpqi: Reporting unhandled SCSI errors scsi: myrs: Fix uninitialized variable scsi: lpfc: Update lpfc version to 12.2.0.2 scsi: lpfc: add check for loss of ndlp when sending RRQ scsi: lpfc: correct rcu unlock issue in lpfc_nvme_info_show scsi: lpfc: resolve lockdep warnings scsi: qedi: remove set but not used variables 'cdev' and 'udev' scsi: qedi: remove memset/memcpy to nfunc and use func instead scsi: qla2xxx: Add cleanup for PCI EEH recovery
2 parents 7fbc78e + 8acf608 commit 2409207

File tree

11 files changed

+189
-226
lines changed

11 files changed

+189
-226
lines changed

drivers/scsi/bnx2fc/bnx2fc_hwi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe)
830830
((u64)err_entry->data.err_warn_bitmap_hi << 32) |
831831
(u64)err_entry->data.err_warn_bitmap_lo;
832832
for (i = 0; i < BNX2FC_NUM_ERR_BITS; i++) {
833-
if (err_warn_bit_map & (u64) (1 << i)) {
833+
if (err_warn_bit_map & ((u64)1 << i)) {
834834
err_warn = i;
835835
break;
836836
}

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
176176
int i;
177177
int len = 0;
178178
char tmp[LPFC_MAX_NVME_INFO_TMP_LEN] = {0};
179+
unsigned long iflags = 0;
179180

180181
if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) {
181182
len = scnprintf(buf, PAGE_SIZE, "NVME Disabled\n");
@@ -354,7 +355,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
354355
phba->sli4_hba.io_xri_max,
355356
lpfc_sli4_get_els_iocb_cnt(phba));
356357
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
357-
goto buffer_done;
358+
goto rcu_unlock_buf_done;
358359

359360
/* Port state is only one of two values for now. */
360361
if (localport->port_id)
@@ -370,15 +371,15 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
370371
wwn_to_u64(vport->fc_nodename.u.wwn),
371372
localport->port_id, statep);
372373
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
373-
goto buffer_done;
374+
goto rcu_unlock_buf_done;
374375

375376
list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
376377
nrport = NULL;
377-
spin_lock(&vport->phba->hbalock);
378+
spin_lock_irqsave(&vport->phba->hbalock, iflags);
378379
rport = lpfc_ndlp_get_nrport(ndlp);
379380
if (rport)
380381
nrport = rport->remoteport;
381-
spin_unlock(&vport->phba->hbalock);
382+
spin_unlock_irqrestore(&vport->phba->hbalock, iflags);
382383
if (!nrport)
383384
continue;
384385

@@ -397,52 +398,52 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
397398

398399
/* Tab in to show lport ownership. */
399400
if (strlcat(buf, "NVME RPORT ", PAGE_SIZE) >= PAGE_SIZE)
400-
goto buffer_done;
401+
goto rcu_unlock_buf_done;
401402
if (phba->brd_no >= 10) {
402403
if (strlcat(buf, " ", PAGE_SIZE) >= PAGE_SIZE)
403-
goto buffer_done;
404+
goto rcu_unlock_buf_done;
404405
}
405406

406407
scnprintf(tmp, sizeof(tmp), "WWPN x%llx ",
407408
nrport->port_name);
408409
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
409-
goto buffer_done;
410+
goto rcu_unlock_buf_done;
410411

411412
scnprintf(tmp, sizeof(tmp), "WWNN x%llx ",
412413
nrport->node_name);
413414
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
414-
goto buffer_done;
415+
goto rcu_unlock_buf_done;
415416

416417
scnprintf(tmp, sizeof(tmp), "DID x%06x ",
417418
nrport->port_id);
418419
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
419-
goto buffer_done;
420+
goto rcu_unlock_buf_done;
420421

421422
/* An NVME rport can have multiple roles. */
422423
if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) {
423424
if (strlcat(buf, "INITIATOR ", PAGE_SIZE) >= PAGE_SIZE)
424-
goto buffer_done;
425+
goto rcu_unlock_buf_done;
425426
}
426427
if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) {
427428
if (strlcat(buf, "TARGET ", PAGE_SIZE) >= PAGE_SIZE)
428-
goto buffer_done;
429+
goto rcu_unlock_buf_done;
429430
}
430431
if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) {
431432
if (strlcat(buf, "DISCSRVC ", PAGE_SIZE) >= PAGE_SIZE)
432-
goto buffer_done;
433+
goto rcu_unlock_buf_done;
433434
}
434435
if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR |
435436
FC_PORT_ROLE_NVME_TARGET |
436437
FC_PORT_ROLE_NVME_DISCOVERY)) {
437438
scnprintf(tmp, sizeof(tmp), "UNKNOWN ROLE x%x",
438439
nrport->port_role);
439440
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
440-
goto buffer_done;
441+
goto rcu_unlock_buf_done;
441442
}
442443

443444
scnprintf(tmp, sizeof(tmp), "%s\n", statep);
444445
if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE)
445-
goto buffer_done;
446+
goto rcu_unlock_buf_done;
446447
}
447448
rcu_read_unlock();
448449

@@ -504,7 +505,13 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
504505
atomic_read(&lport->cmpl_fcp_err));
505506
strlcat(buf, tmp, PAGE_SIZE);
506507

507-
buffer_done:
508+
/* RCU is already unlocked. */
509+
goto buffer_done;
510+
511+
rcu_unlock_buf_done:
512+
rcu_read_unlock();
513+
514+
buffer_done:
508515
len = strnlen(buf, PAGE_SIZE);
509516

510517
if (unlikely(len >= (PAGE_SIZE - 1))) {

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7334,7 +7334,10 @@ int
73347334
lpfc_send_rrq(struct lpfc_hba *phba, struct lpfc_node_rrq *rrq)
73357335
{
73367336
struct lpfc_nodelist *ndlp = lpfc_findnode_did(rrq->vport,
7337-
rrq->nlp_DID);
7337+
rrq->nlp_DID);
7338+
if (!ndlp)
7339+
return 1;
7340+
73387341
if (lpfc_test_rrq_active(phba, ndlp, rrq->xritag))
73397342
return lpfc_issue_els_rrq(rrq->vport, ndlp,
73407343
rrq->nlp_DID, rrq);

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -991,15 +991,14 @@ lpfc_cleanup_vports_rrqs(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
991991
* @ndlp: Targets nodelist pointer for this exchange.
992992
* @xritag the xri in the bitmap to test.
993993
*
994-
* This function is called with hbalock held. This function
995-
* returns 0 = rrq not active for this xri
996-
* 1 = rrq is valid for this xri.
994+
* This function returns:
995+
* 0 = rrq not active for this xri
996+
* 1 = rrq is valid for this xri.
997997
**/
998998
int
999999
lpfc_test_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
10001000
uint16_t xritag)
10011001
{
1002-
lockdep_assert_held(&phba->hbalock);
10031002
if (!ndlp)
10041003
return 0;
10051004
if (!ndlp->active_rrqs_xri_bitmap)
@@ -1102,10 +1101,11 @@ lpfc_set_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
11021101
* @phba: Pointer to HBA context object.
11031102
* @piocb: Pointer to the iocbq.
11041103
*
1105-
* This function is called with the ring lock held. This function
1106-
* gets a new driver sglq object from the sglq list. If the
1107-
* list is not empty then it is successful, it returns pointer to the newly
1108-
* allocated sglq object else it returns NULL.
1104+
* The driver calls this function with either the nvme ls ring lock
1105+
* or the fc els ring lock held depending on the iocb usage. This function
1106+
* gets a new driver sglq object from the sglq list. If the list is not empty
1107+
* then it is successful, it returns pointer to the newly allocated sglq
1108+
* object else it returns NULL.
11091109
**/
11101110
static struct lpfc_sglq *
11111111
__lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq)
@@ -1115,9 +1115,15 @@ __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq)
11151115
struct lpfc_sglq *start_sglq = NULL;
11161116
struct lpfc_io_buf *lpfc_cmd;
11171117
struct lpfc_nodelist *ndlp;
1118+
struct lpfc_sli_ring *pring = NULL;
11181119
int found = 0;
11191120

1120-
lockdep_assert_held(&phba->hbalock);
1121+
if (piocbq->iocb_flag & LPFC_IO_NVME_LS)
1122+
pring = phba->sli4_hba.nvmels_wq->pring;
1123+
else
1124+
pring = lpfc_phba_elsring(phba);
1125+
1126+
lockdep_assert_held(&pring->ring_lock);
11211127

11221128
if (piocbq->iocb_flag & LPFC_IO_FCP) {
11231129
lpfc_cmd = (struct lpfc_io_buf *) piocbq->context1;
@@ -1560,7 +1566,8 @@ lpfc_sli_ring_map(struct lpfc_hba *phba)
15601566
* @pring: Pointer to driver SLI ring object.
15611567
* @piocb: Pointer to the driver iocb object.
15621568
*
1563-
* This function is called with hbalock held. The function adds the
1569+
* The driver calls this function with the hbalock held for SLI3 ports or
1570+
* the ring lock held for SLI4 ports. The function adds the
15641571
* new iocb to txcmplq of the given ring. This function always returns
15651572
* 0. If this function is called for ELS ring, this function checks if
15661573
* there is a vport associated with the ELS command. This function also
@@ -1570,7 +1577,10 @@ static int
15701577
lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
15711578
struct lpfc_iocbq *piocb)
15721579
{
1573-
lockdep_assert_held(&phba->hbalock);
1580+
if (phba->sli_rev == LPFC_SLI_REV4)
1581+
lockdep_assert_held(&pring->ring_lock);
1582+
else
1583+
lockdep_assert_held(&phba->hbalock);
15741584

15751585
BUG_ON(!piocb);
15761586

@@ -2967,8 +2977,8 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
29672977
*
29682978
* This function looks up the iocb_lookup table to get the command iocb
29692979
* corresponding to the given response iocb using the iotag of the
2970-
* response iocb. This function is called with the hbalock held
2971-
* for sli3 devices or the ring_lock for sli4 devices.
2980+
* response iocb. The driver calls this function with the hbalock held
2981+
* for SLI3 ports or the ring lock held for SLI4 ports.
29722982
* This function returns the command iocb object if it finds the command
29732983
* iocb else returns NULL.
29742984
**/
@@ -2979,8 +2989,15 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
29792989
{
29802990
struct lpfc_iocbq *cmd_iocb = NULL;
29812991
uint16_t iotag;
2982-
lockdep_assert_held(&phba->hbalock);
2992+
spinlock_t *temp_lock = NULL;
2993+
unsigned long iflag = 0;
29832994

2995+
if (phba->sli_rev == LPFC_SLI_REV4)
2996+
temp_lock = &pring->ring_lock;
2997+
else
2998+
temp_lock = &phba->hbalock;
2999+
3000+
spin_lock_irqsave(temp_lock, iflag);
29843001
iotag = prspiocb->iocb.ulpIoTag;
29853002

29863003
if (iotag != 0 && iotag <= phba->sli.last_iotag) {
@@ -2990,10 +3007,12 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
29903007
list_del_init(&cmd_iocb->list);
29913008
cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ;
29923009
pring->txcmplq_cnt--;
3010+
spin_unlock_irqrestore(temp_lock, iflag);
29933011
return cmd_iocb;
29943012
}
29953013
}
29963014

3015+
spin_unlock_irqrestore(temp_lock, iflag);
29973016
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
29983017
"0317 iotag x%x is out of "
29993018
"range: max iotag x%x wd0 x%x\n",
@@ -3009,8 +3028,8 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
30093028
* @iotag: IOCB tag.
30103029
*
30113030
* This function looks up the iocb_lookup table to get the command iocb
3012-
* corresponding to the given iotag. This function is called with the
3013-
* hbalock held.
3031+
* corresponding to the given iotag. The driver calls this function with
3032+
* the ring lock held because this function is an SLI4 port only helper.
30143033
* This function returns the command iocb object if it finds the command
30153034
* iocb else returns NULL.
30163035
**/
@@ -3019,19 +3038,28 @@ lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba,
30193038
struct lpfc_sli_ring *pring, uint16_t iotag)
30203039
{
30213040
struct lpfc_iocbq *cmd_iocb = NULL;
3041+
spinlock_t *temp_lock = NULL;
3042+
unsigned long iflag = 0;
30223043

3023-
lockdep_assert_held(&phba->hbalock);
3044+
if (phba->sli_rev == LPFC_SLI_REV4)
3045+
temp_lock = &pring->ring_lock;
3046+
else
3047+
temp_lock = &phba->hbalock;
3048+
3049+
spin_lock_irqsave(temp_lock, iflag);
30243050
if (iotag != 0 && iotag <= phba->sli.last_iotag) {
30253051
cmd_iocb = phba->sli.iocbq_lookup[iotag];
30263052
if (cmd_iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ) {
30273053
/* remove from txcmpl queue list */
30283054
list_del_init(&cmd_iocb->list);
30293055
cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ;
30303056
pring->txcmplq_cnt--;
3057+
spin_unlock_irqrestore(temp_lock, iflag);
30313058
return cmd_iocb;
30323059
}
30333060
}
30343061

3062+
spin_unlock_irqrestore(temp_lock, iflag);
30353063
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
30363064
"0372 iotag x%x lookup error: max iotag (x%x) "
30373065
"iocb_flag x%x\n",
@@ -3065,17 +3093,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
30653093
int rc = 1;
30663094
unsigned long iflag;
30673095

3068-
/* Based on the iotag field, get the cmd IOCB from the txcmplq */
3069-
if (phba->sli_rev == LPFC_SLI_REV4)
3070-
spin_lock_irqsave(&pring->ring_lock, iflag);
3071-
else
3072-
spin_lock_irqsave(&phba->hbalock, iflag);
30733096
cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq);
3074-
if (phba->sli_rev == LPFC_SLI_REV4)
3075-
spin_unlock_irqrestore(&pring->ring_lock, iflag);
3076-
else
3077-
spin_unlock_irqrestore(&phba->hbalock, iflag);
3078-
30793097
if (cmdiocbp) {
30803098
if (cmdiocbp->iocb_cmpl) {
30813099
/*
@@ -3406,8 +3424,10 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
34063424
break;
34073425
}
34083426

3427+
spin_unlock_irqrestore(&phba->hbalock, iflag);
34093428
cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring,
34103429
&rspiocbq);
3430+
spin_lock_irqsave(&phba->hbalock, iflag);
34113431
if (unlikely(!cmdiocbq))
34123432
break;
34133433
if (cmdiocbq->iocb_flag & LPFC_DRIVER_ABORTED)
@@ -3601,9 +3621,12 @@ lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
36013621

36023622
case LPFC_ABORT_IOCB:
36033623
cmdiocbp = NULL;
3604-
if (irsp->ulpCommand != CMD_XRI_ABORTED_CX)
3624+
if (irsp->ulpCommand != CMD_XRI_ABORTED_CX) {
3625+
spin_unlock_irqrestore(&phba->hbalock, iflag);
36053626
cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring,
36063627
saveq);
3628+
spin_lock_irqsave(&phba->hbalock, iflag);
3629+
}
36073630
if (cmdiocbp) {
36083631
/* Call the specified completion routine */
36093632
if (cmdiocbp->iocb_cmpl) {
@@ -12976,13 +12999,11 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba,
1297612999
return NULL;
1297713000

1297813001
wcqe = &irspiocbq->cq_event.cqe.wcqe_cmpl;
12979-
spin_lock_irqsave(&pring->ring_lock, iflags);
1298013002
pring->stats.iocb_event++;
1298113003
/* Look up the ELS command IOCB and create pseudo response IOCB */
1298213004
cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring,
1298313005
bf_get(lpfc_wcqe_c_request_tag, wcqe));
1298413006
if (unlikely(!cmdiocbq)) {
12985-
spin_unlock_irqrestore(&pring->ring_lock, iflags);
1298613007
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
1298713008
"0386 ELS complete with no corresponding "
1298813009
"cmdiocb: 0x%x 0x%x 0x%x 0x%x\n",
@@ -12992,6 +13013,7 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba,
1299213013
return NULL;
1299313014
}
1299413015

13016+
spin_lock_irqsave(&pring->ring_lock, iflags);
1299513017
/* Put the iocb back on the txcmplq */
1299613018
lpfc_sli_ringtxcmpl_put(phba, pring, cmdiocbq);
1299713019
spin_unlock_irqrestore(&pring->ring_lock, iflags);
@@ -13762,9 +13784,9 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,
1376213784
/* Look up the FCP command IOCB and create pseudo response IOCB */
1376313785
spin_lock_irqsave(&pring->ring_lock, iflags);
1376413786
pring->stats.iocb_event++;
13787+
spin_unlock_irqrestore(&pring->ring_lock, iflags);
1376513788
cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring,
1376613789
bf_get(lpfc_wcqe_c_request_tag, wcqe));
13767-
spin_unlock_irqrestore(&pring->ring_lock, iflags);
1376813790
if (unlikely(!cmdiocbq)) {
1376913791
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
1377013792
"0374 FCP complete with no corresponding "

drivers/scsi/lpfc/lpfc_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* included with this package. *
2121
*******************************************************************/
2222

23-
#define LPFC_DRIVER_VERSION "12.2.0.1"
23+
#define LPFC_DRIVER_VERSION "12.2.0.2"
2424
#define LPFC_DRIVER_NAME "lpfc"
2525

2626
/* Used for SLI 2/3 */

drivers/scsi/myrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ static void myrs_log_event(struct myrs_hba *cs, struct myrs_event *ev)
818818
unsigned char ev_type, *ev_msg;
819819
struct Scsi_Host *shost = cs->host;
820820
struct scsi_device *sdev;
821-
struct scsi_sense_hdr sshdr;
821+
struct scsi_sense_hdr sshdr = {0};
822822
unsigned char sense_info[4];
823823
unsigned char cmd_specific[4];
824824

0 commit comments

Comments
 (0)