Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+189 -226
+1 -1
drivers/scsi/bnx2fc/bnx2fc_hwi.c
··· 830 830 ((u64)err_entry->data.err_warn_bitmap_hi << 32) | 831 831 (u64)err_entry->data.err_warn_bitmap_lo; 832 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 834 err_warn = i; 835 835 break; 836 836 }
+22 -15
drivers/scsi/lpfc/lpfc_attr.c
··· 176 176 int i; 177 177 int len = 0; 178 178 char tmp[LPFC_MAX_NVME_INFO_TMP_LEN] = {0}; 179 + unsigned long iflags = 0; 179 180 180 181 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { 181 182 len = scnprintf(buf, PAGE_SIZE, "NVME Disabled\n"); ··· 355 354 phba->sli4_hba.io_xri_max, 356 355 lpfc_sli4_get_els_iocb_cnt(phba)); 357 356 if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) 358 - goto buffer_done; 357 + goto rcu_unlock_buf_done; 359 358 360 359 /* Port state is only one of two values for now. */ 361 360 if (localport->port_id) ··· 371 370 wwn_to_u64(vport->fc_nodename.u.wwn), 372 371 localport->port_id, statep); 373 372 if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) 374 - goto buffer_done; 373 + goto rcu_unlock_buf_done; 375 374 376 375 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { 377 376 nrport = NULL; 378 - spin_lock(&vport->phba->hbalock); 377 + spin_lock_irqsave(&vport->phba->hbalock, iflags); 379 378 rport = lpfc_ndlp_get_nrport(ndlp); 380 379 if (rport) 381 380 nrport = rport->remoteport; 382 - spin_unlock(&vport->phba->hbalock); 381 + spin_unlock_irqrestore(&vport->phba->hbalock, iflags); 383 382 if (!nrport) 384 383 continue; 385 384 ··· 398 397 399 398 /* Tab in to show lport ownership. */ 400 399 if (strlcat(buf, "NVME RPORT ", PAGE_SIZE) >= PAGE_SIZE) 401 - goto buffer_done; 400 + goto rcu_unlock_buf_done; 402 401 if (phba->brd_no >= 10) { 403 402 if (strlcat(buf, " ", PAGE_SIZE) >= PAGE_SIZE) 404 - goto buffer_done; 403 + goto rcu_unlock_buf_done; 405 404 } 406 405 407 406 scnprintf(tmp, sizeof(tmp), "WWPN x%llx ", 408 407 nrport->port_name); 409 408 if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) 410 - goto buffer_done; 409 + goto rcu_unlock_buf_done; 411 410 412 411 scnprintf(tmp, sizeof(tmp), "WWNN x%llx ", 413 412 nrport->node_name); 414 413 if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) 415 - goto buffer_done; 414 + goto rcu_unlock_buf_done; 416 415 417 416 scnprintf(tmp, sizeof(tmp), "DID x%06x ", 418 417 nrport->port_id); 419 418 if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) 420 - goto buffer_done; 419 + goto rcu_unlock_buf_done; 421 420 422 421 /* An NVME rport can have multiple roles. */ 423 422 if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) { 424 423 if (strlcat(buf, "INITIATOR ", PAGE_SIZE) >= PAGE_SIZE) 425 - goto buffer_done; 424 + goto rcu_unlock_buf_done; 426 425 } 427 426 if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) { 428 427 if (strlcat(buf, "TARGET ", PAGE_SIZE) >= PAGE_SIZE) 429 - goto buffer_done; 428 + goto rcu_unlock_buf_done; 430 429 } 431 430 if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) { 432 431 if (strlcat(buf, "DISCSRVC ", PAGE_SIZE) >= PAGE_SIZE) 433 - goto buffer_done; 432 + goto rcu_unlock_buf_done; 434 433 } 435 434 if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | 436 435 FC_PORT_ROLE_NVME_TARGET | ··· 438 437 scnprintf(tmp, sizeof(tmp), "UNKNOWN ROLE x%x", 439 438 nrport->port_role); 440 439 if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) 441 - goto buffer_done; 440 + goto rcu_unlock_buf_done; 442 441 } 443 442 444 443 scnprintf(tmp, sizeof(tmp), "%s\n", statep); 445 444 if (strlcat(buf, tmp, PAGE_SIZE) >= PAGE_SIZE) 446 - goto buffer_done; 445 + goto rcu_unlock_buf_done; 447 446 } 448 447 rcu_read_unlock(); 449 448 ··· 505 504 atomic_read(&lport->cmpl_fcp_err)); 506 505 strlcat(buf, tmp, PAGE_SIZE); 507 506 508 - buffer_done: 507 + /* RCU is already unlocked. */ 508 + goto buffer_done; 509 + 510 + rcu_unlock_buf_done: 511 + rcu_read_unlock(); 512 + 513 + buffer_done: 509 514 len = strnlen(buf, PAGE_SIZE); 510 515 511 516 if (unlikely(len >= (PAGE_SIZE - 1))) {
+4 -1
drivers/scsi/lpfc/lpfc_els.c
··· 7334 7334 lpfc_send_rrq(struct lpfc_hba *phba, struct lpfc_node_rrq *rrq) 7335 7335 { 7336 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 7341 if (lpfc_test_rrq_active(phba, ndlp, rrq->xritag)) 7339 7342 return lpfc_issue_els_rrq(rrq->vport, ndlp, 7340 7343 rrq->nlp_DID, rrq);
+53 -31
drivers/scsi/lpfc/lpfc_sli.c
··· 991 991 * @ndlp: Targets nodelist pointer for this exchange. 992 992 * @xritag the xri in the bitmap to test. 993 993 * 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. 997 997 **/ 998 998 int 999 999 lpfc_test_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, 1000 1000 uint16_t xritag) 1001 1001 { 1002 - lockdep_assert_held(&phba->hbalock); 1003 1002 if (!ndlp) 1004 1003 return 0; 1005 1004 if (!ndlp->active_rrqs_xri_bitmap) ··· 1101 1102 * @phba: Pointer to HBA context object. 1102 1103 * @piocb: Pointer to the iocbq. 1103 1104 * 1104 - * This function is called with the ring lock held. This function 1105 - * gets a new driver sglq object from the sglq list. If the 1106 - * list is not empty then it is successful, it returns pointer to the newly 1107 - * allocated sglq object else it returns NULL. 1105 + * The driver calls this function with either the nvme ls ring lock 1106 + * or the fc els ring lock held depending on the iocb usage. This function 1107 + * gets a new driver sglq object from the sglq list. If the list is not empty 1108 + * then it is successful, it returns pointer to the newly allocated sglq 1109 + * object else it returns NULL. 1108 1110 **/ 1109 1111 static struct lpfc_sglq * 1110 1112 __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq) ··· 1115 1115 struct lpfc_sglq *start_sglq = NULL; 1116 1116 struct lpfc_io_buf *lpfc_cmd; 1117 1117 struct lpfc_nodelist *ndlp; 1118 + struct lpfc_sli_ring *pring = NULL; 1118 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 1128 if (piocbq->iocb_flag & LPFC_IO_FCP) { 1123 1129 lpfc_cmd = (struct lpfc_io_buf *) piocbq->context1; ··· 1566 1560 * @pring: Pointer to driver SLI ring object. 1567 1561 * @piocb: Pointer to the driver iocb object. 1568 1562 * 1569 - * This function is called with hbalock held. The function adds the 1563 + * The driver calls this function with the hbalock held for SLI3 ports or 1564 + * the ring lock held for SLI4 ports. The function adds the 1570 1565 * new iocb to txcmplq of the given ring. This function always returns 1571 1566 * 0. If this function is called for ELS ring, this function checks if 1572 1567 * there is a vport associated with the ELS command. This function also ··· 1577 1570 lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, 1578 1571 struct lpfc_iocbq *piocb) 1579 1572 { 1580 - lockdep_assert_held(&phba->hbalock); 1573 + if (phba->sli_rev == LPFC_SLI_REV4) 1574 + lockdep_assert_held(&pring->ring_lock); 1575 + else 1576 + lockdep_assert_held(&phba->hbalock); 1581 1577 1582 1578 BUG_ON(!piocb); 1583 1579 ··· 2977 2967 * 2978 2968 * This function looks up the iocb_lookup table to get the command iocb 2979 2969 * corresponding to the given response iocb using the iotag of the 2980 - * response iocb. This function is called with the hbalock held 2981 - * for sli3 devices or the ring_lock for sli4 devices. 2970 + * response iocb. The driver calls this function with the hbalock held 2971 + * for SLI3 ports or the ring lock held for SLI4 ports. 2982 2972 * This function returns the command iocb object if it finds the command 2983 2973 * iocb else returns NULL. 2984 2974 **/ ··· 2989 2979 { 2990 2980 struct lpfc_iocbq *cmd_iocb = NULL; 2991 2981 uint16_t iotag; 2992 - lockdep_assert_held(&phba->hbalock); 2982 + spinlock_t *temp_lock = NULL; 2983 + unsigned long iflag = 0; 2993 2984 2985 + if (phba->sli_rev == LPFC_SLI_REV4) 2986 + temp_lock = &pring->ring_lock; 2987 + else 2988 + temp_lock = &phba->hbalock; 2989 + 2990 + spin_lock_irqsave(temp_lock, iflag); 2994 2991 iotag = prspiocb->iocb.ulpIoTag; 2995 2992 2996 2993 if (iotag != 0 && iotag <= phba->sli.last_iotag) { ··· 3007 2990 list_del_init(&cmd_iocb->list); 3008 2991 cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; 3009 2992 pring->txcmplq_cnt--; 2993 + spin_unlock_irqrestore(temp_lock, iflag); 3010 2994 return cmd_iocb; 3011 2995 } 3012 2996 } 3013 2997 2998 + spin_unlock_irqrestore(temp_lock, iflag); 3014 2999 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 3015 3000 "0317 iotag x%x is out of " 3016 3001 "range: max iotag x%x wd0 x%x\n", ··· 3028 3009 * @iotag: IOCB tag. 3029 3010 * 3030 3011 * This function looks up the iocb_lookup table to get the command iocb 3031 - * corresponding to the given iotag. This function is called with the 3032 - * hbalock held. 3012 + * corresponding to the given iotag. The driver calls this function with 3013 + * the ring lock held because this function is an SLI4 port only helper. 3033 3014 * This function returns the command iocb object if it finds the command 3034 3015 * iocb else returns NULL. 3035 3016 **/ ··· 3038 3019 struct lpfc_sli_ring *pring, uint16_t iotag) 3039 3020 { 3040 3021 struct lpfc_iocbq *cmd_iocb = NULL; 3022 + spinlock_t *temp_lock = NULL; 3023 + unsigned long iflag = 0; 3041 3024 3042 - lockdep_assert_held(&phba->hbalock); 3025 + if (phba->sli_rev == LPFC_SLI_REV4) 3026 + temp_lock = &pring->ring_lock; 3027 + else 3028 + temp_lock = &phba->hbalock; 3029 + 3030 + spin_lock_irqsave(temp_lock, iflag); 3043 3031 if (iotag != 0 && iotag <= phba->sli.last_iotag) { 3044 3032 cmd_iocb = phba->sli.iocbq_lookup[iotag]; 3045 3033 if (cmd_iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ) { ··· 3054 3028 list_del_init(&cmd_iocb->list); 3055 3029 cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; 3056 3030 pring->txcmplq_cnt--; 3031 + spin_unlock_irqrestore(temp_lock, iflag); 3057 3032 return cmd_iocb; 3058 3033 } 3059 3034 } 3060 3035 3036 + spin_unlock_irqrestore(temp_lock, iflag); 3061 3037 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 3062 3038 "0372 iotag x%x lookup error: max iotag (x%x) " 3063 3039 "iocb_flag x%x\n", ··· 3093 3065 int rc = 1; 3094 3066 unsigned long iflag; 3095 3067 3096 - /* Based on the iotag field, get the cmd IOCB from the txcmplq */ 3097 - if (phba->sli_rev == LPFC_SLI_REV4) 3098 - spin_lock_irqsave(&pring->ring_lock, iflag); 3099 - else 3100 - spin_lock_irqsave(&phba->hbalock, iflag); 3101 3068 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq); 3102 - if (phba->sli_rev == LPFC_SLI_REV4) 3103 - spin_unlock_irqrestore(&pring->ring_lock, iflag); 3104 - else 3105 - spin_unlock_irqrestore(&phba->hbalock, iflag); 3106 - 3107 3069 if (cmdiocbp) { 3108 3070 if (cmdiocbp->iocb_cmpl) { 3109 3071 /* ··· 3424 3406 break; 3425 3407 } 3426 3408 3409 + spin_unlock_irqrestore(&phba->hbalock, iflag); 3427 3410 cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, 3428 3411 &rspiocbq); 3412 + spin_lock_irqsave(&phba->hbalock, iflag); 3429 3413 if (unlikely(!cmdiocbq)) 3430 3414 break; 3431 3415 if (cmdiocbq->iocb_flag & LPFC_DRIVER_ABORTED) ··· 3621 3601 3622 3602 case LPFC_ABORT_IOCB: 3623 3603 cmdiocbp = NULL; 3624 - if (irsp->ulpCommand != CMD_XRI_ABORTED_CX) 3604 + if (irsp->ulpCommand != CMD_XRI_ABORTED_CX) { 3605 + spin_unlock_irqrestore(&phba->hbalock, iflag); 3625 3606 cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, 3626 3607 saveq); 3608 + spin_lock_irqsave(&phba->hbalock, iflag); 3609 + } 3627 3610 if (cmdiocbp) { 3628 3611 /* Call the specified completion routine */ 3629 3612 if (cmdiocbp->iocb_cmpl) { ··· 12999 12976 return NULL; 13000 12977 13001 12978 wcqe = &irspiocbq->cq_event.cqe.wcqe_cmpl; 13002 - spin_lock_irqsave(&pring->ring_lock, iflags); 13003 12979 pring->stats.iocb_event++; 13004 12980 /* Look up the ELS command IOCB and create pseudo response IOCB */ 13005 12981 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, 13006 12982 bf_get(lpfc_wcqe_c_request_tag, wcqe)); 13007 12983 if (unlikely(!cmdiocbq)) { 13008 - spin_unlock_irqrestore(&pring->ring_lock, iflags); 13009 12984 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 13010 12985 "0386 ELS complete with no corresponding " 13011 12986 "cmdiocb: 0x%x 0x%x 0x%x 0x%x\n", ··· 13013 12992 return NULL; 13014 12993 } 13015 12994 12995 + spin_lock_irqsave(&pring->ring_lock, iflags); 13016 12996 /* Put the iocb back on the txcmplq */ 13017 12997 lpfc_sli_ringtxcmpl_put(phba, pring, cmdiocbq); 13018 12998 spin_unlock_irqrestore(&pring->ring_lock, iflags); ··· 13784 13762 /* Look up the FCP command IOCB and create pseudo response IOCB */ 13785 13763 spin_lock_irqsave(&pring->ring_lock, iflags); 13786 13764 pring->stats.iocb_event++; 13765 + spin_unlock_irqrestore(&pring->ring_lock, iflags); 13787 13766 cmdiocbq = lpfc_sli_iocbq_lookup_by_tag(phba, pring, 13788 13767 bf_get(lpfc_wcqe_c_request_tag, wcqe)); 13789 - spin_unlock_irqrestore(&pring->ring_lock, iflags); 13790 13768 if (unlikely(!cmdiocbq)) { 13791 13769 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, 13792 13770 "0374 FCP complete with no corresponding "
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 20 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 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */
+1 -1
drivers/scsi/myrs.c
··· 818 818 unsigned char ev_type, *ev_msg; 819 819 struct Scsi_Host *shost = cs->host; 820 820 struct scsi_device *sdev; 821 - struct scsi_sense_hdr sshdr; 821 + struct scsi_sense_hdr sshdr = {0}; 822 822 unsigned char sense_info[4]; 823 823 unsigned char cmd_specific[4]; 824 824
+8 -24
drivers/scsi/qedi/qedi_dbg.c
··· 16 16 { 17 17 va_list va; 18 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 20 va_start(va, fmt); 25 21 ··· 24 28 25 29 if (likely(qedi) && likely(qedi->pdev)) 26 30 pr_err("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), 27 - nfunc, line, qedi->host_no, &vaf); 31 + func, line, qedi->host_no, &vaf); 28 32 else 29 - pr_err("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); 33 + pr_err("[0000:00:00.0]:[%s:%d]: %pV", func, line, &vaf); 30 34 31 35 va_end(va); 32 36 } ··· 37 41 { 38 42 va_list va; 39 43 struct va_format vaf; 40 - char nfunc[32]; 41 - 42 - memset(nfunc, 0, sizeof(nfunc)); 43 - memcpy(nfunc, func, sizeof(nfunc) - 1); 44 44 45 45 va_start(va, fmt); 46 46 ··· 48 56 49 57 if (likely(qedi) && likely(qedi->pdev)) 50 58 pr_warn("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), 51 - nfunc, line, qedi->host_no, &vaf); 59 + func, line, qedi->host_no, &vaf); 52 60 else 53 - pr_warn("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); 61 + pr_warn("[0000:00:00.0]:[%s:%d]: %pV", func, line, &vaf); 54 62 55 63 ret: 56 64 va_end(va); ··· 62 70 { 63 71 va_list va; 64 72 struct va_format vaf; 65 - char nfunc[32]; 66 - 67 - memset(nfunc, 0, sizeof(nfunc)); 68 - memcpy(nfunc, func, sizeof(nfunc) - 1); 69 73 70 74 va_start(va, fmt); 71 75 ··· 73 85 74 86 if (likely(qedi) && likely(qedi->pdev)) 75 87 pr_notice("[%s]:[%s:%d]:%d: %pV", 76 - dev_name(&qedi->pdev->dev), nfunc, line, 88 + dev_name(&qedi->pdev->dev), func, line, 77 89 qedi->host_no, &vaf); 78 90 else 79 - pr_notice("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); 91 + pr_notice("[0000:00:00.0]:[%s:%d]: %pV", func, line, &vaf); 80 92 81 93 ret: 82 94 va_end(va); ··· 88 100 { 89 101 va_list va; 90 102 struct va_format vaf; 91 - char nfunc[32]; 92 - 93 - memset(nfunc, 0, sizeof(nfunc)); 94 - memcpy(nfunc, func, sizeof(nfunc) - 1); 95 103 96 104 va_start(va, fmt); 97 105 ··· 99 115 100 116 if (likely(qedi) && likely(qedi->pdev)) 101 117 pr_info("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), 102 - nfunc, line, qedi->host_no, &vaf); 118 + func, line, qedi->host_no, &vaf); 103 119 else 104 - pr_info("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); 120 + pr_info("[0000:00:00.0]:[%s:%d]: %pV", func, line, &vaf); 105 121 106 122 ret: 107 123 va_end(va);
-4
drivers/scsi/qedi/qedi_iscsi.c
··· 809 809 struct qedi_endpoint *qedi_ep; 810 810 struct sockaddr_in *addr; 811 811 struct sockaddr_in6 *addr6; 812 - struct qed_dev *cdev = NULL; 813 - struct qedi_uio_dev *udev = NULL; 814 812 struct iscsi_path path_req; 815 813 u32 msg_type = ISCSI_KEVENT_IF_DOWN; 816 814 u32 iscsi_cid = QEDI_CID_RESERVED; ··· 828 830 } 829 831 830 832 qedi = iscsi_host_priv(shost); 831 - cdev = qedi->cdev; 832 - udev = qedi->udev; 833 833 834 834 if (test_bit(QEDI_IN_OFFLINE, &qedi->flags) || 835 835 test_bit(QEDI_IN_RECOVERY, &qedi->flags)) {
+82 -139
drivers/scsi/qla2xxx/qla_os.c
··· 6826 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 6901 static pci_ers_result_t 6830 6902 qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) 6831 6903 { ··· 6923 6851 return PCI_ERS_RESULT_CAN_RECOVER; 6924 6852 case pci_channel_io_frozen: 6925 6853 ha->flags.eeh_busy = 1; 6926 - /* For ISP82XX complete any pending mailbox cmd */ 6927 - if (IS_QLA82XX(ha)) { 6928 - ha->flags.isp82xx_fw_hung = 1; 6929 - ql_dbg(ql_dbg_aer, vha, 0x9001, "Pci channel io frozen\n"); 6930 - qla82xx_clear_pending_mbx(vha); 6931 - } 6932 - qla2x00_free_irqs(vha); 6933 - pci_disable_device(pdev); 6934 - /* Return back all IOs */ 6935 - qla2x00_abort_all_cmds(vha, DID_RESET << 16); 6936 - if (ql2xmqsupport || ql2xnvmeenable) { 6937 - set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); 6938 - qla2xxx_wake_dpc(vha); 6939 - } 6854 + qla_pci_error_cleanup(vha); 6940 6855 return PCI_ERS_RESULT_NEED_RESET; 6941 6856 case pci_channel_io_perm_failure: 6942 6857 ha->flags.pci_channel_io_perm_failure = 1; ··· 6977 6918 return PCI_ERS_RESULT_RECOVERED; 6978 6919 } 6979 6920 6980 - static uint32_t 6981 - qla82xx_error_recovery(scsi_qla_host_t *base_vha) 6982 - { 6983 - uint32_t rval = QLA_FUNCTION_FAILED; 6984 - uint32_t drv_active = 0; 6985 - struct qla_hw_data *ha = base_vha->hw; 6986 - int fn; 6987 - struct pci_dev *other_pdev = NULL; 6988 - 6989 - ql_dbg(ql_dbg_aer, base_vha, 0x9006, 6990 - "Entered %s.\n", __func__); 6991 - 6992 - set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); 6993 - 6994 - if (base_vha->flags.online) { 6995 - /* Abort all outstanding commands, 6996 - * so as to be requeued later */ 6997 - qla2x00_abort_isp_cleanup(base_vha); 6998 - } 6999 - 7000 - 7001 - fn = PCI_FUNC(ha->pdev->devfn); 7002 - while (fn > 0) { 7003 - fn--; 7004 - ql_dbg(ql_dbg_aer, base_vha, 0x9007, 7005 - "Finding pci device at function = 0x%x.\n", fn); 7006 - other_pdev = 7007 - pci_get_domain_bus_and_slot(pci_domain_nr(ha->pdev->bus), 7008 - ha->pdev->bus->number, PCI_DEVFN(PCI_SLOT(ha->pdev->devfn), 7009 - fn)); 7010 - 7011 - if (!other_pdev) 7012 - continue; 7013 - if (atomic_read(&other_pdev->enable_cnt)) { 7014 - ql_dbg(ql_dbg_aer, base_vha, 0x9008, 7015 - "Found PCI func available and enable at 0x%x.\n", 7016 - fn); 7017 - pci_dev_put(other_pdev); 7018 - break; 7019 - } 7020 - pci_dev_put(other_pdev); 7021 - } 7022 - 7023 - if (!fn) { 7024 - /* Reset owner */ 7025 - ql_dbg(ql_dbg_aer, base_vha, 0x9009, 7026 - "This devfn is reset owner = 0x%x.\n", 7027 - ha->pdev->devfn); 7028 - qla82xx_idc_lock(ha); 7029 - 7030 - qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, 7031 - QLA8XXX_DEV_INITIALIZING); 7032 - 7033 - qla82xx_wr_32(ha, QLA82XX_CRB_DRV_IDC_VERSION, 7034 - QLA82XX_IDC_VERSION); 7035 - 7036 - drv_active = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_ACTIVE); 7037 - ql_dbg(ql_dbg_aer, base_vha, 0x900a, 7038 - "drv_active = 0x%x.\n", drv_active); 7039 - 7040 - qla82xx_idc_unlock(ha); 7041 - /* Reset if device is not already reset 7042 - * drv_active would be 0 if a reset has already been done 7043 - */ 7044 - if (drv_active) 7045 - rval = qla82xx_start_firmware(base_vha); 7046 - else 7047 - rval = QLA_SUCCESS; 7048 - qla82xx_idc_lock(ha); 7049 - 7050 - if (rval != QLA_SUCCESS) { 7051 - ql_log(ql_log_info, base_vha, 0x900b, 7052 - "HW State: FAILED.\n"); 7053 - qla82xx_clear_drv_active(ha); 7054 - qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, 7055 - QLA8XXX_DEV_FAILED); 7056 - } else { 7057 - ql_log(ql_log_info, base_vha, 0x900c, 7058 - "HW State: READY.\n"); 7059 - qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, 7060 - QLA8XXX_DEV_READY); 7061 - qla82xx_idc_unlock(ha); 7062 - ha->flags.isp82xx_fw_hung = 0; 7063 - rval = qla82xx_restart_isp(base_vha); 7064 - qla82xx_idc_lock(ha); 7065 - /* Clear driver state register */ 7066 - qla82xx_wr_32(ha, QLA82XX_CRB_DRV_STATE, 0); 7067 - qla82xx_set_drv_active(base_vha); 7068 - } 7069 - qla82xx_idc_unlock(ha); 7070 - } else { 7071 - ql_dbg(ql_dbg_aer, base_vha, 0x900d, 7072 - "This devfn is not reset owner = 0x%x.\n", 7073 - ha->pdev->devfn); 7074 - if ((qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == 7075 - QLA8XXX_DEV_READY)) { 7076 - ha->flags.isp82xx_fw_hung = 0; 7077 - rval = qla82xx_restart_isp(base_vha); 7078 - qla82xx_idc_lock(ha); 7079 - qla82xx_set_drv_active(base_vha); 7080 - qla82xx_idc_unlock(ha); 7081 - } 7082 - } 7083 - clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); 7084 - 7085 - return rval; 7086 - } 7087 - 7088 6921 static pci_ers_result_t 7089 6922 qla2xxx_pci_slot_reset(struct pci_dev *pdev) 7090 6923 { 7091 6924 pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; 7092 6925 scsi_qla_host_t *base_vha = pci_get_drvdata(pdev); 7093 6926 struct qla_hw_data *ha = base_vha->hw; 7094 - struct rsp_que *rsp; 7095 - int rc, retries = 10; 6927 + int rc; 6928 + struct qla_qpair *qpair = NULL; 7096 6929 7097 6930 ql_dbg(ql_dbg_aer, base_vha, 0x9004, 7098 6931 "Slot Reset.\n"); ··· 7013 7062 goto exit_slot_reset; 7014 7063 } 7015 7064 7016 - rsp = ha->rsp_q_map[0]; 7017 - if (qla2x00_request_irqs(ha, rsp)) 7018 - goto exit_slot_reset; 7019 7065 7020 7066 if (ha->isp_ops->pci_config(base_vha)) 7021 7067 goto exit_slot_reset; 7022 7068 7023 - if (IS_QLA82XX(ha)) { 7024 - if (qla82xx_error_recovery(base_vha) == QLA_SUCCESS) { 7025 - ret = PCI_ERS_RESULT_RECOVERED; 7026 - goto exit_slot_reset; 7027 - } else 7028 - goto exit_slot_reset; 7029 - } 7069 + mutex_lock(&ha->mq_lock); 7070 + list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) 7071 + qpair->online = 1; 7072 + mutex_unlock(&ha->mq_lock); 7030 7073 7031 - while (ha->flags.mbox_busy && retries--) 7032 - msleep(1000); 7033 - 7074 + base_vha->flags.online = 1; 7034 7075 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); 7035 7076 if (ha->isp_ops->abort_isp(base_vha) == QLA_SUCCESS) 7036 7077 ret = PCI_ERS_RESULT_RECOVERED; ··· 7046 7103 ql_dbg(ql_dbg_aer, base_vha, 0x900f, 7047 7104 "pci_resume.\n"); 7048 7105 7106 + ha->flags.eeh_busy = 0; 7107 + 7049 7108 ret = qla2x00_wait_for_hba_online(base_vha); 7050 7109 if (ret != QLA_SUCCESS) { 7051 7110 ql_log(ql_log_fatal, base_vha, 0x9002, 7052 7111 "The device failed to resume I/O from slot/link_reset.\n"); 7053 7112 } 7054 - 7055 - ha->flags.eeh_busy = 0; 7056 7113 } 7057 7114 7058 7115 static void
+1 -2
drivers/scsi/sd.c
··· 2572 2572 int res; 2573 2573 struct scsi_device *sdp = sdkp->device; 2574 2574 struct scsi_mode_data data; 2575 - int disk_ro = get_disk_ro(sdkp->disk); 2576 2575 int old_wp = sdkp->write_prot; 2577 2576 2578 2577 set_disk_ro(sdkp->disk, 0); ··· 2612 2613 "Test WP failed, assume Write Enabled\n"); 2613 2614 } else { 2614 2615 sdkp->write_prot = ((data.device_specific & 0x80) != 0); 2615 - set_disk_ro(sdkp->disk, sdkp->write_prot || disk_ro); 2616 + set_disk_ro(sdkp->disk, sdkp->write_prot); 2616 2617 if (sdkp->first_scan || old_wp != sdkp->write_prot) { 2617 2618 sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", 2618 2619 sdkp->write_prot ? "on" : "off");
+16 -7
drivers/scsi/smartpqi/smartpqi_init.c
··· 2755 2755 scsi_normalize_sense(error_info->data, 2756 2756 sense_data_length, &sshdr) && 2757 2757 sshdr.sense_key == HARDWARE_ERROR && 2758 - sshdr.asc == 0x3e && 2759 - sshdr.ascq == 0x1) { 2758 + sshdr.asc == 0x3e) { 2760 2759 struct pqi_ctrl_info *ctrl_info = shost_to_hba(scmd->device->host); 2761 2760 struct pqi_scsi_dev *device = scmd->device->hostdata; 2762 2761 2763 - if (printk_ratelimit()) 2764 - scmd_printk(KERN_ERR, scmd, "received 'logical unit failure' from controller for scsi %d:%d:%d:%d\n", 2765 - ctrl_info->scsi_host->host_no, device->bus, device->target, device->lun); 2766 - pqi_take_device_offline(scmd->device, "RAID"); 2767 - host_byte = DID_NO_CONNECT; 2762 + switch (sshdr.ascq) { 2763 + case 0x1: /* LOGICAL UNIT FAILURE */ 2764 + if (printk_ratelimit()) 2765 + scmd_printk(KERN_ERR, scmd, "received 'logical unit failure' from controller for scsi %d:%d:%d:%d\n", 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 2779 if (sense_data_length > SCSI_SENSE_BUFFERSIZE)