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:
"A number of fairly small fixes, mostly in drivers but two in the core
to change a retry for depopulation (a trendy new hdd thing that
reorganizes blocks away from failing elements) and one to fix a GFP_
annotation to avoid a lock dependency (the third core patch is all in
testing)"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: qla1280: Fix kernel oops when debug level > 2
scsi: ufs: core: Fix error return with query response
scsi: storvsc: Set correct data length for sending SCSI command without payload
scsi: ufs: core: Fix use-after free in init error and remove paths
scsi: core: Do not retry I/Os during depopulation
scsi: core: Use GFP_NOIO to avoid circular locking dependency
scsi: ufs: Fix toggling of clk_gating.state when clock gating is not allowed
scsi: ufs: core: Ensure clk_gating.lock is used only after initialization
scsi: ufs: core: Simplify temperature exception event handling
scsi: target: core: Add line break to status show
scsi: ufs: core: Fix the HIGH/LOW_TEMP Bit Definitions
scsi: core: Add passthrough tests for success and no failure definitions

+65 -63
+1 -1
drivers/scsi/qla1280.c
··· 2867 2867 dprintk(3, "S/G Segment phys_addr=%x %x, len=0x%x\n", 2868 2868 cpu_to_le32(upper_32_bits(dma_handle)), 2869 2869 cpu_to_le32(lower_32_bits(dma_handle)), 2870 - cpu_to_le32(sg_dma_len(sg_next(s)))); 2870 + cpu_to_le32(sg_dma_len(s))); 2871 2871 remseg--; 2872 2872 } 2873 2873 dprintk(5, "qla1280_64bit_start_scsi: Scatter/gather "
+7 -2
drivers/scsi/scsi_lib.c
··· 872 872 case 0x1a: /* start stop unit in progress */ 873 873 case 0x1b: /* sanitize in progress */ 874 874 case 0x1d: /* configuration in progress */ 875 - case 0x24: /* depopulation in progress */ 876 - case 0x25: /* depopulation restore in progress */ 877 875 action = ACTION_DELAYED_RETRY; 878 876 break; 879 877 case 0x0a: /* ALUA state transition */ 880 878 action = ACTION_DELAYED_REPREP; 881 879 break; 880 + /* 881 + * Depopulation might take many hours, 882 + * thus it is not worthwhile to retry. 883 + */ 884 + case 0x24: /* depopulation in progress */ 885 + case 0x25: /* depopulation restore in progress */ 886 + fallthrough; 882 887 default: 883 888 action = ACTION_FAIL; 884 889 break;
+7
drivers/scsi/scsi_lib_test.c
··· 67 67 }; 68 68 int i; 69 69 70 + /* Success */ 71 + sc.result = 0; 72 + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); 73 + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, NULL)); 74 + /* Command failed but caller did not pass in a failures array */ 75 + scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36); 76 + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, NULL)); 70 77 /* Match end of array */ 71 78 scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36); 72 79 KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures));
+1 -1
drivers/scsi/scsi_scan.c
··· 246 246 } 247 247 ret = sbitmap_init_node(&sdev->budget_map, 248 248 scsi_device_max_queue_depth(sdev), 249 - new_shift, GFP_KERNEL, 249 + new_shift, GFP_NOIO, 250 250 sdev->request_queue->node, false, true); 251 251 if (!ret) 252 252 sbitmap_resize(&sdev->budget_map, depth);
+1
drivers/scsi/storvsc_drv.c
··· 1800 1800 1801 1801 length = scsi_bufflen(scmnd); 1802 1802 payload = (struct vmbus_packet_mpb_array *)&cmd_request->mpb; 1803 + payload->range.len = 0; 1803 1804 payload_sz = 0; 1804 1805 1805 1806 if (scsi_sg_count(scmnd)) {
+2 -2
drivers/target/target_core_stat.c
··· 117 117 char *page) 118 118 { 119 119 if (to_stat_tgt_dev(item)->export_count) 120 - return snprintf(page, PAGE_SIZE, "activated"); 120 + return snprintf(page, PAGE_SIZE, "activated\n"); 121 121 else 122 - return snprintf(page, PAGE_SIZE, "deactivated"); 122 + return snprintf(page, PAGE_SIZE, "deactivated\n"); 123 123 } 124 124 125 125 static ssize_t target_stat_tgt_non_access_lus_show(struct config_item *item,
+35 -33
drivers/ufs/core/ufshcd.c
··· 2120 2120 INIT_DELAYED_WORK(&hba->clk_gating.gate_work, ufshcd_gate_work); 2121 2121 INIT_WORK(&hba->clk_gating.ungate_work, ufshcd_ungate_work); 2122 2122 2123 - spin_lock_init(&hba->clk_gating.lock); 2124 - 2125 2123 hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue( 2126 2124 "ufs_clk_gating_%d", WQ_MEM_RECLAIM | WQ_HIGHPRI, 2127 2125 hba->host->host_no); ··· 3104 3106 case UPIU_TRANSACTION_QUERY_RSP: { 3105 3107 u8 response = lrbp->ucd_rsp_ptr->header.response; 3106 3108 3107 - if (response == 0) 3109 + if (response == 0) { 3108 3110 err = ufshcd_copy_query_response(hba, lrbp); 3111 + } else { 3112 + err = -EINVAL; 3113 + dev_err(hba->dev, "%s: unexpected response in Query RSP: %x\n", 3114 + __func__, response); 3115 + } 3109 3116 break; 3110 3117 } 3111 3118 case UPIU_TRANSACTION_REJECT_UPIU: ··· 5979 5976 __func__, err); 5980 5977 } 5981 5978 5982 - static void ufshcd_temp_exception_event_handler(struct ufs_hba *hba, u16 status) 5983 - { 5984 - u32 value; 5985 - 5986 - if (ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR, 5987 - QUERY_ATTR_IDN_CASE_ROUGH_TEMP, 0, 0, &value)) 5988 - return; 5989 - 5990 - dev_info(hba->dev, "exception Tcase %d\n", value - 80); 5991 - 5992 - ufs_hwmon_notify_event(hba, status & MASK_EE_URGENT_TEMP); 5993 - 5994 - /* 5995 - * A placeholder for the platform vendors to add whatever additional 5996 - * steps required 5997 - */ 5998 - } 5999 - 6000 5979 static int __ufshcd_wb_toggle(struct ufs_hba *hba, bool set, enum flag_idn idn) 6001 5980 { 6002 5981 u8 index; ··· 6199 6214 ufshcd_bkops_exception_event_handler(hba); 6200 6215 6201 6216 if (status & hba->ee_drv_mask & MASK_EE_URGENT_TEMP) 6202 - ufshcd_temp_exception_event_handler(hba, status); 6217 + ufs_hwmon_notify_event(hba, status & MASK_EE_URGENT_TEMP); 6203 6218 6204 6219 ufs_debugfs_exception_event(hba, status); 6205 6220 } ··· 9145 9160 if (!IS_ERR_OR_NULL(clki->clk) && clki->enabled) 9146 9161 clk_disable_unprepare(clki->clk); 9147 9162 } 9148 - } else if (!ret && on) { 9163 + } else if (!ret && on && hba->clk_gating.is_initialized) { 9149 9164 scoped_guard(spinlock_irqsave, &hba->clk_gating.lock) 9150 9165 hba->clk_gating.state = CLKS_ON; 9151 9166 trace_ufshcd_clk_gating(dev_name(hba->dev), ··· 10232 10247 #endif /* CONFIG_PM_SLEEP */ 10233 10248 10234 10249 /** 10235 - * ufshcd_dealloc_host - deallocate Host Bus Adapter (HBA) 10236 - * @hba: pointer to Host Bus Adapter (HBA) 10237 - */ 10238 - void ufshcd_dealloc_host(struct ufs_hba *hba) 10239 - { 10240 - scsi_host_put(hba->host); 10241 - } 10242 - EXPORT_SYMBOL_GPL(ufshcd_dealloc_host); 10243 - 10244 - /** 10245 10250 * ufshcd_set_dma_mask - Set dma mask based on the controller 10246 10251 * addressing capability 10247 10252 * @hba: per adapter instance ··· 10250 10275 } 10251 10276 10252 10277 /** 10278 + * ufshcd_devres_release - devres cleanup handler, invoked during release of 10279 + * hba->dev 10280 + * @host: pointer to SCSI host 10281 + */ 10282 + static void ufshcd_devres_release(void *host) 10283 + { 10284 + scsi_host_put(host); 10285 + } 10286 + 10287 + /** 10253 10288 * ufshcd_alloc_host - allocate Host Bus Adapter (HBA) 10254 10289 * @dev: pointer to device handle 10255 10290 * @hba_handle: driver private handle 10256 10291 * 10257 10292 * Return: 0 on success, non-zero value on failure. 10293 + * 10294 + * NOTE: There is no corresponding ufshcd_dealloc_host() because this function 10295 + * keeps track of its allocations using devres and deallocates everything on 10296 + * device removal automatically. 10258 10297 */ 10259 10298 int ufshcd_alloc_host(struct device *dev, struct ufs_hba **hba_handle) 10260 10299 { ··· 10290 10301 err = -ENOMEM; 10291 10302 goto out_error; 10292 10303 } 10304 + 10305 + err = devm_add_action_or_reset(dev, ufshcd_devres_release, 10306 + host); 10307 + if (err) 10308 + return dev_err_probe(dev, err, 10309 + "failed to add ufshcd dealloc action\n"); 10310 + 10293 10311 host->nr_maps = HCTX_TYPE_POLL + 1; 10294 10312 hba = shost_priv(host); 10295 10313 hba->host = host; ··· 10424 10428 hba->mmio_base = mmio_base; 10425 10429 hba->irq = irq; 10426 10430 hba->vps = &ufs_hba_vps; 10431 + 10432 + /* 10433 + * Initialize clk_gating.lock early since it is being used in 10434 + * ufshcd_setup_clocks() 10435 + */ 10436 + spin_lock_init(&hba->clk_gating.lock); 10427 10437 10428 10438 err = ufshcd_hba_init(hba); 10429 10439 if (err)
-2
drivers/ufs/host/ufshcd-pci.c
··· 562 562 pm_runtime_forbid(&pdev->dev); 563 563 pm_runtime_get_noresume(&pdev->dev); 564 564 ufshcd_remove(hba); 565 - ufshcd_dealloc_host(hba); 566 565 } 567 566 568 567 /** ··· 604 605 err = ufshcd_init(hba, mmio_base, pdev->irq); 605 606 if (err) { 606 607 dev_err(&pdev->dev, "Initialization failed\n"); 607 - ufshcd_dealloc_host(hba); 608 608 return err; 609 609 } 610 610
+9 -19
drivers/ufs/host/ufshcd-pltfrm.c
··· 465 465 struct device *dev = &pdev->dev; 466 466 467 467 mmio_base = devm_platform_ioremap_resource(pdev, 0); 468 - if (IS_ERR(mmio_base)) { 469 - err = PTR_ERR(mmio_base); 470 - goto out; 471 - } 468 + if (IS_ERR(mmio_base)) 469 + return PTR_ERR(mmio_base); 472 470 473 471 irq = platform_get_irq(pdev, 0); 474 - if (irq < 0) { 475 - err = irq; 476 - goto out; 477 - } 472 + if (irq < 0) 473 + return irq; 478 474 479 475 err = ufshcd_alloc_host(dev, &hba); 480 476 if (err) { 481 477 dev_err(dev, "Allocation failed\n"); 482 - goto out; 478 + return err; 483 479 } 484 480 485 481 hba->vops = vops; ··· 484 488 if (err) { 485 489 dev_err(dev, "%s: clock parse failed %d\n", 486 490 __func__, err); 487 - goto dealloc_host; 491 + return err; 488 492 } 489 493 err = ufshcd_parse_regulator_info(hba); 490 494 if (err) { 491 495 dev_err(dev, "%s: regulator init failed %d\n", 492 496 __func__, err); 493 - goto dealloc_host; 497 + return err; 494 498 } 495 499 496 500 ufshcd_init_lanes_per_dir(hba); ··· 498 502 err = ufshcd_parse_operating_points(hba); 499 503 if (err) { 500 504 dev_err(dev, "%s: OPP parse failed %d\n", __func__, err); 501 - goto dealloc_host; 505 + return err; 502 506 } 503 507 504 508 err = ufshcd_init(hba, mmio_base, irq); 505 509 if (err) { 506 510 dev_err_probe(dev, err, "Initialization failed with error %d\n", 507 511 err); 508 - goto dealloc_host; 512 + return err; 509 513 } 510 514 511 515 pm_runtime_set_active(dev); 512 516 pm_runtime_enable(dev); 513 517 514 518 return 0; 515 - 516 - dealloc_host: 517 - ufshcd_dealloc_host(hba); 518 - out: 519 - return err; 520 519 } 521 520 EXPORT_SYMBOL_GPL(ufshcd_pltfrm_init); 522 521 ··· 525 534 526 535 pm_runtime_get_sync(&pdev->dev); 527 536 ufshcd_remove(hba); 528 - ufshcd_dealloc_host(hba); 529 537 pm_runtime_disable(&pdev->dev); 530 538 pm_runtime_put_noidle(&pdev->dev); 531 539 }
+2 -2
include/ufs/ufs.h
··· 385 385 386 386 /* Possible values for dExtendedUFSFeaturesSupport */ 387 387 enum { 388 - UFS_DEV_LOW_TEMP_NOTIF = BIT(4), 389 - UFS_DEV_HIGH_TEMP_NOTIF = BIT(5), 388 + UFS_DEV_HIGH_TEMP_NOTIF = BIT(4), 389 + UFS_DEV_LOW_TEMP_NOTIF = BIT(5), 390 390 UFS_DEV_EXT_TEMP_NOTIF = BIT(6), 391 391 UFS_DEV_HPB_SUPPORT = BIT(7), 392 392 UFS_DEV_WRITE_BOOSTER_SUP = BIT(8),
-1
include/ufs/ufshcd.h
··· 1309 1309 void ufshcd_enable_irq(struct ufs_hba *hba); 1310 1310 void ufshcd_disable_irq(struct ufs_hba *hba); 1311 1311 int ufshcd_alloc_host(struct device *, struct ufs_hba **); 1312 - void ufshcd_dealloc_host(struct ufs_hba *); 1313 1312 int ufshcd_hba_enable(struct ufs_hba *hba); 1314 1313 int ufshcd_init(struct ufs_hba *, void __iomem *, unsigned int); 1315 1314 int ufshcd_link_recovery(struct ufs_hba *hba);