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

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"Seven small fixes, six in drivers and one in sd.

The sd fix is so large because it changes a struct pointer to a struct
but otherwise is fairly simple"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: ufs: qcom-ufs: dt-bindings: Document the SM8650 UFS Controller
scsi: sd: Fix sshdr use in sd_suspend_common()
scsi: scsi_debug: Delete some bogus error checking
scsi: scsi_debug: Fix some bugs in sdebug_error_write()
scsi: ufs: core: Fix racing issue between ufshcd_mcq_abort() and ISR
scsi: ufs: core: Expand MCQ queue slot to DeviceQueueDepth + 1
scsi: qla2xxx: Fix system crash due to bad pointer access

+40 -41
+2
Documentation/devicetree/bindings/ufs/qcom,ufs.yaml
··· 36 36 - qcom,sm8350-ufshc 37 37 - qcom,sm8450-ufshc 38 38 - qcom,sm8550-ufshc 39 + - qcom,sm8650-ufshc 39 40 - const: qcom,ufshc 40 41 - const: jedec,ufs-2.0 41 42 ··· 123 122 - qcom,sm8350-ufshc 124 123 - qcom,sm8450-ufshc 125 124 - qcom,sm8550-ufshc 125 + - qcom,sm8650-ufshc 126 126 then: 127 127 properties: 128 128 clocks:
+10 -2
drivers/scsi/qla2xxx/qla_os.c
··· 1837 1837 } 1838 1838 1839 1839 spin_lock_irqsave(qp->qp_lock_ptr, *flags); 1840 - if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd))) 1841 - sp->done(sp, res); 1840 + switch (sp->type) { 1841 + case SRB_SCSI_CMD: 1842 + if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd))) 1843 + sp->done(sp, res); 1844 + break; 1845 + default: 1846 + if (ret_cmd) 1847 + sp->done(sp, res); 1848 + break; 1849 + } 1842 1850 } else { 1843 1851 sp->done(sp, res); 1844 1852 }
+1 -8
drivers/scsi/scsi_debug.c
··· 1019 1019 struct sdebug_err_inject *inject; 1020 1020 struct scsi_device *sdev = (struct scsi_device *)file->f_inode->i_private; 1021 1021 1022 - buf = kmalloc(count, GFP_KERNEL); 1022 + buf = kzalloc(count + 1, GFP_KERNEL); 1023 1023 if (!buf) 1024 1024 return -ENOMEM; 1025 1025 ··· 1132 1132 static int sdebug_target_alloc(struct scsi_target *starget) 1133 1133 { 1134 1134 struct sdebug_target_info *targetip; 1135 - struct dentry *dentry; 1136 1135 1137 1136 targetip = kzalloc(sizeof(struct sdebug_target_info), GFP_KERNEL); 1138 1137 if (!targetip) ··· 1139 1140 1140 1141 targetip->debugfs_entry = debugfs_create_dir(dev_name(&starget->dev), 1141 1142 sdebug_debugfs_root); 1142 - if (IS_ERR_OR_NULL(targetip->debugfs_entry)) 1143 - pr_info("%s: failed to create debugfs directory for target %s\n", 1144 - __func__, dev_name(&starget->dev)); 1145 1143 1146 1144 debugfs_create_file("fail_reset", 0600, targetip->debugfs_entry, starget, 1147 1145 &sdebug_target_reset_fail_fops); 1148 - if (IS_ERR_OR_NULL(dentry)) 1149 - pr_info("%s: failed to create fail_reset file for target %s\n", 1150 - __func__, dev_name(&starget->dev)); 1151 1146 1152 1147 starget->hostdata = targetip; 1153 1148
+23 -30
drivers/scsi/sd.c
··· 1643 1643 return disk_changed ? DISK_EVENT_MEDIA_CHANGE : 0; 1644 1644 } 1645 1645 1646 - static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) 1646 + static int sd_sync_cache(struct scsi_disk *sdkp) 1647 1647 { 1648 1648 int retries, res; 1649 1649 struct scsi_device *sdp = sdkp->device; 1650 1650 const int timeout = sdp->request_queue->rq_timeout 1651 1651 * SD_FLUSH_TIMEOUT_MULTIPLIER; 1652 - struct scsi_sense_hdr my_sshdr; 1652 + struct scsi_sense_hdr sshdr; 1653 1653 const struct scsi_exec_args exec_args = { 1654 1654 .req_flags = BLK_MQ_REQ_PM, 1655 - /* caller might not be interested in sense, but we need it */ 1656 - .sshdr = sshdr ? : &my_sshdr, 1655 + .sshdr = &sshdr, 1657 1656 }; 1658 1657 1659 1658 if (!scsi_device_online(sdp)) 1660 1659 return -ENODEV; 1661 - 1662 - sshdr = exec_args.sshdr; 1663 1660 1664 1661 for (retries = 3; retries > 0; --retries) { 1665 1662 unsigned char cmd[16] = { 0 }; ··· 1682 1685 return res; 1683 1686 1684 1687 if (scsi_status_is_check_condition(res) && 1685 - scsi_sense_valid(sshdr)) { 1686 - sd_print_sense_hdr(sdkp, sshdr); 1688 + scsi_sense_valid(&sshdr)) { 1689 + sd_print_sense_hdr(sdkp, &sshdr); 1687 1690 1688 1691 /* we need to evaluate the error return */ 1689 - if (sshdr->asc == 0x3a || /* medium not present */ 1690 - sshdr->asc == 0x20 || /* invalid command */ 1691 - (sshdr->asc == 0x74 && sshdr->ascq == 0x71)) /* drive is password locked */ 1692 + if (sshdr.asc == 0x3a || /* medium not present */ 1693 + sshdr.asc == 0x20 || /* invalid command */ 1694 + (sshdr.asc == 0x74 && sshdr.ascq == 0x71)) /* drive is password locked */ 1692 1695 /* this is no error here */ 1696 + return 0; 1697 + /* 1698 + * This drive doesn't support sync and there's not much 1699 + * we can do because this is called during shutdown 1700 + * or suspend so just return success so those operations 1701 + * can proceed. 1702 + */ 1703 + if (sshdr.sense_key == ILLEGAL_REQUEST) 1693 1704 return 0; 1694 1705 } 1695 1706 ··· 3858 3853 3859 3854 if (sdkp->WCE && sdkp->media_present) { 3860 3855 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); 3861 - sd_sync_cache(sdkp, NULL); 3856 + sd_sync_cache(sdkp); 3862 3857 } 3863 3858 3864 3859 if ((system_state != SYSTEM_RESTART && ··· 3879 3874 static int sd_suspend_common(struct device *dev, bool runtime) 3880 3875 { 3881 3876 struct scsi_disk *sdkp = dev_get_drvdata(dev); 3882 - struct scsi_sense_hdr sshdr; 3883 3877 int ret = 0; 3884 3878 3885 3879 if (!sdkp) /* E.g.: runtime suspend following sd_remove() */ ··· 3887 3883 if (sdkp->WCE && sdkp->media_present) { 3888 3884 if (!sdkp->device->silence_suspend) 3889 3885 sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); 3890 - ret = sd_sync_cache(sdkp, &sshdr); 3886 + ret = sd_sync_cache(sdkp); 3887 + /* ignore OFFLINE device */ 3888 + if (ret == -ENODEV) 3889 + return 0; 3891 3890 3892 - if (ret) { 3893 - /* ignore OFFLINE device */ 3894 - if (ret == -ENODEV) 3895 - return 0; 3896 - 3897 - if (!scsi_sense_valid(&sshdr) || 3898 - sshdr.sense_key != ILLEGAL_REQUEST) 3899 - return ret; 3900 - 3901 - /* 3902 - * sshdr.sense_key == ILLEGAL_REQUEST means this drive 3903 - * doesn't support sync. There's not much to do and 3904 - * suspend shouldn't fail. 3905 - */ 3906 - ret = 0; 3907 - } 3891 + if (ret) 3892 + return ret; 3908 3893 } 3909 3894 3910 3895 if (sd_do_start_stop(sdkp->device, runtime)) {
+4 -1
drivers/ufs/core/ufs-mcq.c
··· 436 436 437 437 for (i = 0; i < hba->nr_hw_queues; i++) { 438 438 hwq = &hba->uhq[i]; 439 - hwq->max_entries = hba->nutrs; 439 + hwq->max_entries = hba->nutrs + 1; 440 440 spin_lock_init(&hwq->sq_lock); 441 441 spin_lock_init(&hwq->cq_lock); 442 442 mutex_init(&hwq->sq_mutex); ··· 630 630 int tag = scsi_cmd_to_rq(cmd)->tag; 631 631 struct ufshcd_lrb *lrbp = &hba->lrb[tag]; 632 632 struct ufs_hw_queue *hwq; 633 + unsigned long flags; 633 634 int err = FAILED; 634 635 635 636 if (!ufshcd_cmd_inflight(lrbp->cmd)) { ··· 671 670 } 672 671 673 672 err = SUCCESS; 673 + spin_lock_irqsave(&hwq->cq_lock, flags); 674 674 if (ufshcd_cmd_inflight(lrbp->cmd)) 675 675 ufshcd_release_scsi_cmd(hba, lrbp); 676 + spin_unlock_irqrestore(&hwq->cq_lock, flags); 676 677 677 678 out: 678 679 return err;