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:
"Twelve minor fixes, all in drivers or doc.

Most of the fixes are pretty obvious (although we had two goes to get
the UFS sysfs doc right) and the biggest change is in the ufs driver
which they've extensively tested"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: ibmvfc: Set default timeout to avoid crash during migration
scsi: target: tcmu: Fix use-after-free of se_cmd->priv
scsi: fnic: Fix memleak in vnic_dev_init_devcmd2
scsi: libfc: Avoid invoking response handler twice if ep is already completed
scsi: scsi_transport_srp: Don't block target in failfast state
scsi: docs: ABI: sysfs-driver-ufs: Rectify table formatting
scsi: ufs: Fix tm request when non-fatal error happens
scsi: ufs: Fix livelock of ufshcd_clear_ua_wluns()
scsi: ibmvfc: Fix missing cast of ibmvfc_event pointer to u64 handle
scsi: ufs: ufshcd-pltfrm depends on HAS_IOMEM
scsi: megaraid_sas: Fix MEGASAS_IOC_FIRMWARE regression
scsi: docs: ABI: sysfs-driver-ufs: Add DeepSleep power mode

+90 -42
+22 -14
Documentation/ABI/testing/sysfs-driver-ufs
··· 916 916 Contact: Subhash Jadavani <subhashj@codeaurora.org> 917 917 Description: This entry could be used to set or show the UFS device 918 918 runtime power management level. The current driver 919 - implementation supports 6 levels with next target states: 919 + implementation supports 7 levels with next target states: 920 920 921 921 == ==================================================== 922 - 0 an UFS device will stay active, an UIC link will 922 + 0 UFS device will stay active, UIC link will 923 923 stay active 924 - 1 an UFS device will stay active, an UIC link will 924 + 1 UFS device will stay active, UIC link will 925 925 hibernate 926 - 2 an UFS device will moved to sleep, an UIC link will 926 + 2 UFS device will be moved to sleep, UIC link will 927 927 stay active 928 - 3 an UFS device will moved to sleep, an UIC link will 928 + 3 UFS device will be moved to sleep, UIC link will 929 929 hibernate 930 - 4 an UFS device will be powered off, an UIC link will 930 + 4 UFS device will be powered off, UIC link will 931 931 hibernate 932 - 5 an UFS device will be powered off, an UIC link will 932 + 5 UFS device will be powered off, UIC link will 933 933 be powered off 934 + 6 UFS device will be moved to deep sleep, UIC link 935 + will be powered off. Note, deep sleep might not be 936 + supported in which case this value will not be 937 + accepted 934 938 == ==================================================== 935 939 936 940 What: /sys/bus/platform/drivers/ufshcd/*/rpm_target_dev_state ··· 958 954 Contact: Subhash Jadavani <subhashj@codeaurora.org> 959 955 Description: This entry could be used to set or show the UFS device 960 956 system power management level. The current driver 961 - implementation supports 6 levels with next target states: 957 + implementation supports 7 levels with next target states: 962 958 963 959 == ==================================================== 964 - 0 an UFS device will stay active, an UIC link will 960 + 0 UFS device will stay active, UIC link will 965 961 stay active 966 - 1 an UFS device will stay active, an UIC link will 962 + 1 UFS device will stay active, UIC link will 967 963 hibernate 968 - 2 an UFS device will moved to sleep, an UIC link will 964 + 2 UFS device will be moved to sleep, UIC link will 969 965 stay active 970 - 3 an UFS device will moved to sleep, an UIC link will 966 + 3 UFS device will be moved to sleep, UIC link will 971 967 hibernate 972 - 4 an UFS device will be powered off, an UIC link will 968 + 4 UFS device will be powered off, UIC link will 973 969 hibernate 974 - 5 an UFS device will be powered off, an UIC link will 970 + 5 UFS device will be powered off, UIC link will 975 971 be powered off 972 + 6 UFS device will be moved to deep sleep, UIC link 973 + will be powered off. Note, deep sleep might not be 974 + supported in which case this value will not be 975 + accepted 976 976 == ==================================================== 977 977 978 978 What: /sys/bus/platform/drivers/ufshcd/*/spm_target_dev_state
+5 -3
drivers/scsi/fnic/vnic_dev.c
··· 444 444 fetch_index = ioread32(&vdev->devcmd2->wq.ctrl->fetch_index); 445 445 if (fetch_index == 0xFFFFFFFF) { /* check for hardware gone */ 446 446 pr_err("error in devcmd2 init"); 447 - return -ENODEV; 447 + err = -ENODEV; 448 + goto err_free_wq; 448 449 } 449 450 450 451 /* ··· 461 460 err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring, 462 461 DEVCMD2_RING_SIZE, DEVCMD2_DESC_SIZE); 463 462 if (err) 464 - goto err_free_wq; 463 + goto err_disable_wq; 465 464 466 465 vdev->devcmd2->result = 467 466 (struct devcmd2_result *) vdev->devcmd2->results_ring.descs; ··· 482 481 483 482 err_free_desc_ring: 484 483 vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring); 485 - err_free_wq: 484 + err_disable_wq: 486 485 vnic_wq_disable(&vdev->devcmd2->wq); 486 + err_free_wq: 487 487 vnic_wq_free(&vdev->devcmd2->wq); 488 488 err_free_devcmd2: 489 489 kfree(vdev->devcmd2);
+5 -3
drivers/scsi/ibmvscsi/ibmvfc.c
··· 1744 1744 iu->pri_task_attr = IBMVFC_SIMPLE_TASK; 1745 1745 } 1746 1746 1747 - vfc_cmd->correlation = cpu_to_be64(evt); 1747 + vfc_cmd->correlation = cpu_to_be64((u64)evt); 1748 1748 1749 1749 if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev)))) 1750 1750 return ibmvfc_send_event(evt, vhost, 0); ··· 2418 2418 tmf->flags = cpu_to_be16((IBMVFC_NO_MEM_DESC | IBMVFC_TMF)); 2419 2419 evt->sync_iu = &rsp_iu; 2420 2420 2421 - tmf->correlation = cpu_to_be64(evt); 2421 + tmf->correlation = cpu_to_be64((u64)evt); 2422 2422 2423 2423 init_completion(&evt->comp); 2424 2424 rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); ··· 3007 3007 unsigned long flags = 0; 3008 3008 3009 3009 spin_lock_irqsave(shost->host_lock, flags); 3010 - if (sdev->type == TYPE_DISK) 3010 + if (sdev->type == TYPE_DISK) { 3011 3011 sdev->allow_restart = 1; 3012 + blk_queue_rq_timeout(sdev->request_queue, 120 * HZ); 3013 + } 3012 3014 spin_unlock_irqrestore(shost->host_lock, flags); 3013 3015 return 0; 3014 3016 }
+14 -2
drivers/scsi/libfc/fc_exch.c
··· 1623 1623 rc = fc_exch_done_locked(ep); 1624 1624 WARN_ON(fc_seq_exch(sp) != ep); 1625 1625 spin_unlock_bh(&ep->ex_lock); 1626 - if (!rc) 1626 + if (!rc) { 1627 1627 fc_exch_delete(ep); 1628 + } else { 1629 + FC_EXCH_DBG(ep, "ep is completed already," 1630 + "hence skip calling the resp\n"); 1631 + goto skip_resp; 1632 + } 1628 1633 } 1629 1634 1630 1635 /* ··· 1648 1643 if (!fc_invoke_resp(ep, sp, fp)) 1649 1644 fc_frame_free(fp); 1650 1645 1646 + skip_resp: 1651 1647 fc_exch_release(ep); 1652 1648 return; 1653 1649 rel: ··· 1905 1899 1906 1900 fc_exch_hold(ep); 1907 1901 1908 - if (!rc) 1902 + if (!rc) { 1909 1903 fc_exch_delete(ep); 1904 + } else { 1905 + FC_EXCH_DBG(ep, "ep is completed already," 1906 + "hence skip calling the resp\n"); 1907 + goto skip_resp; 1908 + } 1910 1909 1911 1910 fc_invoke_resp(ep, sp, ERR_PTR(-FC_EX_CLOSED)); 1911 + skip_resp: 1912 1912 fc_seq_set_resp(sp, NULL, ep->arg); 1913 1913 fc_exch_release(ep); 1914 1914 }
+2 -4
drivers/scsi/megaraid/megaraid_sas_base.c
··· 8244 8244 goto out; 8245 8245 } 8246 8246 8247 + /* always store 64 bits regardless of addressing */ 8247 8248 sense_ptr = (void *)cmd->frame + ioc->sense_off; 8248 - if (instance->consistent_mask_64bit) 8249 - put_unaligned_le64(sense_handle, sense_ptr); 8250 - else 8251 - put_unaligned_le32(sense_handle, sense_ptr); 8249 + put_unaligned_le64(sense_handle, sense_ptr); 8252 8250 } 8253 8251 8254 8252 /*
+8 -1
drivers/scsi/scsi_transport_srp.c
··· 541 541 res = mutex_lock_interruptible(&rport->mutex); 542 542 if (res) 543 543 goto out; 544 - scsi_target_block(&shost->shost_gendev); 544 + if (rport->state != SRP_RPORT_FAIL_FAST) 545 + /* 546 + * sdev state must be SDEV_TRANSPORT_OFFLINE, transition 547 + * to SDEV_BLOCK is illegal. Calling scsi_target_unblock() 548 + * later is ok though, scsi_internal_device_unblock_nowait() 549 + * treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK. 550 + */ 551 + scsi_target_block(&shost->shost_gendev); 545 552 res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; 546 553 pr_debug("%s (state %d): transport.reconnect() returned %d\n", 547 554 dev_name(&shost->shost_gendev), rport->state, res);
+1
drivers/scsi/ufs/Kconfig
··· 72 72 config SCSI_UFSHCD_PLATFORM 73 73 tristate "Platform bus based UFS Controller support" 74 74 depends on SCSI_UFSHCD 75 + depends on HAS_IOMEM 75 76 help 76 77 This selects the UFS host controller support. Select this if 77 78 you have an UFS controller on Platform bus.
+25 -12
drivers/scsi/ufs/ufshcd.c
··· 3996 3996 if (ret) 3997 3997 dev_err(hba->dev, "%s: link recovery failed, err %d", 3998 3998 __func__, ret); 3999 + else 4000 + ufshcd_clear_ua_wluns(hba); 3999 4001 4000 4002 return ret; 4001 4003 } ··· 4994 4992 break; 4995 4993 } /* end of switch */ 4996 4994 4997 - if ((host_byte(result) != DID_OK) && !hba->silence_err_logs) 4995 + if ((host_byte(result) != DID_OK) && 4996 + (host_byte(result) != DID_REQUEUE) && !hba->silence_err_logs) 4998 4997 ufshcd_print_trs(hba, 1 << lrbp->task_tag, true); 4999 4998 return result; 5000 4999 } ··· 6004 6001 ufshcd_scsi_unblock_requests(hba); 6005 6002 ufshcd_err_handling_unprepare(hba); 6006 6003 up(&hba->eh_sem); 6004 + 6005 + if (!err && needs_reset) 6006 + ufshcd_clear_ua_wluns(hba); 6007 6007 } 6008 6008 6009 6009 /** ··· 6301 6295 intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); 6302 6296 } 6303 6297 6304 - if (enabled_intr_status && retval == IRQ_NONE) { 6305 - dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n", 6306 - __func__, intr_status); 6298 + if (enabled_intr_status && retval == IRQ_NONE && 6299 + !ufshcd_eh_in_progress(hba)) { 6300 + dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x (0x%08x, 0x%08x)\n", 6301 + __func__, 6302 + intr_status, 6303 + hba->ufs_stats.last_intr_status, 6304 + enabled_intr_status); 6307 6305 ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: "); 6308 6306 } 6309 6307 ··· 6351 6341 * Even though we use wait_event() which sleeps indefinitely, 6352 6342 * the maximum wait time is bounded by %TM_CMD_TIMEOUT. 6353 6343 */ 6354 - req = blk_get_request(q, REQ_OP_DRV_OUT, BLK_MQ_REQ_RESERVED); 6344 + req = blk_get_request(q, REQ_OP_DRV_OUT, 0); 6345 + if (IS_ERR(req)) 6346 + return PTR_ERR(req); 6347 + 6355 6348 req->end_io_data = &wait; 6356 6349 free_slot = req->tag; 6357 6350 WARN_ON_ONCE(free_slot < 0 || free_slot >= hba->nutmrs); ··· 6951 6938 ufshcd_set_clk_freq(hba, true); 6952 6939 6953 6940 err = ufshcd_hba_enable(hba); 6954 - if (err) 6955 - goto out; 6956 6941 6957 6942 /* Establish the link again and restore the device */ 6958 - err = ufshcd_probe_hba(hba, false); 6959 6943 if (!err) 6960 - ufshcd_clear_ua_wluns(hba); 6961 - out: 6944 + err = ufshcd_probe_hba(hba, false); 6945 + 6962 6946 if (err) 6963 6947 dev_err(hba->dev, "%s: Host init failed %d\n", __func__, err); 6964 6948 ufshcd_update_evt_hist(hba, UFS_EVT_HOST_RESET, (u32)err); ··· 7726 7716 if (ret) 7727 7717 goto out; 7728 7718 7719 + ufshcd_clear_ua_wluns(hba); 7720 + 7729 7721 /* Initialize devfreq after UFS device is detected */ 7730 7722 if (ufshcd_is_clkscaling_supported(hba)) { 7731 7723 memcpy(&hba->clk_scaling.saved_pwr_info.info, ··· 7929 7917 pm_runtime_put_sync(hba->dev); 7930 7918 ufshcd_exit_clk_scaling(hba); 7931 7919 ufshcd_hba_exit(hba); 7932 - } else { 7933 - ufshcd_clear_ua_wluns(hba); 7934 7920 } 7935 7921 } 7936 7922 ··· 8785 8775 ufshcd_resume_clkscaling(hba); 8786 8776 hba->clk_gating.is_suspended = false; 8787 8777 hba->dev_info.b_rpm_dev_flush_capable = false; 8778 + ufshcd_clear_ua_wluns(hba); 8788 8779 ufshcd_release(hba); 8789 8780 out: 8790 8781 if (hba->dev_info.b_rpm_dev_flush_capable) { ··· 8895 8884 hba->dev_info.b_rpm_dev_flush_capable = false; 8896 8885 cancel_delayed_work(&hba->rpm_dev_flush_recheck_work); 8897 8886 } 8887 + 8888 + ufshcd_clear_ua_wluns(hba); 8898 8889 8899 8890 /* Schedule clock gating in case of no access to UFS device yet */ 8900 8891 ufshcd_release(hba);
+8 -3
drivers/target/target_core_user.c
··· 562 562 563 563 static inline void tcmu_free_cmd(struct tcmu_cmd *tcmu_cmd) 564 564 { 565 - if (tcmu_cmd->se_cmd) 566 - tcmu_cmd->se_cmd->priv = NULL; 567 565 kfree(tcmu_cmd->dbi); 568 566 kmem_cache_free(tcmu_cmd_cache, tcmu_cmd); 569 567 } ··· 1172 1174 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 1173 1175 1174 1176 mutex_lock(&udev->cmdr_lock); 1175 - se_cmd->priv = tcmu_cmd; 1176 1177 if (!(se_cmd->transport_state & CMD_T_ABORTED)) 1177 1178 ret = queue_cmd_ring(tcmu_cmd, &scsi_ret); 1178 1179 if (ret < 0) 1179 1180 tcmu_free_cmd(tcmu_cmd); 1181 + else 1182 + se_cmd->priv = tcmu_cmd; 1180 1183 mutex_unlock(&udev->cmdr_lock); 1181 1184 return scsi_ret; 1182 1185 } ··· 1240 1241 1241 1242 list_del_init(&cmd->queue_entry); 1242 1243 tcmu_free_cmd(cmd); 1244 + se_cmd->priv = NULL; 1243 1245 target_complete_cmd(se_cmd, SAM_STAT_TASK_ABORTED); 1244 1246 unqueued = true; 1245 1247 } ··· 1332 1332 } 1333 1333 1334 1334 done: 1335 + se_cmd->priv = NULL; 1335 1336 if (read_len_valid) { 1336 1337 pr_debug("read_len = %d\n", read_len); 1337 1338 target_complete_cmd_with_length(cmd->se_cmd, ··· 1479 1478 se_cmd = cmd->se_cmd; 1480 1479 tcmu_free_cmd(cmd); 1481 1480 1481 + se_cmd->priv = NULL; 1482 1482 target_complete_cmd(se_cmd, SAM_STAT_TASK_SET_FULL); 1483 1483 } 1484 1484 ··· 1594 1592 * removed then LIO core will do the right thing and 1595 1593 * fail the retry. 1596 1594 */ 1595 + tcmu_cmd->se_cmd->priv = NULL; 1597 1596 target_complete_cmd(tcmu_cmd->se_cmd, SAM_STAT_BUSY); 1598 1597 tcmu_free_cmd(tcmu_cmd); 1599 1598 continue; ··· 1608 1605 * Ignore scsi_ret for now. target_complete_cmd 1609 1606 * drops it. 1610 1607 */ 1608 + tcmu_cmd->se_cmd->priv = NULL; 1611 1609 target_complete_cmd(tcmu_cmd->se_cmd, 1612 1610 SAM_STAT_CHECK_CONDITION); 1613 1611 tcmu_free_cmd(tcmu_cmd); ··· 2216 2212 if (!test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) { 2217 2213 WARN_ON(!cmd->se_cmd); 2218 2214 list_del_init(&cmd->queue_entry); 2215 + cmd->se_cmd->priv = NULL; 2219 2216 if (err_level == 1) { 2220 2217 /* 2221 2218 * Userspace was not able to start the