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

Merge branch '5.16/scsi-fixes' into 5.17/scsi-staging

Pull in the 5.16 fixes branch to resolve a conflict in the UFS driver
core.

Conflicts:
drivers/scsi/ufs/ufshcd.c

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

+175 -99
+2 -7
drivers/scsi/lpfc/lpfc_els.c
··· 5090 5090 /* NPort Recovery mode or node is just allocated */ 5091 5091 if (!lpfc_nlp_not_used(ndlp)) { 5092 5092 /* A LOGO is completing and the node is in NPR state. 5093 - * If this a fabric node that cleared its transport 5094 - * registration, release the rpi. 5093 + * Just unregister the RPI because the node is still 5094 + * required. 5095 5095 */ 5096 - spin_lock_irq(&ndlp->lock); 5097 - ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 5098 - if (phba->sli_rev == LPFC_SLI_REV4) 5099 - ndlp->nlp_flag |= NLP_RELEASE_RPI; 5100 - spin_unlock_irq(&ndlp->lock); 5101 5096 lpfc_unreg_rpi(vport, ndlp); 5102 5097 } else { 5103 5098 /* Indicate the node has already released, should
+2 -2
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 639 639 mpi_request->IOCParameter = MPI26_SET_IOC_PARAMETER_SYNC_TIMESTAMP; 640 640 current_time = ktime_get_real(); 641 641 TimeStamp = ktime_to_ms(current_time); 642 - mpi_request->Reserved7 = cpu_to_le32(TimeStamp & 0xFFFFFFFF); 643 - mpi_request->IOCParameterValue = cpu_to_le32(TimeStamp >> 32); 642 + mpi_request->Reserved7 = cpu_to_le32(TimeStamp >> 32); 643 + mpi_request->IOCParameterValue = cpu_to_le32(TimeStamp & 0xFFFFFFFF); 644 644 init_completion(&ioc->scsih_cmds.done); 645 645 ioc->put_smid_default(ioc, smid); 646 646 dinitprintk(ioc, ioc_info(ioc,
+4
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 142 142 143 143 #define MPT_MAX_CALLBACKS 32 144 144 145 + #define MPT_MAX_HBA_NUM_PHYS 32 146 + 145 147 #define INTERNAL_CMDS_COUNT 10 /* reserved cmds */ 146 148 /* reserved for issuing internally framed scsi io cmds */ 147 149 #define INTERNAL_SCSIIO_CMDS_COUNT 3 ··· 800 798 * @enclosure_handle: handle for this a member of an enclosure 801 799 * @device_info: bitwise defining capabilities of this sas_host/expander 802 800 * @responding: used in _scsih_expander_device_mark_responding 801 + * @nr_phys_allocated: Allocated memory for this many count phys 803 802 * @phy: a list of phys that make up this sas_host/expander 804 803 * @sas_port_list: list of ports attached to this sas_host/expander 805 804 * @port: hba port entry containing node's port number info ··· 816 813 u16 enclosure_handle; 817 814 u64 enclosure_logical_id; 818 815 u8 responding; 816 + u8 nr_phys_allocated; 819 817 struct hba_port *port; 820 818 struct _sas_phy *phy; 821 819 struct list_head sas_port_list;
+57 -2
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 3869 3869 3870 3870 shost_for_each_device(sdev, ioc->shost) { 3871 3871 sas_device_priv_data = sdev->hostdata; 3872 - if (!sas_device_priv_data) 3872 + if (!sas_device_priv_data || !sas_device_priv_data->sas_target) 3873 3873 continue; 3874 3874 if (sas_device_priv_data->sas_target->sas_address 3875 3875 != sas_address) ··· 6406 6406 int i, j, count = 0, lcount = 0; 6407 6407 int ret; 6408 6408 u64 sas_addr; 6409 + u8 num_phys; 6409 6410 6410 6411 drsprintk(ioc, ioc_info(ioc, 6411 6412 "updating ports for sas_host(0x%016llx)\n", 6412 6413 (unsigned long long)ioc->sas_hba.sas_address)); 6414 + 6415 + mpt3sas_config_get_number_hba_phys(ioc, &num_phys); 6416 + if (!num_phys) { 6417 + ioc_err(ioc, "failure at %s:%d/%s()!\n", 6418 + __FILE__, __LINE__, __func__); 6419 + return; 6420 + } 6421 + 6422 + if (num_phys > ioc->sas_hba.nr_phys_allocated) { 6423 + ioc_err(ioc, "failure at %s:%d/%s()!\n", 6424 + __FILE__, __LINE__, __func__); 6425 + return; 6426 + } 6427 + ioc->sas_hba.num_phys = num_phys; 6413 6428 6414 6429 port_table = kcalloc(ioc->sas_hba.num_phys, 6415 6430 sizeof(struct hba_port), GFP_KERNEL); ··· 6626 6611 ioc->sas_hba.phy[i].hba_vphy = 1; 6627 6612 } 6628 6613 6614 + /* 6615 + * Add new HBA phys to STL if these new phys got added as part 6616 + * of HBA Firmware upgrade/downgrade operation. 6617 + */ 6618 + if (!ioc->sas_hba.phy[i].phy) { 6619 + if ((mpt3sas_config_get_phy_pg0(ioc, &mpi_reply, 6620 + &phy_pg0, i))) { 6621 + ioc_err(ioc, "failure at %s:%d/%s()!\n", 6622 + __FILE__, __LINE__, __func__); 6623 + continue; 6624 + } 6625 + ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & 6626 + MPI2_IOCSTATUS_MASK; 6627 + if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { 6628 + ioc_err(ioc, "failure at %s:%d/%s()!\n", 6629 + __FILE__, __LINE__, __func__); 6630 + continue; 6631 + } 6632 + ioc->sas_hba.phy[i].phy_id = i; 6633 + mpt3sas_transport_add_host_phy(ioc, 6634 + &ioc->sas_hba.phy[i], phy_pg0, 6635 + ioc->sas_hba.parent_dev); 6636 + continue; 6637 + } 6629 6638 ioc->sas_hba.phy[i].handle = ioc->sas_hba.handle; 6630 6639 attached_handle = le16_to_cpu(sas_iounit_pg0->PhyData[i]. 6631 6640 AttachedDevHandle); ··· 6660 6621 mpt3sas_transport_update_links(ioc, ioc->sas_hba.sas_address, 6661 6622 attached_handle, i, link_rate, 6662 6623 ioc->sas_hba.phy[i].port); 6624 + } 6625 + /* 6626 + * Clear the phy details if this phy got disabled as part of 6627 + * HBA Firmware upgrade/downgrade operation. 6628 + */ 6629 + for (i = ioc->sas_hba.num_phys; 6630 + i < ioc->sas_hba.nr_phys_allocated; i++) { 6631 + if (ioc->sas_hba.phy[i].phy && 6632 + ioc->sas_hba.phy[i].phy->negotiated_linkrate >= 6633 + SAS_LINK_RATE_1_5_GBPS) 6634 + mpt3sas_transport_update_links(ioc, 6635 + ioc->sas_hba.sas_address, 0, i, 6636 + MPI2_SAS_NEG_LINK_RATE_PHY_DISABLED, NULL); 6663 6637 } 6664 6638 out: 6665 6639 kfree(sas_iounit_pg0); ··· 6706 6654 __FILE__, __LINE__, __func__); 6707 6655 return; 6708 6656 } 6709 - ioc->sas_hba.phy = kcalloc(num_phys, 6657 + 6658 + ioc->sas_hba.nr_phys_allocated = max_t(u8, 6659 + MPT_MAX_HBA_NUM_PHYS, num_phys); 6660 + ioc->sas_hba.phy = kcalloc(ioc->sas_hba.nr_phys_allocated, 6710 6661 sizeof(struct _sas_phy), GFP_KERNEL); 6711 6662 if (!ioc->sas_hba.phy) { 6712 6663 ioc_err(ioc, "failure at %s:%d/%s()!\n",
+2 -4
drivers/scsi/pm8001/pm8001_init.c
··· 282 282 if (rc) { 283 283 pm8001_dbg(pm8001_ha, FAIL, 284 284 "pm8001_setup_irq failed [ret: %d]\n", rc); 285 - goto err_out_shost; 285 + goto err_out; 286 286 } 287 287 /* Request Interrupt */ 288 288 rc = pm8001_request_irq(pm8001_ha); 289 289 if (rc) 290 - goto err_out_shost; 290 + goto err_out; 291 291 292 292 count = pm8001_ha->max_q_num; 293 293 /* Queues are chosen based on the number of cores/msix availability */ ··· 423 423 pm8001_tag_init(pm8001_ha); 424 424 return 0; 425 425 426 - err_out_shost: 427 - scsi_remove_host(pm8001_ha->shost); 428 426 err_out_nodev: 429 427 for (i = 0; i < pm8001_ha->max_memcnt; i++) { 430 428 if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) {
+15 -22
drivers/scsi/qedi/qedi_fw.c
··· 732 732 { 733 733 struct qedi_work_map *work, *work_tmp; 734 734 u32 proto_itt = cqe->itid; 735 - itt_t protoitt = 0; 736 735 int found = 0; 737 736 struct qedi_cmd *qedi_cmd = NULL; 738 737 u32 iscsi_cid; ··· 811 812 return; 812 813 813 814 check_cleanup_reqs: 814 - if (qedi_conn->cmd_cleanup_req > 0) { 815 - QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID, 815 + if (atomic_inc_return(&qedi_conn->cmd_cleanup_cmpl) == 816 + qedi_conn->cmd_cleanup_req) { 817 + QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, 816 818 "Freeing tid=0x%x for cid=0x%x\n", 817 819 cqe->itid, qedi_conn->iscsi_conn_id); 818 - qedi_conn->cmd_cleanup_cmpl++; 819 820 wake_up(&qedi_conn->wait_queue); 820 - } else { 821 - QEDI_ERR(&qedi->dbg_ctx, 822 - "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x\n", 823 - protoitt, cqe->itid, qedi_conn->iscsi_conn_id); 824 821 } 825 822 } 826 823 ··· 1158 1163 } 1159 1164 1160 1165 qedi_conn->cmd_cleanup_req = 0; 1161 - qedi_conn->cmd_cleanup_cmpl = 0; 1166 + atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0); 1162 1167 1163 1168 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, 1164 1169 "active_cmd_count=%d, cid=0x%x, in_recovery=%d, lun_reset=%d\n", ··· 1210 1215 qedi_conn->iscsi_conn_id); 1211 1216 1212 1217 rval = wait_event_interruptible_timeout(qedi_conn->wait_queue, 1213 - ((qedi_conn->cmd_cleanup_req == 1214 - qedi_conn->cmd_cleanup_cmpl) || 1215 - test_bit(QEDI_IN_RECOVERY, 1216 - &qedi->flags)), 1217 - 5 * HZ); 1218 + (qedi_conn->cmd_cleanup_req == 1219 + atomic_read(&qedi_conn->cmd_cleanup_cmpl)) || 1220 + test_bit(QEDI_IN_RECOVERY, &qedi->flags), 1221 + 5 * HZ); 1218 1222 if (rval) { 1219 1223 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, 1220 1224 "i/o cmd_cleanup_req=%d, equal to cmd_cleanup_cmpl=%d, cid=0x%x\n", 1221 1225 qedi_conn->cmd_cleanup_req, 1222 - qedi_conn->cmd_cleanup_cmpl, 1226 + atomic_read(&qedi_conn->cmd_cleanup_cmpl), 1223 1227 qedi_conn->iscsi_conn_id); 1224 1228 1225 1229 return 0; ··· 1227 1233 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, 1228 1234 "i/o cmd_cleanup_req=%d, not equal to cmd_cleanup_cmpl=%d, cid=0x%x\n", 1229 1235 qedi_conn->cmd_cleanup_req, 1230 - qedi_conn->cmd_cleanup_cmpl, 1236 + atomic_read(&qedi_conn->cmd_cleanup_cmpl), 1231 1237 qedi_conn->iscsi_conn_id); 1232 1238 1233 1239 iscsi_host_for_each_session(qedi->shost, ··· 1236 1242 1237 1243 /* Enable IOs for all other sessions except current.*/ 1238 1244 if (!wait_event_interruptible_timeout(qedi_conn->wait_queue, 1239 - (qedi_conn->cmd_cleanup_req == 1240 - qedi_conn->cmd_cleanup_cmpl) || 1241 - test_bit(QEDI_IN_RECOVERY, 1242 - &qedi->flags), 1243 - 5 * HZ)) { 1245 + (qedi_conn->cmd_cleanup_req == 1246 + atomic_read(&qedi_conn->cmd_cleanup_cmpl)) || 1247 + test_bit(QEDI_IN_RECOVERY, &qedi->flags), 1248 + 5 * HZ)) { 1244 1249 iscsi_host_for_each_session(qedi->shost, 1245 1250 qedi_mark_device_available); 1246 1251 return -1; ··· 1259 1266 1260 1267 qedi_ep = qedi_conn->ep; 1261 1268 qedi_conn->cmd_cleanup_req = 0; 1262 - qedi_conn->cmd_cleanup_cmpl = 0; 1269 + atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0); 1263 1270 1264 1271 if (!qedi_ep) { 1265 1272 QEDI_WARN(&qedi->dbg_ctx,
+1 -1
drivers/scsi/qedi/qedi_iscsi.c
··· 412 412 qedi_conn->iscsi_conn_id = qedi_ep->iscsi_cid; 413 413 qedi_conn->fw_cid = qedi_ep->fw_cid; 414 414 qedi_conn->cmd_cleanup_req = 0; 415 - qedi_conn->cmd_cleanup_cmpl = 0; 415 + atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0); 416 416 417 417 if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) { 418 418 rc = -EINVAL;
+1 -1
drivers/scsi/qedi/qedi_iscsi.h
··· 155 155 spinlock_t list_lock; /* internal conn lock */ 156 156 u32 active_cmd_count; 157 157 u32 cmd_cleanup_req; 158 - u32 cmd_cleanup_cmpl; 158 + atomic_t cmd_cleanup_cmpl; 159 159 160 160 u32 iscsi_conn_id; 161 161 int itt;
+3
drivers/scsi/qla2xxx/qla_dbg.c
··· 2491 2491 struct va_format vaf; 2492 2492 char pbuf[64]; 2493 2493 2494 + if (!ql_mask_match(level) && !trace_ql_dbg_log_enabled()) 2495 + return; 2496 + 2494 2497 va_start(va, fmt); 2495 2498 2496 2499 vaf.fmt = fmt;
+1 -1
drivers/scsi/qla2xxx/qla_edif.c
··· 865 865 "APP request entry - portid=%06x.\n", tdid.b24); 866 866 867 867 /* Ran out of space */ 868 - if (pcnt > app_req.num_ports) 868 + if (pcnt >= app_req.num_ports) 869 869 break; 870 870 871 871 if (tdid.b24 != 0 && tdid.b24 != fcport->d_id.b24)
+2 -4
drivers/scsi/qla2xxx/qla_mbx.c
··· 1695 1695 mcp->in_mb |= MBX_13|MBX_12|MBX_11|MBX_10; 1696 1696 if (IS_FWI2_CAPABLE(vha->hw)) 1697 1697 mcp->in_mb |= MBX_19|MBX_18|MBX_17|MBX_16; 1698 - if (IS_QLA27XX(vha->hw) || IS_QLA28XX(vha->hw)) { 1699 - mcp->in_mb |= MBX_15; 1700 - mcp->out_mb |= MBX_7|MBX_21|MBX_22|MBX_23; 1701 - } 1698 + if (IS_QLA27XX(vha->hw) || IS_QLA28XX(vha->hw)) 1699 + mcp->in_mb |= MBX_15|MBX_21|MBX_22|MBX_23; 1702 1700 1703 1701 mcp->tov = MBX_TOV_SECONDS; 1704 1702 mcp->flags = 0;
+27 -18
drivers/scsi/scsi_debug.c
··· 1189 1189 __func__, off_dst, scsi_bufflen(scp), act_len, 1190 1190 scsi_get_resid(scp)); 1191 1191 n = scsi_bufflen(scp) - (off_dst + act_len); 1192 - scsi_set_resid(scp, min_t(int, scsi_get_resid(scp), n)); 1192 + scsi_set_resid(scp, min_t(u32, scsi_get_resid(scp), n)); 1193 1193 return 0; 1194 1194 } 1195 1195 ··· 1562 1562 unsigned char pq_pdt; 1563 1563 unsigned char *arr; 1564 1564 unsigned char *cmd = scp->cmnd; 1565 - int alloc_len, n, ret; 1565 + u32 alloc_len, n; 1566 + int ret; 1566 1567 bool have_wlun, is_disk, is_zbc, is_disk_zbc; 1567 1568 1568 1569 alloc_len = get_unaligned_be16(cmd + 3); ··· 1586 1585 kfree(arr); 1587 1586 return check_condition_result; 1588 1587 } else if (0x1 & cmd[1]) { /* EVPD bit set */ 1589 - int lu_id_num, port_group_id, target_dev_id, len; 1588 + int lu_id_num, port_group_id, target_dev_id; 1589 + u32 len; 1590 1590 char lu_id_str[6]; 1591 1591 int host_no = devip->sdbg_host->shost->host_no; 1592 1592 ··· 1678 1676 kfree(arr); 1679 1677 return check_condition_result; 1680 1678 } 1681 - len = min(get_unaligned_be16(arr + 2) + 4, alloc_len); 1679 + len = min_t(u32, get_unaligned_be16(arr + 2) + 4, alloc_len); 1682 1680 ret = fill_from_dev_buffer(scp, arr, 1683 - min(len, SDEBUG_MAX_INQ_ARR_SZ)); 1681 + min_t(u32, len, SDEBUG_MAX_INQ_ARR_SZ)); 1684 1682 kfree(arr); 1685 1683 return ret; 1686 1684 } ··· 1716 1714 } 1717 1715 put_unaligned_be16(0x2100, arr + n); /* SPL-4 no version claimed */ 1718 1716 ret = fill_from_dev_buffer(scp, arr, 1719 - min_t(int, alloc_len, SDEBUG_LONG_INQ_SZ)); 1717 + min_t(u32, alloc_len, SDEBUG_LONG_INQ_SZ)); 1720 1718 kfree(arr); 1721 1719 return ret; 1722 1720 } ··· 1731 1729 unsigned char *cmd = scp->cmnd; 1732 1730 unsigned char arr[SCSI_SENSE_BUFFERSIZE]; /* assume >= 18 bytes */ 1733 1731 bool dsense = !!(cmd[1] & 1); 1734 - int alloc_len = cmd[4]; 1735 - int len = 18; 1732 + u32 alloc_len = cmd[4]; 1733 + u32 len = 18; 1736 1734 int stopped_state = atomic_read(&devip->stopped); 1737 1735 1738 1736 memset(arr, 0, sizeof(arr)); ··· 1776 1774 arr[7] = 0xa; 1777 1775 } 1778 1776 } 1779 - return fill_from_dev_buffer(scp, arr, min_t(int, len, alloc_len)); 1777 + return fill_from_dev_buffer(scp, arr, min_t(u32, len, alloc_len)); 1780 1778 } 1781 1779 1782 1780 static int resp_start_stop(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) ··· 2314 2312 { 2315 2313 int pcontrol, pcode, subpcode, bd_len; 2316 2314 unsigned char dev_spec; 2317 - int alloc_len, offset, len, target_dev_id; 2315 + u32 alloc_len, offset, len; 2316 + int target_dev_id; 2318 2317 int target = scp->device->id; 2319 2318 unsigned char *ap; 2320 2319 unsigned char arr[SDEBUG_MAX_MSENSE_SZ]; ··· 2471 2468 arr[0] = offset - 1; 2472 2469 else 2473 2470 put_unaligned_be16((offset - 2), arr + 0); 2474 - return fill_from_dev_buffer(scp, arr, min_t(int, alloc_len, offset)); 2471 + return fill_from_dev_buffer(scp, arr, min_t(u32, alloc_len, offset)); 2475 2472 } 2476 2473 2477 2474 #define SDEBUG_MAX_MSELECT_SZ 512 ··· 2502 2499 __func__, param_len, res); 2503 2500 md_len = mselect6 ? (arr[0] + 1) : (get_unaligned_be16(arr + 0) + 2); 2504 2501 bd_len = mselect6 ? arr[3] : get_unaligned_be16(arr + 6); 2505 - if (md_len > 2) { 2502 + off = bd_len + (mselect6 ? 4 : 8); 2503 + if (md_len > 2 || off >= res) { 2506 2504 mk_sense_invalid_fld(scp, SDEB_IN_DATA, 0, -1); 2507 2505 return check_condition_result; 2508 2506 } 2509 - off = bd_len + (mselect6 ? 4 : 8); 2510 2507 mpage = arr[off] & 0x3f; 2511 2508 ps = !!(arr[off] & 0x80); 2512 2509 if (ps) { ··· 2586 2583 static int resp_log_sense(struct scsi_cmnd *scp, 2587 2584 struct sdebug_dev_info *devip) 2588 2585 { 2589 - int ppc, sp, pcode, subpcode, alloc_len, len, n; 2586 + int ppc, sp, pcode, subpcode; 2587 + u32 alloc_len, len, n; 2590 2588 unsigned char arr[SDEBUG_MAX_LSENSE_SZ]; 2591 2589 unsigned char *cmd = scp->cmnd; 2592 2590 ··· 2657 2653 mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1); 2658 2654 return check_condition_result; 2659 2655 } 2660 - len = min_t(int, get_unaligned_be16(arr + 2) + 4, alloc_len); 2656 + len = min_t(u32, get_unaligned_be16(arr + 2) + 4, alloc_len); 2661 2657 return fill_from_dev_buffer(scp, arr, 2662 - min_t(int, len, SDEBUG_MAX_INQ_ARR_SZ)); 2658 + min_t(u32, len, SDEBUG_MAX_INQ_ARR_SZ)); 2663 2659 } 2664 2660 2665 2661 static inline bool sdebug_dev_is_zoned(struct sdebug_dev_info *devip) ··· 4342 4338 rep_max_zones = min((alloc_len - 64) >> ilog2(RZONES_DESC_HD), 4343 4339 max_zones); 4344 4340 4345 - arr = kcalloc(RZONES_DESC_HD, alloc_len, GFP_ATOMIC); 4341 + arr = kzalloc(alloc_len, GFP_ATOMIC); 4346 4342 if (!arr) { 4347 4343 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, 4348 4344 INSUFF_RES_ASCQ); ··· 4434 4430 put_unaligned_be64(sdebug_capacity - 1, arr + 8); 4435 4431 4436 4432 rep_len = (unsigned long)desc - (unsigned long)arr; 4437 - ret = fill_from_dev_buffer(scp, arr, min_t(int, alloc_len, rep_len)); 4433 + ret = fill_from_dev_buffer(scp, arr, min_t(u32, alloc_len, rep_len)); 4438 4434 4439 4435 fini: 4440 4436 read_unlock(macc_lckp); ··· 4657 4653 struct sdeb_zone_state *zsp) 4658 4654 { 4659 4655 enum sdebug_z_cond zc; 4656 + struct sdeb_store_info *sip = devip2sip(devip, false); 4660 4657 4661 4658 if (zbc_zone_is_conv(zsp)) 4662 4659 return; ··· 4668 4663 4669 4664 if (zsp->z_cond == ZC4_CLOSED) 4670 4665 devip->nr_closed--; 4666 + 4667 + if (zsp->z_wp > zsp->z_start) 4668 + memset(sip->storep + zsp->z_start * sdebug_sector_size, 0, 4669 + (zsp->z_wp - zsp->z_start) * sdebug_sector_size); 4671 4670 4672 4671 zsp->z_non_seq_resource = false; 4673 4672 zsp->z_wp = zsp->z_start;
+19 -11
drivers/scsi/scsi_sysfs.c
··· 797 797 int i, ret; 798 798 struct scsi_device *sdev = to_scsi_device(dev); 799 799 enum scsi_device_state state = 0; 800 + bool rescan_dev = false; 800 801 801 802 for (i = 0; i < ARRAY_SIZE(sdev_states); i++) { 802 803 const int len = strlen(sdev_states[i].name); ··· 816 815 } 817 816 818 817 mutex_lock(&sdev->state_mutex); 819 - ret = scsi_device_set_state(sdev, state); 820 - /* 821 - * If the device state changes to SDEV_RUNNING, we need to 822 - * run the queue to avoid I/O hang, and rescan the device 823 - * to revalidate it. Running the queue first is necessary 824 - * because another thread may be waiting inside 825 - * blk_mq_freeze_queue_wait() and because that call may be 826 - * waiting for pending I/O to finish. 827 - */ 828 - if (ret == 0 && state == SDEV_RUNNING) { 818 + if (sdev->sdev_state == SDEV_RUNNING && state == SDEV_RUNNING) { 819 + ret = 0; 820 + } else { 821 + ret = scsi_device_set_state(sdev, state); 822 + if (ret == 0 && state == SDEV_RUNNING) 823 + rescan_dev = true; 824 + } 825 + mutex_unlock(&sdev->state_mutex); 826 + 827 + if (rescan_dev) { 828 + /* 829 + * If the device state changes to SDEV_RUNNING, we need to 830 + * run the queue to avoid I/O hang, and rescan the device 831 + * to revalidate it. Running the queue first is necessary 832 + * because another thread may be waiting inside 833 + * blk_mq_freeze_queue_wait() and because that call may be 834 + * waiting for pending I/O to finish. 835 + */ 829 836 blk_mq_run_hw_queues(sdev->request_queue, true); 830 837 scsi_rescan_device(dev); 831 838 } 832 - mutex_unlock(&sdev->state_mutex); 833 839 834 840 return ret == 0 ? count : -EINVAL; 835 841 }
+3 -3
drivers/scsi/scsi_transport_iscsi.c
··· 1899 1899 } 1900 1900 spin_unlock_irqrestore(&session->lock, flags); 1901 1901 1902 - if (session->transport->session_recovery_timedout) 1903 - session->transport->session_recovery_timedout(session); 1904 - 1905 1902 ISCSI_DBG_TRANS_SESSION(session, "Unblocking SCSI target\n"); 1906 1903 scsi_target_unblock(&session->dev, SDEV_TRANSPORT_OFFLINE); 1907 1904 ISCSI_DBG_TRANS_SESSION(session, "Completed unblocking SCSI target\n"); 1905 + 1906 + if (session->transport->session_recovery_timedout) 1907 + session->transport->session_recovery_timedout(session); 1908 1908 } 1909 1909 1910 1910 static void __iscsi_unblock_session(struct work_struct *work)
+1
drivers/scsi/ufs/ufs-mediatek.c
··· 1189 1189 } 1190 1190 link = device_link_add(dev, &reset_pdev->dev, 1191 1191 DL_FLAG_AUTOPROBE_CONSUMER); 1192 + put_device(&reset_pdev->dev); 1192 1193 if (!link) { 1193 1194 dev_notice(dev, "add reset device_link fail\n"); 1194 1195 goto skip_reset;
+18
drivers/scsi/ufs/ufshcd-pci.c
··· 421 421 return err; 422 422 } 423 423 424 + static int ufs_intel_adl_init(struct ufs_hba *hba) 425 + { 426 + hba->nop_out_timeout = 200; 427 + hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8; 428 + return ufs_intel_common_init(hba); 429 + } 430 + 424 431 static struct ufs_hba_variant_ops ufs_intel_cnl_hba_vops = { 425 432 .name = "intel-pci", 426 433 .init = ufs_intel_common_init, ··· 452 445 .link_startup_notify = ufs_intel_link_startup_notify, 453 446 .pwr_change_notify = ufs_intel_lkf_pwr_change_notify, 454 447 .apply_dev_quirks = ufs_intel_lkf_apply_dev_quirks, 448 + .resume = ufs_intel_resume, 449 + .device_reset = ufs_intel_device_reset, 450 + }; 451 + 452 + static struct ufs_hba_variant_ops ufs_intel_adl_hba_vops = { 453 + .name = "intel-pci", 454 + .init = ufs_intel_adl_init, 455 + .exit = ufs_intel_common_exit, 456 + .link_startup_notify = ufs_intel_link_startup_notify, 455 457 .resume = ufs_intel_resume, 456 458 .device_reset = ufs_intel_device_reset, 457 459 }; ··· 577 561 { PCI_VDEVICE(INTEL, 0x4B41), (kernel_ulong_t)&ufs_intel_ehl_hba_vops }, 578 562 { PCI_VDEVICE(INTEL, 0x4B43), (kernel_ulong_t)&ufs_intel_ehl_hba_vops }, 579 563 { PCI_VDEVICE(INTEL, 0x98FA), (kernel_ulong_t)&ufs_intel_lkf_hba_vops }, 564 + { PCI_VDEVICE(INTEL, 0x51FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, 565 + { PCI_VDEVICE(INTEL, 0x54FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, 580 566 { } /* terminate list */ 581 567 }; 582 568
+1 -7
drivers/scsi/ufs/ufshcd.c
··· 6483 6483 irqreturn_t ret = IRQ_NONE; 6484 6484 int tag; 6485 6485 6486 - pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL); 6487 - 6488 6486 spin_lock_irqsave(hba->host->host_lock, flags); 6487 + pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL); 6489 6488 issued = hba->outstanding_tasks & ~pending; 6490 6489 for_each_set_bit(tag, &issued, hba->nutmrs) { 6491 6490 struct request *req = hba->tmf_rqs[tag]; ··· 6647 6648 err = wait_for_completion_io_timeout(&wait, 6648 6649 msecs_to_jiffies(TM_CMD_TIMEOUT)); 6649 6650 if (!err) { 6650 - /* 6651 - * Make sure that ufshcd_compl_tm() does not trigger a 6652 - * use-after-free. 6653 - */ 6654 - req->end_io_data = NULL; 6655 6651 ufshcd_add_tm_upiu_trace(hba, task_tag, UFS_TM_ERR); 6656 6652 dev_err(hba->dev, "%s: task management cmd 0x%.2x timed-out\n", 6657 6653 __func__, tm_function);
+1 -1
drivers/scsi/ufs/ufshpb.c
··· 330 330 cdb[0] = UFSHPB_READ; 331 331 332 332 if (hba->dev_quirks & UFS_DEVICE_QUIRK_SWAP_L2P_ENTRY_FOR_HPB_READ) 333 - ppn_tmp = swab64(ppn); 333 + ppn_tmp = (__force __be64)swab64((__force u64)ppn); 334 334 335 335 /* ppn value is stored as big-endian in the host memory */ 336 336 memcpy(&cdb[6], &ppn_tmp, sizeof(__be64));
+8 -8
drivers/target/target_core_fabric_configfs.c
··· 520 520 { 521 521 struct se_lun *lun = item_to_lun(item); 522 522 523 - if (!lun || !lun->lun_se_dev) 523 + if (!lun->lun_se_dev) 524 524 return -ENODEV; 525 525 526 526 return core_alua_show_tg_pt_gp_info(lun, page); ··· 531 531 { 532 532 struct se_lun *lun = item_to_lun(item); 533 533 534 - if (!lun || !lun->lun_se_dev) 534 + if (!lun->lun_se_dev) 535 535 return -ENODEV; 536 536 537 537 return core_alua_store_tg_pt_gp_info(lun, page, count); ··· 542 542 { 543 543 struct se_lun *lun = item_to_lun(item); 544 544 545 - if (!lun || !lun->lun_se_dev) 545 + if (!lun->lun_se_dev) 546 546 return -ENODEV; 547 547 548 548 return core_alua_show_offline_bit(lun, page); ··· 553 553 { 554 554 struct se_lun *lun = item_to_lun(item); 555 555 556 - if (!lun || !lun->lun_se_dev) 556 + if (!lun->lun_se_dev) 557 557 return -ENODEV; 558 558 559 559 return core_alua_store_offline_bit(lun, page, count); ··· 564 564 { 565 565 struct se_lun *lun = item_to_lun(item); 566 566 567 - if (!lun || !lun->lun_se_dev) 567 + if (!lun->lun_se_dev) 568 568 return -ENODEV; 569 569 570 570 return core_alua_show_secondary_status(lun, page); ··· 575 575 { 576 576 struct se_lun *lun = item_to_lun(item); 577 577 578 - if (!lun || !lun->lun_se_dev) 578 + if (!lun->lun_se_dev) 579 579 return -ENODEV; 580 580 581 581 return core_alua_store_secondary_status(lun, page, count); ··· 586 586 { 587 587 struct se_lun *lun = item_to_lun(item); 588 588 589 - if (!lun || !lun->lun_se_dev) 589 + if (!lun->lun_se_dev) 590 590 return -ENODEV; 591 591 592 592 return core_alua_show_secondary_write_metadata(lun, page); ··· 597 597 { 598 598 struct se_lun *lun = item_to_lun(item); 599 599 600 - if (!lun || !lun->lun_se_dev) 600 + if (!lun->lun_se_dev) 601 601 return -ENODEV; 602 602 603 603 return core_alua_store_secondary_write_metadata(lun, page, count);
+7 -7
drivers/target/target_core_spc.c
··· 40 40 * 41 41 * See spc4r17 section 6.4.2 Table 135 42 42 */ 43 - spin_lock(&lun->lun_tg_pt_gp_lock); 44 - tg_pt_gp = lun->lun_tg_pt_gp; 43 + rcu_read_lock(); 44 + tg_pt_gp = rcu_dereference(lun->lun_tg_pt_gp); 45 45 if (tg_pt_gp) 46 46 buf[5] |= tg_pt_gp->tg_pt_gp_alua_access_type; 47 - spin_unlock(&lun->lun_tg_pt_gp_lock); 47 + rcu_read_unlock(); 48 48 } 49 49 50 50 static u16 ··· 325 325 * Get the PROTOCOL IDENTIFIER as defined by spc4r17 326 326 * section 7.5.1 Table 362 327 327 */ 328 - spin_lock(&lun->lun_tg_pt_gp_lock); 329 - tg_pt_gp = lun->lun_tg_pt_gp; 328 + rcu_read_lock(); 329 + tg_pt_gp = rcu_dereference(lun->lun_tg_pt_gp); 330 330 if (!tg_pt_gp) { 331 - spin_unlock(&lun->lun_tg_pt_gp_lock); 331 + rcu_read_unlock(); 332 332 goto check_lu_gp; 333 333 } 334 334 tg_pt_gp_id = tg_pt_gp->tg_pt_gp_id; 335 - spin_unlock(&lun->lun_tg_pt_gp_lock); 335 + rcu_read_unlock(); 336 336 337 337 buf[off] = tpg->proto_id << 4; 338 338 buf[off++] |= 0x1; /* CODE SET == Binary */