diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-24 20:30:28 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-24 20:30:28 -0400 |
| commit | 2409207a73cc8e4aff75ceccf6fe5c3ce4d391bc (patch) | |
| tree | 2c3b3e2da5cc22d04f871fd4d69f41e6a5b6bb56 | |
| parent | 7fbc78e3155a0c464bd832efc07fb3c2355fe9bd (diff) | |
| parent | 8acf608e602f6ec38b7cc37b04c80f1ce9a1a6cc (diff) | |
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
| -rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_hwi.c | 2 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 37 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 5 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 84 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_version.h | 2 | ||||
| -rw-r--r-- | drivers/scsi/myrs.c | 2 | ||||
| -rw-r--r-- | drivers/scsi/qedi/qedi_dbg.c | 32 | ||||
| -rw-r--r-- | drivers/scsi/qedi/qedi_iscsi.c | 4 | ||||
| -rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 221 | ||||
| -rw-r--r-- | drivers/scsi/sd.c | 3 | ||||
| -rw-r--r-- | drivers/scsi/smartpqi/smartpqi_init.c | 23 |
11 files changed, 189 insertions, 226 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c index 19734ec7f42e..747f019fb393 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c | |||
| @@ -830,7 +830,7 @@ ret_err_rqe: | |||
| 830 | ((u64)err_entry->data.err_warn_bitmap_hi << 32) | | 830 | ((u64)err_entry->data.err_warn_bitmap_hi << 32) | |
| 831 | (u64)err_entry->data.err_warn_bitmap_lo; | 831 | (u64)err_entry->data.err_warn_bitmap_lo; |
| 832 | for (i = 0; i < BNX2FC_NUM_ERR_BITS; i++) { | 832 | 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)) { |
| 834 | err_warn = i; | 834 | err_warn = i; |
| 835 | break; | 835 | break; |
| 836 | } | 836 | } |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index e9adb3f1961d..d4c65e2109e2 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
| @@ -176,6 +176,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, | |||
| 176 | int i; | 176 | int i; |
| 177 | int len = 0; | 177 | int len = 0; |
| 178 | char tmp[LPFC_MAX_NVME_INFO_TMP_LEN] = {0}; | 178 | char tmp[LPFC_MAX_NVME_INFO_TMP_LEN] = {0}; |
| 179 | unsigned long iflags = 0; | ||
| 179 | 180 | ||
| 180 | if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { | 181 | if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { |
| 181 | len = scnprintf(buf, PAGE_SIZE, "NVME Disabled\n"); | 182 | len = scnprintf(buf, PAGE_SIZE, "NVME Disabled\n"); |
| @@ -354,7 +355,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, | |||
| 354 | phba->sli4_hba.io_xri_max, | 355 | phba->sli4_hba.io_xri_max, |
| 355 | lpfc_sli4_get_els_iocb_cnt(phba)); | 356 | lpfc_sli4_get_els_iocb_cnt(phba)); |
| 356 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) | 357 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) |
| 357 | goto buffer_done; | 358 | goto rcu_unlock_buf_done; |
| 358 | 359 | ||
| 359 | /* Port state is only one of two values for now. */ | 360 | /* Port state is only one of two values for now. */ |
| 360 | if (localport->port_id) | 361 | if (localport->port_id) |
| @@ -370,15 +371,15 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, | |||
| 370 | wwn_to_u64(vport->fc_nodename.u.wwn), | 371 | wwn_to_u64(vport->fc_nodename.u.wwn), |
| 371 | localport->port_id, statep); | 372 | localport->port_id, statep); |
| 372 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) | 373 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) |
| 373 | goto buffer_done; | 374 | goto rcu_unlock_buf_done; |
| 374 | 375 | ||
| 375 | list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { | 376 | list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { |
| 376 | nrport = NULL; | 377 | nrport = NULL; |
| 377 | spin_lock(&vport->phba->hbalock); | 378 | spin_lock_irqsave(&vport->phba->hbalock, iflags); |
| 378 | rport = lpfc_ndlp_get_nrport(ndlp); | 379 | rport = lpfc_ndlp_get_nrport(ndlp); |
| 379 | if (rport) | 380 | if (rport) |
| 380 | nrport = rport->remoteport; | 381 | nrport = rport->remoteport; |
| 381 | spin_unlock(&vport->phba->hbalock); | 382 | spin_unlock_irqrestore(&vport->phba->hbalock, iflags); |
| 382 | if (!nrport) | 383 | if (!nrport) |
| 383 | continue; | 384 | continue; |
| 384 | 385 | ||
| @@ -397,39 +398,39 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, | |||
| 397 | 398 | ||
| 398 | /* Tab in to show lport ownership. */ | 399 | /* Tab in to show lport ownership. */ |
| 399 | if (strlcat(buf, "NVME RPORT ", PAGE_SIZE) >= PAGE_SIZE) | 400 | if (strlcat(buf, "NVME RPORT ", PAGE_SIZE) >= PAGE_SIZE) |
| 400 | goto buffer_done; | 401 | goto rcu_unlock_buf_done; |
| 401 | if (phba->brd_no >= 10) { | 402 | if (phba->brd_no >= 10) { |
| 402 | if (strlcat(buf, " ", PAGE_SIZE) >= PAGE_SIZE) | 403 | if (strlcat(buf, " ", PAGE_SIZE) >= PAGE_SIZE) |
| 403 | goto buffer_done; | 404 | goto rcu_unlock_buf_done; |
| 404 | } | 405 | } |
| 405 | 406 | ||
| 406 | scnprintf(tmp, sizeof(tmp), "WWPN x%llx ", | 407 | scnprintf(tmp, sizeof(tmp), "WWPN x%llx ", |
| 407 | nrport->port_name); | 408 | nrport->port_name); |
| 408 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) | 409 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) |
| 409 | goto buffer_done; | 410 | goto rcu_unlock_buf_done; |
| 410 | 411 | ||
| 411 | scnprintf(tmp, sizeof(tmp), "WWNN x%llx ", | 412 | scnprintf(tmp, sizeof(tmp), "WWNN x%llx ", |
| 412 | nrport->node_name); | 413 | nrport->node_name); |
| 413 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) | 414 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) |
| 414 | goto buffer_done; | 415 | goto rcu_unlock_buf_done; |
| 415 | 416 | ||
| 416 | scnprintf(tmp, sizeof(tmp), "DID x%06x ", | 417 | scnprintf(tmp, sizeof(tmp), "DID x%06x ", |
| 417 | nrport->port_id); | 418 | nrport->port_id); |
| 418 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) | 419 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) |
| 419 | goto buffer_done; | 420 | goto rcu_unlock_buf_done; |
| 420 | 421 | ||
| 421 | /* An NVME rport can have multiple roles. */ | 422 | /* An NVME rport can have multiple roles. */ |
| 422 | if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) { | 423 | if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) { |
| 423 | if (strlcat(buf, "INITIATOR ", PAGE_SIZE) >= PAGE_SIZE) | 424 | if (strlcat(buf, "INITIATOR ", PAGE_SIZE) >= PAGE_SIZE) |
| 424 | goto buffer_done; | 425 | goto rcu_unlock_buf_done; |
| 425 | } | 426 | } |
| 426 | if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) { | 427 | if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) { |
| 427 | if (strlcat(buf, "TARGET ", PAGE_SIZE) >= PAGE_SIZE) | 428 | if (strlcat(buf, "TARGET ", PAGE_SIZE) >= PAGE_SIZE) |
| 428 | goto buffer_done; | 429 | goto rcu_unlock_buf_done; |
| 429 | } | 430 | } |
| 430 | if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) { | 431 | if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) { |
| 431 | if (strlcat(buf, "DISCSRVC ", PAGE_SIZE) >= PAGE_SIZE) | 432 | if (strlcat(buf, "DISCSRVC ", PAGE_SIZE) >= PAGE_SIZE) |
| 432 | goto buffer_done; | 433 | goto rcu_unlock_buf_done; |
| 433 | } | 434 | } |
| 434 | if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | | 435 | if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | |
| 435 | FC_PORT_ROLE_NVME_TARGET | | 436 | FC_PORT_ROLE_NVME_TARGET | |
| @@ -437,12 +438,12 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, | |||
| 437 | scnprintf(tmp, sizeof(tmp), "UNKNOWN ROLE x%x", | 438 | scnprintf(tmp, sizeof(tmp), "UNKNOWN ROLE x%x", |
| 438 | nrport->port_role); | 439 | nrport->port_role); |
| 439 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) | 440 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) |
| 440 | goto buffer_done; | 441 | goto rcu_unlock_buf_done; |
| 441 | } | 442 | } |
| 442 | 443 | ||
| 443 | scnprintf(tmp, sizeof(tmp), "%s\n", statep); | 444 | scnprintf(tmp, sizeof(tmp), "%s\n", statep); |
| 444 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) | 445 | if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) |
| 445 | goto buffer_done; | 446 | goto rcu_unlock_buf_done; |
| 446 | } | 447 | } |
| 447 | rcu_read_unlock(); | 448 | rcu_read_unlock(); |
| 448 | 449 | ||
| @@ -504,7 +505,13 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, | |||
| 504 | atomic_read(&lport->cmpl_fcp_err)); | 505 | atomic_read(&lport->cmpl_fcp_err)); |
| 505 | strlcat(buf, tmp, PAGE_SIZE); | 506 | strlcat(buf, tmp, PAGE_SIZE); |
| 506 | 507 | ||
| 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: | ||
| 508 | len = strnlen(buf, PAGE_SIZE); | 515 | len = strnlen(buf, PAGE_SIZE); |
| 509 | 516 | ||
| 510 | if (unlikely(len >= (PAGE_SIZE - 1))) { | 517 | if (unlikely(len >= (PAGE_SIZE - 1))) { |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index c8fb0b455f2a..5ac4f8d76b91 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
| @@ -7334,7 +7334,10 @@ int | |||
| 7334 | lpfc_send_rrq(struct lpfc_hba *phba, struct lpfc_node_rrq *rrq) | 7334 | lpfc_send_rrq(struct lpfc_hba *phba, struct lpfc_node_rrq *rrq) |
| 7335 | { | 7335 | { |
| 7336 | struct lpfc_nodelist *ndlp = lpfc_findnode_did(rrq->vport, | 7336 | struct lpfc_nodelist *ndlp = lpfc_findnode_did(rrq->vport, |
| 7337 | rrq->nlp_DID); | 7337 | rrq->nlp_DID); |
| 7338 | if (!ndlp) | ||
| 7339 | return 1; | ||
| 7340 | |||
| 7338 | if (lpfc_test_rrq_active(phba, ndlp, rrq->xritag)) | 7341 | if (lpfc_test_rrq_active(phba, ndlp, rrq->xritag)) |
| 7339 | return lpfc_issue_els_rrq(rrq->vport, ndlp, | 7342 | return lpfc_issue_els_rrq(rrq->vport, ndlp, |
| 7340 | rrq->nlp_DID, rrq); | 7343 | rrq->nlp_DID, rrq); |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 2acda188b0dc..d1512e4f9791 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
| @@ -991,15 +991,14 @@ lpfc_cleanup_vports_rrqs(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | |||
| 991 | * @ndlp: Targets nodelist pointer for this exchange. | 991 | * @ndlp: Targets nodelist pointer for this exchange. |
| 992 | * @xritag the xri in the bitmap to test. | 992 | * @xritag the xri in the bitmap to test. |
| 993 | * | 993 | * |
| 994 | * This function is called with hbalock held. This function | 994 | * This function returns: |
| 995 | * returns 0 = rrq not active for this xri | 995 | * 0 = rrq not active for this xri |
| 996 | * 1 = rrq is valid for this xri. | 996 | * 1 = rrq is valid for this xri. |
| 997 | **/ | 997 | **/ |
| 998 | int | 998 | int |
| 999 | lpfc_test_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | 999 | lpfc_test_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, |
| 1000 | uint16_t xritag) | 1000 | uint16_t xritag) |
| 1001 | { | 1001 | { |
| 1002 | lockdep_assert_held(&phba->hbalock); | ||
| 1003 | if (!ndlp) | 1002 | if (!ndlp) |
| 1004 | return 0; | 1003 | return 0; |
| 1005 | if (!ndlp->active_rrqs_xri_bitmap) | 1004 | if (!ndlp->active_rrqs_xri_bitmap) |
| @@ -1102,10 +1101,11 @@ out: | |||
| 1102 | * @phba: Pointer to HBA context object. | 1101 | * @phba: Pointer to HBA context object. |
| 1103 | * @piocb: Pointer to the iocbq. | 1102 | * @piocb: Pointer to the iocbq. |
| 1104 | * | 1103 | * |
| 1105 | * This function is called with the ring lock held. This function | 1104 | * The driver calls this function with either the nvme ls ring lock |
| 1106 | * gets a new driver sglq object from the sglq list. If the | 1105 | * or the fc els ring lock held depending on the iocb usage. This function |
| 1107 | * list is not empty then it is successful, it returns pointer to the newly | 1106 | * gets a new driver sglq object from the sglq list. If the list is not empty |
| 1108 | * allocated sglq object else it returns NULL. | 1107 | * then it is successful, it returns pointer to the newly allocated sglq |
| 1108 | * object else it returns NULL. | ||
| 1109 | **/ | 1109 | **/ |
| 1110 | static struct lpfc_sglq * | 1110 | static struct lpfc_sglq * |
| 1111 | __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq) | 1111 | __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) | |||
| 1115 | struct lpfc_sglq *start_sglq = NULL; | 1115 | struct lpfc_sglq *start_sglq = NULL; |
| 1116 | struct lpfc_io_buf *lpfc_cmd; | 1116 | struct lpfc_io_buf *lpfc_cmd; |
| 1117 | struct lpfc_nodelist *ndlp; | 1117 | struct lpfc_nodelist *ndlp; |
| 1118 | struct lpfc_sli_ring *pring = NULL; | ||
| 1118 | int found = 0; | 1119 | int found = 0; |
| 1119 | 1120 | ||
| 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); | ||
| 1121 | 1127 | ||
| 1122 | if (piocbq->iocb_flag & LPFC_IO_FCP) { | 1128 | if (piocbq->iocb_flag & LPFC_IO_FCP) { |
| 1123 | lpfc_cmd = (struct lpfc_io_buf *) piocbq->context1; | 1129 | lpfc_cmd = (struct lpfc_io_buf *) piocbq->context1; |
| @@ -1560,7 +1566,8 @@ lpfc_sli_ring_map(struct lpfc_hba *phba) | |||
| 1560 | * @pring: Pointer to driver SLI ring object. | 1566 | * @pring: Pointer to driver SLI ring object. |
| 1561 | * @piocb: Pointer to the driver iocb object. | 1567 | * @piocb: Pointer to the driver iocb object. |
| 1562 | * | 1568 | * |
| 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 | ||
| 1564 | * new iocb to txcmplq of the given ring. This function always returns | 1571 | * new iocb to txcmplq of the given ring. This function always returns |
| 1565 | * 0. If this function is called for ELS ring, this function checks if | 1572 | * 0. If this function is called for ELS ring, this function checks if |
| 1566 | * there is a vport associated with the ELS command. This function also | 1573 | * there is a vport associated with the ELS command. This function also |
| @@ -1570,7 +1577,10 @@ static int | |||
| 1570 | lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | 1577 | lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, |
| 1571 | struct lpfc_iocbq *piocb) | 1578 | struct lpfc_iocbq *piocb) |
| 1572 | { | 1579 | { |
| 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); | ||
| 1574 | 1584 | ||
| 1575 | BUG_ON(!piocb); | 1585 | BUG_ON(!piocb); |
| 1576 | 1586 | ||
| @@ -2967,8 +2977,8 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
| 2967 | * | 2977 | * |
| 2968 | * This function looks up the iocb_lookup table to get the command iocb | 2978 | * This function looks up the iocb_lookup table to get the command iocb |
| 2969 | * corresponding to the given response iocb using the iotag of the | 2979 | * corresponding to the given response iocb using the iotag of the |
| 2970 | * response iocb. This function is called with the hbalock held | 2980 | * response iocb. The driver calls this function with the hbalock held |
| 2971 | * for sli3 devices or the ring_lock for sli4 devices. | 2981 | * for SLI3 ports or the ring lock held for SLI4 ports. |
| 2972 | * This function returns the command iocb object if it finds the command | 2982 | * This function returns the command iocb object if it finds the command |
| 2973 | * iocb else returns NULL. | 2983 | * iocb else returns NULL. |
| 2974 | **/ | 2984 | **/ |
| @@ -2979,8 +2989,15 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, | |||
| 2979 | { | 2989 | { |
| 2980 | struct lpfc_iocbq *cmd_iocb = NULL; | 2990 | struct lpfc_iocbq *cmd_iocb = NULL; |
| 2981 | uint16_t iotag; | 2991 | uint16_t iotag; |
| 2982 | lockdep_assert_held(&phba->hbalock); | 2992 | spinlock_t *temp_lock = NULL; |
| 2993 | unsigned long iflag = 0; | ||
| 2983 | 2994 | ||
| 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); | ||
| 2984 | iotag = prspiocb->iocb.ulpIoTag; | 3001 | iotag = prspiocb->iocb.ulpIoTag; |
| 2985 | 3002 | ||
| 2986 | if (iotag != 0 && iotag <= phba->sli.last_iotag) { | 3003 | if (iotag != 0 && iotag <= phba->sli.last_iotag) { |
| @@ -2990,10 +3007,12 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, | |||
| 2990 | list_del_init(&cmd_iocb->list); | 3007 | list_del_init(&cmd_iocb->list); |
| 2991 | cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; | 3008 | cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; |
| 2992 | pring->txcmplq_cnt--; | 3009 | pring->txcmplq_cnt--; |
| 3010 | spin_unlock_irqrestore(temp_lock, iflag); | ||
| 2993 | return cmd_iocb; | 3011 | return cmd_iocb; |
| 2994 | } | 3012 | } |
| 2995 | } | 3013 | } |
| 2996 | 3014 | ||
| 3015 | spin_unlock_irqrestore(temp_lock, iflag); | ||
| 2997 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 3016 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
| 2998 | "0317 iotag x%x is out of " | 3017 | "0317 iotag x%x is out of " |
| 2999 | "range: max iotag x%x wd0 x%x\n", | 3018 | "range: max iotag x%x wd0 x%x\n", |
| @@ -3009,8 +3028,8 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, | |||
| 3009 | * @iotag: IOCB tag. | 3028 | * @iotag: IOCB tag. |
| 3010 | * | 3029 | * |
| 3011 | * This function looks up the iocb_lookup table to get the command iocb | 3030 | * 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 | 3031 | * corresponding to the given iotag. The driver calls this function with |
| 3013 | * hbalock held. | 3032 | * the ring lock held because this function is an SLI4 port only helper. |
| 3014 | * This function returns the command iocb object if it finds the command | 3033 | * This function returns the command iocb object if it finds the command |
| 3015 | * iocb else returns NULL. | 3034 | * iocb else returns NULL. |
| 3016 | **/ | 3035 | **/ |
| @@ -3019,8 +3038,15 @@ lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, | |||
| 3019 | struct lpfc_sli_ring *pring, uint16_t iotag) | 3038 | struct lpfc_sli_ring *pring, uint16_t iotag) |
| 3020 | { | 3039 | { |
| 3021 | struct lpfc_iocbq *cmd_iocb = NULL; | 3040 | struct lpfc_iocbq *cmd_iocb = NULL; |
| 3041 | spinlock_t *temp_lock = NULL; | ||
| 3042 | unsigned long iflag = 0; | ||
| 3022 | 3043 | ||
| 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); | ||
| 3024 | if (iotag != 0 && iotag <= phba->sli.last_iotag) { | 3050 | if (iotag != 0 && iotag <= phba->sli.last_iotag) { |
| 3025 | cmd_iocb = phba->sli.iocbq_lookup[iotag]; | 3051 | cmd_iocb = phba->sli.iocbq_lookup[iotag]; |
| 3026 | if (cmd_iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ) { | 3052 | if (cmd_iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ) { |
| @@ -3028,10 +3054,12 @@ lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, | |||
| 3028 | list_del_init(&cmd_iocb->list); | 3054 | list_del_init(&cmd_iocb->list); |
| 3029 | cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; | 3055 | cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; |
| 3030 | pring->txcmplq_cnt--; | 3056 | pring->txcmplq_cnt--; |
| 3057 | spin_unlock_irqrestore(temp_lock, iflag); | ||
| 3031 | return cmd_iocb; | 3058 | return cmd_iocb; |
| 3032 | } | 3059 | } |
| 3033 | } | 3060 | } |
| 3034 | 3061 | ||
| 3062 | spin_unlock_irqrestore(temp_lock, iflag); | ||
| 3035 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 3063 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
| 3036 | "0372 iotag x%x lookup error: max iotag (x%x) " | 3064 | "0372 iotag x%x lookup error: max iotag (x%x) " |
| 3037 | "iocb_flag x%x\n", | 3065 | "iocb_flag x%x\n", |
| @@ -3065,17 +3093,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
| 3065 | int rc = 1; | 3093 | int rc = 1; |
| 3066 | unsigned long iflag; | 3094 | unsigned long iflag; |
| 3067 | 3095 | ||
| 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); | ||
| 3073 | cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq); | 3096 | 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 | |||
| 3079 | if (cmdiocbp) { | 3097 | if (cmdiocbp) { |
| 3080 | if (cmdiocbp->iocb_cmpl) { | 3098 | if (cmdiocbp->iocb_cmpl) { |
| 3081 | /* | 3099 | /* |
| @@ -3406,8 +3424,10 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
| 3406 | break; | 3424 | break; |
| 3407 | } | 3425 | } |
| 3408 | 3426 | ||
| 3427 | spin_unlock_irqrestore(&phba->hbalock, iflag); | ||
| 3409 | cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, | 3428 | cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, |
| 3410 | &rspiocbq); | 3429 | &rspiocbq); |
| 3430 | spin_lock_irqsave(&phba->hbalock, iflag); | ||
| 3411 | if (unlikely(!cmdiocbq)) | 3431 | if (unlikely(!cmdiocbq)) |
| 3412 | break; | 3432 | break; |
| 3413 | if (cmdiocbq->iocb_flag & LPFC_DRIVER_ABORTED) | 3433 | 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, | |||
| 3601 | 3621 | ||
| 3602 | case LPFC_ABORT_IOCB: | 3622 | case LPFC_ABORT_IOCB: |
| 3603 | cmdiocbp = NULL; | 3623 | 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); | ||
| 3605 | cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, | 3626 | cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, |
| 3606 | saveq); | 3627 | saveq); |
| 3628 | spin_lock_irqsave(&phba->hbalock, iflag); | ||
| 3629 | } | ||
| 3607 | if (cmdiocbp) { | 3630 | if (cmdiocbp) { |
| 3608 | /* Call the specified completion routine */ | 3631 | /* Call the specified completion routine */ |
| 3609 | if (cmdiocbp->iocb_cmpl) { | 3632 | if (cmdiocbp->iocb_cmpl) { |
| @@ -12976,13 +12999,11 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba, | |||
| 12976 | return NULL; | 12999 | return NULL; |
| 12977 | 13000 | ||
| 12978 | wcqe = &irspiocbq->cq_event.cqe.wcqe_cmpl; | 13001 | wcqe = &irspiocbq->cq_event.cqe.wcqe_cmpl; |
| 12979 | spin_lock_irqsave(&pring->ring_lock, iflags); | ||
| 12980 | pring->stats.iocb_event++; | 13002 | pring->stats.iocb_event++; |
| 12981 | /* Look up the ELS command IOCB and create pseudo response IOCB */ | 13003 | /* Look up the ELS command IOCB and create pseudo response IOCB */ |
| 12982 | cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, | 13004 | cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, |
| 12983 | bf_get(lpfc_wcqe_c_request_tag, wcqe)); | 13005 | bf_get(lpfc_wcqe_c_request_tag, wcqe)); |
| 12984 | if (unlikely(!cmdiocbq)) { | 13006 | if (unlikely(!cmdiocbq)) { |
| 12985 | spin_unlock_irqrestore(&pring->ring_lock, iflags); | ||
| 12986 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 13007 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
| 12987 | "0386 ELS complete with no corresponding " | 13008 | "0386 ELS complete with no corresponding " |
| 12988 | "cmdiocb: 0x%x 0x%x 0x%x 0x%x\n", | 13009 | "cmdiocb: 0x%x 0x%x 0x%x 0x%x\n", |
| @@ -12992,6 +13013,7 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba, | |||
| 12992 | return NULL; | 13013 | return NULL; |
| 12993 | } | 13014 | } |
| 12994 | 13015 | ||
| 13016 | spin_lock_irqsave(&pring->ring_lock, iflags); | ||
| 12995 | /* Put the iocb back on the txcmplq */ | 13017 | /* Put the iocb back on the txcmplq */ |
| 12996 | lpfc_sli_ringtxcmpl_put(phba, pring, cmdiocbq); | 13018 | lpfc_sli_ringtxcmpl_put(phba, pring, cmdiocbq); |
| 12997 | spin_unlock_irqrestore(&pring->ring_lock, iflags); | 13019 | 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, | |||
| 13762 | /* Look up the FCP command IOCB and create pseudo response IOCB */ | 13784 | /* Look up the FCP command IOCB and create pseudo response IOCB */ |
| 13763 | spin_lock_irqsave(&pring->ring_lock, iflags); | 13785 | spin_lock_irqsave(&pring->ring_lock, iflags); |
| 13764 | pring->stats.iocb_event++; | 13786 | pring->stats.iocb_event++; |
| 13787 | spin_unlock_irqrestore(&pring->ring_lock, iflags); | ||
| 13765 | cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, | 13788 | cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, |
| 13766 | bf_get(lpfc_wcqe_c_request_tag, wcqe)); | 13789 | bf_get(lpfc_wcqe_c_request_tag, wcqe)); |
| 13767 | spin_unlock_irqrestore(&pring->ring_lock, iflags); | ||
| 13768 | if (unlikely(!cmdiocbq)) { | 13790 | if (unlikely(!cmdiocbq)) { |
| 13769 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | 13791 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
| 13770 | "0374 FCP complete with no corresponding " | 13792 | "0374 FCP complete with no corresponding " |
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index f7d9ef428417..220a932fe943 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | * included with this package. * | 20 | * included with this package. * |
| 21 | *******************************************************************/ | 21 | *******************************************************************/ |
| 22 | 22 | ||
| 23 | #define LPFC_DRIVER_VERSION "12.2.0.1" | 23 | #define LPFC_DRIVER_VERSION "12.2.0.2" |
| 24 | #define LPFC_DRIVER_NAME "lpfc" | 24 | #define LPFC_DRIVER_NAME "lpfc" |
| 25 | 25 | ||
| 26 | /* Used for SLI 2/3 */ | 26 | /* Used for SLI 2/3 */ |
diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c index b8d54ef8cf6d..eb0dd566330a 100644 --- a/drivers/scsi/myrs.c +++ b/drivers/scsi/myrs.c | |||
| @@ -818,7 +818,7 @@ static void myrs_log_event(struct myrs_hba *cs, struct myrs_event *ev) | |||
| 818 | unsigned char ev_type, *ev_msg; | 818 | unsigned char ev_type, *ev_msg; |
| 819 | struct Scsi_Host *shost = cs->host; | 819 | struct Scsi_Host *shost = cs->host; |
| 820 | struct scsi_device *sdev; | 820 | struct scsi_device *sdev; |
| 821 | struct scsi_sense_hdr sshdr; | 821 | struct scsi_sense_hdr sshdr = {0}; |
| 822 | unsigned char sense_info[4]; | 822 | unsigned char sense_info[4]; |
| 823 | unsigned char cmd_specific[4]; | 823 | unsigned char cmd_specific[4]; |
| 824 | 824 | ||
diff --git a/drivers/scsi/qedi/qedi_dbg.c b/drivers/scsi/qedi/qedi_dbg.c index 8fd28b056f73..3383314a3882 100644 --- a/drivers/scsi/qedi/qedi_dbg.c +++ b/drivers/scsi/qedi/qedi_dbg.c | |||
| @@ -16,10 +16,6 @@ qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line, | |||
| 16 | { | 16 | { |
| 17 | va_list va; | 17 | va_list va; |
| 18 | struct va_format vaf; | 18 | struct va_format vaf; |
| 19 | char nfunc[32]; | ||
| 20 | |||
| 21 | memset(nfunc, 0, sizeof(nfunc)); | ||
| 22 | memcpy(nfunc, func, sizeof(nfunc) - 1); | ||
| 23 | 19 | ||
| 24 | va_start(va, fmt); | 20 | va_start(va, fmt); |
| 25 | 21 | ||
| @@ -28,9 +24,9 @@ qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line, | |||
| 28 | 24 | ||
| 29 | if (likely(qedi) && likely(qedi->pdev)) | 25 | if (likely(qedi) && likely(qedi->pdev)) |
| 30 | pr_err("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), | 26 | pr_err("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), |
| 31 | nfunc, line, qedi->host_no, &vaf); | 27 | func, line, qedi->host_no, &vaf); |
| 32 | else | 28 | else |
| 33 | pr_err("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); | 29 | pr_err("[0000:00:00.0]:[%s:%d]: %pV", func, line, &vaf); |
| 34 | 30 | ||
| 35 | va_end(va); | 31 | va_end(va); |
| 36 | } | 32 | } |
| @@ -41,10 +37,6 @@ qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line, | |||
| 41 | { | 37 | { |
| 42 | va_list va; | 38 | va_list va; |
| 43 | struct va_format vaf; | 39 | struct va_format vaf; |
| 44 | char nfunc[32]; | ||
| 45 | |||
| 46 | memset(nfunc, 0, sizeof(nfunc)); | ||
| 47 | memcpy(nfunc, func, sizeof(nfunc) - 1); | ||
| 48 | 40 | ||
| 49 | va_start(va, fmt); | 41 | va_start(va, fmt); |
| 50 | 42 | ||
| @@ -56,9 +48,9 @@ qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line, | |||
| 56 | 48 | ||
| 57 | if (likely(qedi) && likely(qedi->pdev)) | 49 | if (likely(qedi) && likely(qedi->pdev)) |
| 58 | pr_warn("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), | 50 | pr_warn("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), |
| 59 | nfunc, line, qedi->host_no, &vaf); | 51 | func, line, qedi->host_no, &vaf); |
| 60 | else | 52 | else |
| 61 | pr_warn("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); | 53 | pr_warn("[0000:00:00.0]:[%s:%d]: %pV", func, line, &vaf); |
| 62 | 54 | ||
| 63 | ret: | 55 | ret: |
| 64 | va_end(va); | 56 | va_end(va); |
| @@ -70,10 +62,6 @@ qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line, | |||
| 70 | { | 62 | { |
| 71 | va_list va; | 63 | va_list va; |
| 72 | struct va_format vaf; | 64 | struct va_format vaf; |
| 73 | char nfunc[32]; | ||
| 74 | |||
| 75 | memset(nfunc, 0, sizeof(nfunc)); | ||
| 76 | memcpy(nfunc, func, sizeof(nfunc) - 1); | ||
| 77 | 65 | ||
| 78 | va_start(va, fmt); | 66 | va_start(va, fmt); |
| 79 | 67 | ||
| @@ -85,10 +73,10 @@ qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line, | |||
| 85 | 73 | ||
| 86 | if (likely(qedi) && likely(qedi->pdev)) | 74 | if (likely(qedi) && likely(qedi->pdev)) |
| 87 | pr_notice("[%s]:[%s:%d]:%d: %pV", | 75 | pr_notice("[%s]:[%s:%d]:%d: %pV", |
| 88 | dev_name(&qedi->pdev->dev), nfunc, line, | 76 | dev_name(&qedi->pdev->dev), func, line, |
| 89 | qedi->host_no, &vaf); | 77 | qedi->host_no, &vaf); |
| 90 | else | 78 | else |
| 91 | pr_notice("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); | 79 | pr_notice("[0000:00:00.0]:[%s:%d]: %pV", func, line, &vaf); |
| 92 | 80 | ||
| 93 | ret: | 81 | ret: |
| 94 | va_end(va); | 82 | va_end(va); |
| @@ -100,10 +88,6 @@ qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line, | |||
| 100 | { | 88 | { |
| 101 | va_list va; | 89 | va_list va; |
| 102 | struct va_format vaf; | 90 | struct va_format vaf; |
| 103 | char nfunc[32]; | ||
| 104 | |||
| 105 | memset(nfunc, 0, sizeof(nfunc)); | ||
| 106 | memcpy(nfunc, func, sizeof(nfunc) - 1); | ||
| 107 | 91 | ||
| 108 | va_start(va, fmt); | 92 | va_start(va, fmt); |
| 109 | 93 | ||
| @@ -115,9 +99,9 @@ qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line, | |||
| 115 | 99 | ||
| 116 | if (likely(qedi) && likely(qedi->pdev)) | 100 | if (likely(qedi) && likely(qedi->pdev)) |
| 117 | pr_info("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), | 101 | pr_info("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), |
| 118 | nfunc, line, qedi->host_no, &vaf); | 102 | func, line, qedi->host_no, &vaf); |
| 119 | else | 103 | else |
| 120 | pr_info("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); | 104 | pr_info("[0000:00:00.0]:[%s:%d]: %pV", func, line, &vaf); |
| 121 | 105 | ||
| 122 | ret: | 106 | ret: |
| 123 | va_end(va); | 107 | va_end(va); |
diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 615cea4fad56..82153c808b40 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c | |||
| @@ -809,8 +809,6 @@ qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, | |||
| 809 | struct qedi_endpoint *qedi_ep; | 809 | struct qedi_endpoint *qedi_ep; |
| 810 | struct sockaddr_in *addr; | 810 | struct sockaddr_in *addr; |
| 811 | struct sockaddr_in6 *addr6; | 811 | struct sockaddr_in6 *addr6; |
| 812 | struct qed_dev *cdev = NULL; | ||
| 813 | struct qedi_uio_dev *udev = NULL; | ||
| 814 | struct iscsi_path path_req; | 812 | struct iscsi_path path_req; |
| 815 | u32 msg_type = ISCSI_KEVENT_IF_DOWN; | 813 | u32 msg_type = ISCSI_KEVENT_IF_DOWN; |
| 816 | u32 iscsi_cid = QEDI_CID_RESERVED; | 814 | u32 iscsi_cid = QEDI_CID_RESERVED; |
| @@ -830,8 +828,6 @@ qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, | |||
| 830 | } | 828 | } |
| 831 | 829 | ||
| 832 | qedi = iscsi_host_priv(shost); | 830 | qedi = iscsi_host_priv(shost); |
| 833 | cdev = qedi->cdev; | ||
| 834 | udev = qedi->udev; | ||
| 835 | 831 | ||
| 836 | if (test_bit(QEDI_IN_OFFLINE, &qedi->flags) || | 832 | if (test_bit(QEDI_IN_OFFLINE, &qedi->flags) || |
| 837 | test_bit(QEDI_IN_RECOVERY, &qedi->flags)) { | 833 | test_bit(QEDI_IN_RECOVERY, &qedi->flags)) { |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index e1c82a0a9745..172ef21827dd 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
| @@ -6826,6 +6826,78 @@ qla2x00_release_firmware(void) | |||
| 6826 | mutex_unlock(&qla_fw_lock); | 6826 | mutex_unlock(&qla_fw_lock); |
| 6827 | } | 6827 | } |
| 6828 | 6828 | ||
| 6829 | static void qla_pci_error_cleanup(scsi_qla_host_t *vha) | ||
| 6830 | { | ||
| 6831 | struct qla_hw_data *ha = vha->hw; | ||
| 6832 | scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); | ||
| 6833 | struct qla_qpair *qpair = NULL; | ||
| 6834 | struct scsi_qla_host *vp; | ||
| 6835 | fc_port_t *fcport; | ||
| 6836 | int i; | ||
| 6837 | unsigned long flags; | ||
| 6838 | |||
| 6839 | ha->chip_reset++; | ||
| 6840 | |||
| 6841 | ha->base_qpair->chip_reset = ha->chip_reset; | ||
| 6842 | for (i = 0; i < ha->max_qpairs; i++) { | ||
| 6843 | if (ha->queue_pair_map[i]) | ||
| 6844 | ha->queue_pair_map[i]->chip_reset = | ||
| 6845 | ha->base_qpair->chip_reset; | ||
| 6846 | } | ||
| 6847 | |||
| 6848 | /* purge MBox commands */ | ||
| 6849 | if (atomic_read(&ha->num_pend_mbx_stage3)) { | ||
| 6850 | clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); | ||
| 6851 | complete(&ha->mbx_intr_comp); | ||
| 6852 | } | ||
| 6853 | |||
| 6854 | i = 0; | ||
| 6855 | |||
| 6856 | while (atomic_read(&ha->num_pend_mbx_stage3) || | ||
| 6857 | atomic_read(&ha->num_pend_mbx_stage2) || | ||
| 6858 | atomic_read(&ha->num_pend_mbx_stage1)) { | ||
| 6859 | msleep(20); | ||
| 6860 | i++; | ||
| 6861 | if (i > 50) | ||
| 6862 | break; | ||
| 6863 | } | ||
| 6864 | |||
| 6865 | ha->flags.purge_mbox = 0; | ||
| 6866 | |||
| 6867 | mutex_lock(&ha->mq_lock); | ||
| 6868 | list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) | ||
| 6869 | qpair->online = 0; | ||
| 6870 | mutex_unlock(&ha->mq_lock); | ||
| 6871 | |||
| 6872 | qla2x00_mark_all_devices_lost(vha, 0); | ||
| 6873 | |||
| 6874 | spin_lock_irqsave(&ha->vport_slock, flags); | ||
| 6875 | list_for_each_entry(vp, &ha->vp_list, list) { | ||
| 6876 | atomic_inc(&vp->vref_count); | ||
| 6877 | spin_unlock_irqrestore(&ha->vport_slock, flags); | ||
| 6878 | qla2x00_mark_all_devices_lost(vp, 0); | ||
| 6879 | spin_lock_irqsave(&ha->vport_slock, flags); | ||
| 6880 | atomic_dec(&vp->vref_count); | ||
| 6881 | } | ||
| 6882 | spin_unlock_irqrestore(&ha->vport_slock, flags); | ||
| 6883 | |||
| 6884 | /* Clear all async request states across all VPs. */ | ||
| 6885 | list_for_each_entry(fcport, &vha->vp_fcports, list) | ||
| 6886 | fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); | ||
| 6887 | |||
| 6888 | spin_lock_irqsave(&ha->vport_slock, flags); | ||
| 6889 | list_for_each_entry(vp, &ha->vp_list, list) { | ||
| 6890 | atomic_inc(&vp->vref_count); | ||
| 6891 | spin_unlock_irqrestore(&ha->vport_slock, flags); | ||
| 6892 | list_for_each_entry(fcport, &vp->vp_fcports, list) | ||
| 6893 | fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); | ||
| 6894 | spin_lock_irqsave(&ha->vport_slock, flags); | ||
| 6895 | atomic_dec(&vp->vref_count); | ||
| 6896 | } | ||
| 6897 | spin_unlock_irqrestore(&ha->vport_slock, flags); | ||
| 6898 | } | ||
| 6899 | |||
| 6900 | |||
| 6829 | static pci_ers_result_t | 6901 | static pci_ers_result_t |
| 6830 | qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) | 6902 | qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) |
| 6831 | { | 6903 | { |
| @@ -6851,20 +6923,7 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) | |||
| 6851 | return PCI_ERS_RESULT_CAN_RECOVER; | 6923 | return PCI_ERS_RESULT_CAN_RECOVER; |
| 6852 | case pci_channel_io_frozen: | 6924 | case pci_channel_io_frozen: |
| 6853 | ha->flags.eeh_busy = 1; | 6925 | ha->flags.eeh_busy = 1; |
| 6854 | /* For ISP82XX complete any pending mailbox cmd */ | 6926 | qla_pci_error_cleanup(vha); |
| 6855 | if (IS_QLA82XX(ha)) { | ||
| 6856 | ha->flags.isp82xx_fw_hung = 1; | ||
| 6857 | ql_dbg(ql_dbg_aer, vha, 0x9001, "Pci channel io frozen\n"); | ||
| 6858 | qla82xx_clear_pending_mbx(vha); | ||
| 6859 | } | ||
| 6860 | qla2x00_free_irqs(vha); | ||
| 6861 | pci_disable_device(pdev); | ||
| 6862 | /* Return back all IOs */ | ||
| 6863 | qla2x00_abort_all_cmds(vha, DID_RESET << 16); | ||
| 6864 | if (ql2xmqsupport || ql2xnvmeenable) { | ||
| 6865 | set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); | ||
| 6866 | qla2xxx_wake_dpc(vha); | ||
| 6867 | } | ||
| 6868 | return PCI_ERS_RESULT_NEED_RESET; | 6927 | return PCI_ERS_RESULT_NEED_RESET; |
| 6869 | case pci_channel_io_perm_failure: | 6928 | case pci_channel_io_perm_failure: |
| 6870 | ha->flags.pci_channel_io_perm_failure = 1; | 6929 | ha->flags.pci_channel_io_perm_failure = 1; |
| @@ -6918,122 +6977,14 @@ qla2xxx_pci_mmio_enabled(struct pci_dev *pdev) | |||
| 6918 | return PCI_ERS_RESULT_RECOVERED; | 6977 | return PCI_ERS_RESULT_RECOVERED; |
| 6919 | } | 6978 | } |
| 6920 | 6979 | ||
| 6921 | static uint32_t | ||
| 6922 | qla82xx_error_recovery(scsi_qla_host_t *base_vha) | ||
| 6923 | { | ||
| 6924 | uint32_t rval = QLA_FUNCTION_FAILED; | ||
| 6925 | uint32_t drv_active = 0; | ||
| 6926 | struct qla_hw_data *ha = base_vha->hw; | ||
| 6927 | int fn; | ||
| 6928 | struct pci_dev *other_pdev = NULL; | ||
| 6929 | |||
| 6930 | ql_dbg(ql_dbg_aer, base_vha, 0x9006, | ||
| 6931 | "Entered %s.\n", __func__); | ||
| 6932 | |||
| 6933 | set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); | ||
| 6934 | |||
| 6935 | if (base_vha->flags.online) { | ||
| 6936 | /* Abort all outstanding commands, | ||
| 6937 | * so as to be requeued later */ | ||
| 6938 | qla2x00_abort_isp_cleanup(base_vha); | ||
| 6939 | } | ||
| 6940 | |||
| 6941 | |||
| 6942 | fn = PCI_FUNC(ha->pdev->devfn); | ||
| 6943 | while (fn > 0) { | ||
| 6944 | fn--; | ||
| 6945 | ql_dbg(ql_dbg_aer, base_vha, 0x9007, | ||
| 6946 | "Finding pci device at function = 0x%x.\n", fn); | ||
| 6947 | other_pdev = | ||
| 6948 | pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus), | ||
| 6949 | ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev->devfn), | ||
| 6950 | fn)); | ||
| 6951 | |||
| 6952 | if (!other_pdev) | ||
| 6953 | continue; | ||
| 6954 | if (atomic_read(&other_pdev->enable_cnt)) { | ||
| 6955 | ql_dbg(ql_dbg_aer, base_vha, 0x9008, | ||
| 6956 | "Found PCI func available and enable at 0x%x.\n", | ||
| 6957 | fn); | ||
| 6958 | pci_dev_put(other_pdev); | ||
| 6959 | break; | ||
| 6960 | } | ||
| 6961 | pci_dev_put(other_pdev); | ||
| 6962 | } | ||
| 6963 | |||
| 6964 | if (!fn) { | ||
| 6965 | /* Reset owner */ | ||
| 6966 | ql_dbg(ql_dbg_aer, base_vha, 0x9009, | ||
| 6967 | "This devfn is reset owner = 0x%x.\n", | ||
| 6968 | ha->pdev->devfn); | ||
| 6969 | qla82xx_idc_lock(ha); | ||
| 6970 | |||
| 6971 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | ||
| 6972 | QLA8XXX_DEV_INITIALIZING); | ||
| 6973 | |||
| 6974 | qla82xx_wr_32(ha, QLA82XX_CRB_DRV_IDC_VERSION, | ||
| 6975 | QLA82XX_IDC_VERSION); | ||
| 6976 | |||
| 6977 | drv_active = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_ACTIVE); | ||
| 6978 | ql_dbg(ql_dbg_aer, base_vha, 0x900a, | ||
| 6979 | "drv_active = 0x%x.\n", drv_active); | ||
| 6980 | |||
| 6981 | qla82xx_idc_unlock(ha); | ||
| 6982 | /* Reset if device is not already reset | ||
| 6983 | * drv_active would be 0 if a reset has already been done | ||
| 6984 | */ | ||
| 6985 | if (drv_active) | ||
| 6986 | rval = qla82xx_start_firmware(base_vha); | ||
| 6987 | else | ||
| 6988 | rval = QLA_SUCCESS; | ||
| 6989 | qla82xx_idc_lock(ha); | ||
| 6990 | |||
| 6991 | if (rval != QLA_SUCCESS) { | ||
| 6992 | ql_log(ql_log_info, base_vha, 0x900b, | ||
| 6993 | "HW State: FAILED.\n"); | ||
| 6994 | qla82xx_clear_drv_active(ha); | ||
| 6995 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | ||
| 6996 | QLA8XXX_DEV_FAILED); | ||
| 6997 | } else { | ||
| 6998 | ql_log(ql_log_info, base_vha, 0x900c, | ||
| 6999 | "HW State: READY.\n"); | ||
| 7000 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | ||
| 7001 | QLA8XXX_DEV_READY); | ||
| 7002 | qla82xx_idc_unlock(ha); | ||
| 7003 | ha->flags.isp82xx_fw_hung = 0; | ||
| 7004 | rval = qla82xx_restart_isp(base_vha); | ||
| 7005 | qla82xx_idc_lock(ha); | ||
| 7006 | /* Clear driver state register */ | ||
| 7007 | qla82xx_wr_32(ha, QLA82XX_CRB_DRV_STATE, 0); | ||
| 7008 | qla82xx_set_drv_active(base_vha); | ||
| 7009 | } | ||
| 7010 | qla82xx_idc_unlock(ha); | ||
| 7011 | } else { | ||
| 7012 | ql_dbg(ql_dbg_aer, base_vha, 0x900d, | ||
| 7013 | "This devfn is not reset owner = 0x%x.\n", | ||
| 7014 | ha->pdev->devfn); | ||
| 7015 | if ((qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == | ||
| 7016 | QLA8XXX_DEV_READY)) { | ||
| 7017 | ha->flags.isp82xx_fw_hung = 0; | ||
| 7018 | rval = qla82xx_restart_isp(base_vha); | ||
| 7019 | qla82xx_idc_lock(ha); | ||
| 7020 | qla82xx_set_drv_active(base_vha); | ||
| 7021 | qla82xx_idc_unlock(ha); | ||
| 7022 | } | ||
| 7023 | } | ||
| 7024 | clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); | ||
| 7025 | |||
| 7026 | return rval; | ||
| 7027 | } | ||
| 7028 | |||
| 7029 | static pci_ers_result_t | 6980 | static pci_ers_result_t |
| 7030 | qla2xxx_pci_slot_reset(struct pci_dev *pdev) | 6981 | qla2xxx_pci_slot_reset(struct pci_dev *pdev) |
| 7031 | { | 6982 | { |
| 7032 | pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; | 6983 | pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; |
| 7033 | scsi_qla_host_t *base_vha = pci_get_drvdata(pdev); | 6984 | scsi_qla_host_t *base_vha = pci_get_drvdata(pdev); |
| 7034 | struct qla_hw_data *ha = base_vha->hw; | 6985 | struct qla_hw_data *ha = base_vha->hw; |
| 7035 | struct rsp_que *rsp; | 6986 | int rc; |
| 7036 | int rc, retries = 10; | 6987 | struct qla_qpair *qpair = NULL; |
| 7037 | 6988 | ||
| 7038 | ql_dbg(ql_dbg_aer, base_vha, 0x9004, | 6989 | ql_dbg(ql_dbg_aer, base_vha, 0x9004, |
| 7039 | "Slot Reset.\n"); | 6990 | "Slot Reset.\n"); |
| @@ -7062,24 +7013,16 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev) | |||
| 7062 | goto exit_slot_reset; | 7013 | goto exit_slot_reset; |
| 7063 | } | 7014 | } |
| 7064 | 7015 | ||
| 7065 | rsp = ha->rsp_q_map[0]; | ||
| 7066 | if (qla2x00_request_irqs(ha, rsp)) | ||
| 7067 | goto exit_slot_reset; | ||
| 7068 | 7016 | ||
| 7069 | if (ha->isp_ops->pci_config(base_vha)) | 7017 | if (ha->isp_ops->pci_config(base_vha)) |
| 7070 | goto exit_slot_reset; | 7018 | goto exit_slot_reset; |
| 7071 | 7019 | ||
| 7072 | if (IS_QLA82XX(ha)) { | 7020 | mutex_lock(&ha->mq_lock); |
| 7073 | if (qla82xx_error_recovery(base_vha) == QLA_SUCCESS) { | 7021 | list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) |
| 7074 | ret = PCI_ERS_RESULT_RECOVERED; | 7022 | qpair->online = 1; |
| 7075 | goto exit_slot_reset; | 7023 | mutex_unlock(&ha->mq_lock); |
| 7076 | } else | ||
| 7077 | goto exit_slot_reset; | ||
| 7078 | } | ||
| 7079 | |||
| 7080 | while (ha->flags.mbox_busy && retries--) | ||
| 7081 | msleep(1000); | ||
| 7082 | 7024 | ||
| 7025 | base_vha->flags.online = 1; | ||
| 7083 | set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); | 7026 | set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); |
| 7084 | if (ha->isp_ops->abort_isp(base_vha) == QLA_SUCCESS) | 7027 | if (ha->isp_ops->abort_isp(base_vha) == QLA_SUCCESS) |
| 7085 | ret = PCI_ERS_RESULT_RECOVERED; | 7028 | ret = PCI_ERS_RESULT_RECOVERED; |
| @@ -7103,13 +7046,13 @@ qla2xxx_pci_resume(struct pci_dev *pdev) | |||
| 7103 | ql_dbg(ql_dbg_aer, base_vha, 0x900f, | 7046 | ql_dbg(ql_dbg_aer, base_vha, 0x900f, |
| 7104 | "pci_resume.\n"); | 7047 | "pci_resume.\n"); |
| 7105 | 7048 | ||
| 7049 | ha->flags.eeh_busy = 0; | ||
| 7050 | |||
| 7106 | ret = qla2x00_wait_for_hba_online(base_vha); | 7051 | ret = qla2x00_wait_for_hba_online(base_vha); |
| 7107 | if (ret != QLA_SUCCESS) { | 7052 | if (ret != QLA_SUCCESS) { |
| 7108 | ql_log(ql_log_fatal, base_vha, 0x9002, | 7053 | ql_log(ql_log_fatal, base_vha, 0x9002, |
| 7109 | "The device failed to resume I/O from slot/link_reset.\n"); | 7054 | "The device failed to resume I/O from slot/link_reset.\n"); |
| 7110 | } | 7055 | } |
| 7111 | |||
| 7112 | ha->flags.eeh_busy = 0; | ||
| 7113 | } | 7056 | } |
| 7114 | 7057 | ||
| 7115 | static void | 7058 | static void |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index c0f12ad62379..a3406bd62391 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -2572,7 +2572,6 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) | |||
| 2572 | int res; | 2572 | int res; |
| 2573 | struct scsi_device *sdp = sdkp->device; | 2573 | struct scsi_device *sdp = sdkp->device; |
| 2574 | struct scsi_mode_data data; | 2574 | struct scsi_mode_data data; |
| 2575 | int disk_ro = get_disk_ro(sdkp->disk); | ||
| 2576 | int old_wp = sdkp->write_prot; | 2575 | int old_wp = sdkp->write_prot; |
| 2577 | 2576 | ||
| 2578 | set_disk_ro(sdkp->disk, 0); | 2577 | set_disk_ro(sdkp->disk, 0); |
| @@ -2613,7 +2612,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) | |||
| 2613 | "Test WP failed, assume Write Enabled\n"); | 2612 | "Test WP failed, assume Write Enabled\n"); |
| 2614 | } else { | 2613 | } else { |
| 2615 | sdkp->write_prot = ((data.device_specific & 0x80) != 0); | 2614 | sdkp->write_prot = ((data.device_specific & 0x80) != 0); |
| 2616 | set_disk_ro(sdkp->disk, sdkp->write_prot || disk_ro); | 2615 | set_disk_ro(sdkp->disk, sdkp->write_prot); |
| 2617 | if (sdkp->first_scan || old_wp != sdkp->write_prot) { | 2616 | if (sdkp->first_scan || old_wp != sdkp->write_prot) { |
| 2618 | sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", | 2617 | sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", |
| 2619 | sdkp->write_prot ? "on" : "off"); | 2618 | sdkp->write_prot ? "on" : "off"); |
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index c26cac819f9e..b17761eafca9 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c | |||
| @@ -2755,16 +2755,25 @@ static void pqi_process_raid_io_error(struct pqi_io_request *io_request) | |||
| 2755 | scsi_normalize_sense(error_info->data, | 2755 | scsi_normalize_sense(error_info->data, |
| 2756 | sense_data_length, &sshdr) && | 2756 | sense_data_length, &sshdr) && |
| 2757 | sshdr.sense_key == HARDWARE_ERROR && | 2757 | sshdr.sense_key == HARDWARE_ERROR && |
| 2758 | sshdr.asc == 0x3e && | 2758 | sshdr.asc == 0x3e) { |
| 2759 | sshdr.ascq == 0x1) { | ||
| 2760 | struct pqi_ctrl_info *ctrl_info = shost_to_hba(scmd->device->host); | 2759 | struct pqi_ctrl_info *ctrl_info = shost_to_hba(scmd->device->host); |
| 2761 | struct pqi_scsi_dev *device = scmd->device->hostdata; | 2760 | struct pqi_scsi_dev *device = scmd->device->hostdata; |
| 2762 | 2761 | ||
| 2763 | if (printk_ratelimit()) | 2762 | switch (sshdr.ascq) { |
| 2764 | scmd_printk(KERN_ERR, scmd, "received 'logical unit failure' from controller for scsi %d:%d:%d:%d\n", | 2763 | case 0x1: /* LOGICAL UNIT FAILURE */ |
| 2765 | ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun); | 2764 | if (printk_ratelimit()) |
| 2766 | pqi_take_device_offline(scmd->device, "RAID"); | 2765 | scmd_printk(KERN_ERR, scmd, "received 'logical unit failure' from controller for scsi %d:%d:%d:%d\n", |
| 2767 | host_byte = DID_NO_CONNECT; | 2766 | ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun); |
| 2767 | pqi_take_device_offline(scmd->device, "RAID"); | ||
| 2768 | host_byte = DID_NO_CONNECT; | ||
| 2769 | break; | ||
| 2770 | |||
| 2771 | default: /* See http://www.t10.org/lists/asc-num.htm#ASC_3E */ | ||
| 2772 | if (printk_ratelimit()) | ||
| 2773 | scmd_printk(KERN_ERR, scmd, "received unhandled error %d from controller for scsi %d:%d:%d:%d\n", | ||
| 2774 | sshdr.ascq, ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun); | ||
| 2775 | break; | ||
| 2776 | } | ||
| 2768 | } | 2777 | } |
| 2769 | 2778 | ||
| 2770 | if (sense_data_length > SCSI_SENSE_BUFFERSIZE) | 2779 | if (sense_data_length > SCSI_SENSE_BUFFERSIZE) |
