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

Merge branch '6.10/scsi-fixes' into 6.11/scsi-staging

Pull in my fixes branch to resolve an mpi3mr merge conflict reported
by sfr.

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

+273 -75
+2 -2
Documentation/cdrom/cdrom-standard.rst
··· 217 217 int (*media_changed)(struct cdrom_device_info *, int); 218 218 int (*tray_move)(struct cdrom_device_info *, int); 219 219 int (*lock_door)(struct cdrom_device_info *, int); 220 - int (*select_speed)(struct cdrom_device_info *, int); 220 + int (*select_speed)(struct cdrom_device_info *, unsigned long); 221 221 int (*get_last_session) (struct cdrom_device_info *, 222 222 struct cdrom_multisession *); 223 223 int (*get_mcn)(struct cdrom_device_info *, struct cdrom_mcn *); ··· 396 396 397 397 :: 398 398 399 - int select_speed(struct cdrom_device_info *cdi, int speed) 399 + int select_speed(struct cdrom_device_info *cdi, unsigned long speed) 400 400 401 401 Some CD-ROM drives are capable of changing their head-speed. There 402 402 are several reasons for changing the speed of a CD-ROM drive. Badly
+22 -9
drivers/scsi/device_handler/scsi_dh_alua.c
··· 414 414 } 415 415 } 416 416 417 - static enum scsi_disposition alua_check_sense(struct scsi_device *sdev, 418 - struct scsi_sense_hdr *sense_hdr) 417 + static void alua_handle_state_transition(struct scsi_device *sdev) 419 418 { 420 419 struct alua_dh_data *h = sdev->handler_data; 421 420 struct alua_port_group *pg; 422 421 422 + rcu_read_lock(); 423 + pg = rcu_dereference(h->pg); 424 + if (pg) 425 + pg->state = SCSI_ACCESS_STATE_TRANSITIONING; 426 + rcu_read_unlock(); 427 + alua_check(sdev, false); 428 + } 429 + 430 + static enum scsi_disposition alua_check_sense(struct scsi_device *sdev, 431 + struct scsi_sense_hdr *sense_hdr) 432 + { 423 433 switch (sense_hdr->sense_key) { 424 434 case NOT_READY: 425 435 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) { 426 436 /* 427 437 * LUN Not Accessible - ALUA state transition 428 438 */ 429 - rcu_read_lock(); 430 - pg = rcu_dereference(h->pg); 431 - if (pg) 432 - pg->state = SCSI_ACCESS_STATE_TRANSITIONING; 433 - rcu_read_unlock(); 434 - alua_check(sdev, false); 439 + alua_handle_state_transition(sdev); 435 440 return NEEDS_RETRY; 436 441 } 437 442 break; 438 443 case UNIT_ATTENTION: 444 + if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) { 445 + /* 446 + * LUN Not Accessible - ALUA state transition 447 + */ 448 + alua_handle_state_transition(sdev); 449 + return NEEDS_RETRY; 450 + } 439 451 if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) { 440 452 /* 441 453 * Power On, Reset, or Bus Device Reset. ··· 514 502 515 503 retval = scsi_test_unit_ready(sdev, ALUA_FAILOVER_TIMEOUT * HZ, 516 504 ALUA_FAILOVER_RETRIES, &sense_hdr); 517 - if (sense_hdr.sense_key == NOT_READY && 505 + if ((sense_hdr.sense_key == NOT_READY || 506 + sense_hdr.sense_key == UNIT_ATTENTION) && 518 507 sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a) 519 508 return SCSI_DH_RETRY; 520 509 else if (retval)
+14
drivers/scsi/libsas/sas_internal.h
··· 145 145 func, dev->parent ? "exp-attached" : 146 146 "direct-attached", 147 147 SAS_ADDR(dev->sas_addr), err); 148 + 149 + /* 150 + * If the device probe failed, the expander phy attached address 151 + * needs to be reset so that the phy will not be treated as flutter 152 + * in the next revalidation 153 + */ 154 + if (dev->parent && !dev_is_expander(dev->dev_type)) { 155 + struct sas_phy *phy = dev->phy; 156 + struct domain_device *parent = dev->parent; 157 + struct ex_phy *ex_phy = &parent->ex_dev.ex_phy[phy->number]; 158 + 159 + memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE); 160 + } 161 + 148 162 sas_unregister_dev(dev->port, dev); 149 163 } 150 164
+62
drivers/scsi/mpi3mr/mpi3mr_app.c
··· 3247 3247 } 3248 3248 static DEVICE_ATTR_RO(persistent_id); 3249 3249 3250 + /** 3251 + * sas_ncq_prio_supported_show - Indicate if device supports NCQ priority 3252 + * @dev: pointer to embedded device 3253 + * @attr: sas_ncq_prio_supported attribute descriptor 3254 + * @buf: the buffer returned 3255 + * 3256 + * A sysfs 'read-only' sdev attribute, only works with SATA devices 3257 + */ 3258 + static ssize_t 3259 + sas_ncq_prio_supported_show(struct device *dev, 3260 + struct device_attribute *attr, char *buf) 3261 + { 3262 + struct scsi_device *sdev = to_scsi_device(dev); 3263 + 3264 + return sysfs_emit(buf, "%d\n", sas_ata_ncq_prio_supported(sdev)); 3265 + } 3266 + static DEVICE_ATTR_RO(sas_ncq_prio_supported); 3267 + 3268 + /** 3269 + * sas_ncq_prio_enable_show - send prioritized io commands to device 3270 + * @dev: pointer to embedded device 3271 + * @attr: sas_ncq_prio_enable attribute descriptor 3272 + * @buf: the buffer returned 3273 + * 3274 + * A sysfs 'read/write' sdev attribute, only works with SATA devices 3275 + */ 3276 + static ssize_t 3277 + sas_ncq_prio_enable_show(struct device *dev, 3278 + struct device_attribute *attr, char *buf) 3279 + { 3280 + struct scsi_device *sdev = to_scsi_device(dev); 3281 + struct mpi3mr_sdev_priv_data *sdev_priv_data = sdev->hostdata; 3282 + 3283 + if (!sdev_priv_data) 3284 + return 0; 3285 + 3286 + return sysfs_emit(buf, "%d\n", sdev_priv_data->ncq_prio_enable); 3287 + } 3288 + 3289 + static ssize_t 3290 + sas_ncq_prio_enable_store(struct device *dev, 3291 + struct device_attribute *attr, 3292 + const char *buf, size_t count) 3293 + { 3294 + struct scsi_device *sdev = to_scsi_device(dev); 3295 + struct mpi3mr_sdev_priv_data *sdev_priv_data = sdev->hostdata; 3296 + bool ncq_prio_enable = 0; 3297 + 3298 + if (kstrtobool(buf, &ncq_prio_enable)) 3299 + return -EINVAL; 3300 + 3301 + if (!sas_ata_ncq_prio_supported(sdev)) 3302 + return -EINVAL; 3303 + 3304 + sdev_priv_data->ncq_prio_enable = ncq_prio_enable; 3305 + 3306 + return strlen(buf); 3307 + } 3308 + static DEVICE_ATTR_RW(sas_ncq_prio_enable); 3309 + 3250 3310 static struct attribute *mpi3mr_dev_attrs[] = { 3251 3311 &dev_attr_sas_address.attr, 3252 3312 &dev_attr_device_handle.attr, 3253 3313 &dev_attr_persistent_id.attr, 3314 + &dev_attr_sas_ncq_prio_supported.attr, 3315 + &dev_attr_sas_ncq_prio_enable.attr, 3254 3316 NULL, 3255 3317 }; 3256 3318
+1 -1
drivers/scsi/mpi3mr/mpi3mr_transport.c
··· 1378 1378 continue; 1379 1379 1380 1380 if (i >= sizeof(mr_sas_port->phy_mask) * 8) { 1381 - ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n", 1381 + ioc_warn(mrioc, "skipping port %u, max allowed value is %zu\n", 1382 1382 i, sizeof(mr_sas_port->phy_mask) * 8); 1383 1383 goto out_fail; 1384 1384 }
+19
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 8512 8512 ioc->pd_handles_sz = (ioc->facts.MaxDevHandle / 8); 8513 8513 if (ioc->facts.MaxDevHandle % 8) 8514 8514 ioc->pd_handles_sz++; 8515 + /* 8516 + * pd_handles_sz should have, at least, the minimal room for 8517 + * set_bit()/test_bit(), otherwise out-of-memory touch may occur. 8518 + */ 8519 + ioc->pd_handles_sz = ALIGN(ioc->pd_handles_sz, sizeof(unsigned long)); 8520 + 8515 8521 ioc->pd_handles = kzalloc(ioc->pd_handles_sz, 8516 8522 GFP_KERNEL); 8517 8523 if (!ioc->pd_handles) { ··· 8535 8529 ioc->pend_os_device_add_sz = (ioc->facts.MaxDevHandle / 8); 8536 8530 if (ioc->facts.MaxDevHandle % 8) 8537 8531 ioc->pend_os_device_add_sz++; 8532 + 8533 + /* 8534 + * pend_os_device_add_sz should have, at least, the minimal room for 8535 + * set_bit()/test_bit(), otherwise out-of-memory may occur. 8536 + */ 8537 + ioc->pend_os_device_add_sz = ALIGN(ioc->pend_os_device_add_sz, 8538 + sizeof(unsigned long)); 8538 8539 ioc->pend_os_device_add = kzalloc(ioc->pend_os_device_add_sz, 8539 8540 GFP_KERNEL); 8540 8541 if (!ioc->pend_os_device_add) { ··· 8833 8820 if (ioc->facts.MaxDevHandle % 8) 8834 8821 pd_handles_sz++; 8835 8822 8823 + /* 8824 + * pd_handles should have, at least, the minimal room for 8825 + * set_bit()/test_bit(), otherwise out-of-memory touch may 8826 + * occur. 8827 + */ 8828 + pd_handles_sz = ALIGN(pd_handles_sz, sizeof(unsigned long)); 8836 8829 pd_handles = krealloc(ioc->pd_handles, pd_handles_sz, 8837 8830 GFP_KERNEL); 8838 8831 if (!pd_handles) {
-3
drivers/scsi/mpt3sas/mpt3sas_base.h
··· 2048 2048 mpt3sas_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, 2049 2049 struct _raid_device *raid_device, Mpi25SCSIIORequest_t *mpi_request); 2050 2050 2051 - /* NCQ Prio Handling Check */ 2052 - bool scsih_ncq_prio_supp(struct scsi_device *sdev); 2053 - 2054 2051 void mpt3sas_setup_debugfs(struct MPT3SAS_ADAPTER *ioc); 2055 2052 void mpt3sas_destroy_debugfs(struct MPT3SAS_ADAPTER *ioc); 2056 2053 void mpt3sas_init_debugfs(void);
+2 -2
drivers/scsi/mpt3sas/mpt3sas_ctl.c
··· 4088 4088 { 4089 4089 struct scsi_device *sdev = to_scsi_device(dev); 4090 4090 4091 - return sysfs_emit(buf, "%d\n", scsih_ncq_prio_supp(sdev)); 4091 + return sysfs_emit(buf, "%d\n", sas_ata_ncq_prio_supported(sdev)); 4092 4092 } 4093 4093 static DEVICE_ATTR_RO(sas_ncq_prio_supported); 4094 4094 ··· 4123 4123 if (kstrtobool(buf, &ncq_prio_enable)) 4124 4124 return -EINVAL; 4125 4125 4126 - if (!scsih_ncq_prio_supp(sdev)) 4126 + if (!sas_ata_ncq_prio_supported(sdev)) 4127 4127 return -EINVAL; 4128 4128 4129 4129 sas_device_priv_data->ncq_prio_enable = ncq_prio_enable;
+2 -25
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 302 302 303 303 /** 304 304 * _scsih_set_debug_level - global setting of ioc->logging_level. 305 - * @val: ? 306 - * @kp: ? 305 + * @val: value of the parameter to be set 306 + * @kp: pointer to kernel_param structure 307 307 * 308 308 * Note: The logging levels are defined in mpt3sas_debug.h. 309 309 */ ··· 12571 12571 return PCI_ERS_RESULT_RECOVERED; 12572 12572 } 12573 12573 12574 - /** 12575 - * scsih_ncq_prio_supp - Check for NCQ command priority support 12576 - * @sdev: scsi device struct 12577 - * 12578 - * This is called when a user indicates they would like to enable 12579 - * ncq command priorities. This works only on SATA devices. 12580 - */ 12581 - bool scsih_ncq_prio_supp(struct scsi_device *sdev) 12582 - { 12583 - struct scsi_vpd *vpd; 12584 - bool ncq_prio_supp = false; 12585 - 12586 - rcu_read_lock(); 12587 - vpd = rcu_dereference(sdev->vpd_pg89); 12588 - if (!vpd || vpd->len < 214) 12589 - goto out; 12590 - 12591 - ncq_prio_supp = (vpd->data[213] >> 4) & 1; 12592 - out: 12593 - rcu_read_unlock(); 12594 - 12595 - return ncq_prio_supp; 12596 - } 12597 12574 /* 12598 12575 * The pci device ids are defined in mpi/mpi2_cnfg.h. 12599 12576 */
+1
drivers/scsi/qedf/qedf.h
··· 363 363 #define QEDF_IN_RECOVERY 5 364 364 #define QEDF_DBG_STOP_IO 6 365 365 #define QEDF_PROBING 8 366 + #define QEDF_STAG_IN_PROGRESS 9 366 367 unsigned long flags; /* Miscellaneous state flags */ 367 368 int fipvlan_retries; 368 369 u8 num_queues;
+44 -3
drivers/scsi/qedf/qedf_main.c
··· 318 318 */ 319 319 if (resp == fc_lport_flogi_resp) { 320 320 qedf->flogi_cnt++; 321 + qedf->flogi_pending++; 322 + 323 + if (test_bit(QEDF_UNLOADING, &qedf->flags)) { 324 + QEDF_ERR(&qedf->dbg_ctx, "Driver unloading\n"); 325 + qedf->flogi_pending = 0; 326 + } 327 + 321 328 if (qedf->flogi_pending >= QEDF_FLOGI_RETRY_CNT) { 322 329 schedule_delayed_work(&qedf->stag_work, 2); 323 330 return NULL; 324 331 } 325 - qedf->flogi_pending++; 332 + 326 333 return fc_elsct_send(lport, did, fp, op, qedf_flogi_resp, 327 334 arg, timeout); 328 335 } ··· 919 912 struct qedf_ctx *qedf; 920 913 struct qed_link_output if_link; 921 914 915 + qedf = lport_priv(lport); 916 + 922 917 if (lport->vport) { 918 + clear_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags); 923 919 printk_ratelimited("Cannot issue host reset on NPIV port.\n"); 924 920 return; 925 921 } 926 - 927 - qedf = lport_priv(lport); 928 922 929 923 qedf->flogi_pending = 0; 930 924 /* For host reset, essentially do a soft link up/down */ ··· 946 938 if (!if_link.link_up) { 947 939 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, 948 940 "Physical link is not up.\n"); 941 + clear_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags); 949 942 return; 950 943 } 951 944 /* Flush and wait to make sure link down is processed */ ··· 959 950 "Queue link up work.\n"); 960 951 queue_delayed_work(qedf->link_update_wq, &qedf->link_update, 961 952 0); 953 + clear_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags); 962 954 } 963 955 964 956 /* Reset the host by gracefully logging out and then logging back in */ ··· 3473 3463 } 3474 3464 3475 3465 /* Start the Slowpath-process */ 3466 + memset(&slowpath_params, 0, sizeof(struct qed_slowpath_params)); 3476 3467 slowpath_params.int_mode = QED_INT_MODE_MSIX; 3477 3468 slowpath_params.drv_major = QEDF_DRIVER_MAJOR_VER; 3478 3469 slowpath_params.drv_minor = QEDF_DRIVER_MINOR_VER; ··· 3732 3721 { 3733 3722 struct qedf_ctx *qedf; 3734 3723 int rc; 3724 + int cnt = 0; 3735 3725 3736 3726 if (!pdev) { 3737 3727 QEDF_ERR(NULL, "pdev is NULL.\n"); ··· 3748 3736 if (test_bit(QEDF_UNLOADING, &qedf->flags)) { 3749 3737 QEDF_ERR(&qedf->dbg_ctx, "Already removing PCI function.\n"); 3750 3738 return; 3739 + } 3740 + 3741 + stag_in_prog: 3742 + if (test_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags)) { 3743 + QEDF_ERR(&qedf->dbg_ctx, "Stag in progress, cnt=%d.\n", cnt); 3744 + cnt++; 3745 + 3746 + if (cnt < 5) { 3747 + msleep(500); 3748 + goto stag_in_prog; 3749 + } 3751 3750 } 3752 3751 3753 3752 if (mode != QEDF_MODE_RECOVERY) ··· 4019 3996 { 4020 3997 struct qedf_ctx *qedf = 4021 3998 container_of(work, struct qedf_ctx, stag_work.work); 3999 + 4000 + if (!qedf) { 4001 + QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL"); 4002 + return; 4003 + } 4004 + 4005 + if (test_bit(QEDF_IN_RECOVERY, &qedf->flags)) { 4006 + QEDF_ERR(&qedf->dbg_ctx, 4007 + "Already is in recovery, hence not calling software context reset.\n"); 4008 + return; 4009 + } 4010 + 4011 + if (test_bit(QEDF_UNLOADING, &qedf->flags)) { 4012 + QEDF_ERR(&qedf->dbg_ctx, "Driver unloading\n"); 4013 + return; 4014 + } 4015 + 4016 + set_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags); 4022 4017 4023 4018 printk_ratelimited("[%s]:[%s:%d]:%d: Performing software context reset.", 4024 4019 dev_name(&qedf->pdev->dev), __func__, __LINE__,
+14
drivers/scsi/scsi.c
··· 350 350 if (result < SCSI_VPD_HEADER_SIZE) 351 351 return 0; 352 352 353 + if (result > sizeof(vpd)) { 354 + dev_warn_once(&sdev->sdev_gendev, 355 + "%s: long VPD page 0 length: %d bytes\n", 356 + __func__, result); 357 + result = sizeof(vpd); 358 + } 359 + 353 360 result -= SCSI_VPD_HEADER_SIZE; 354 361 if (!memchr(&vpd[SCSI_VPD_HEADER_SIZE], page, result)) 355 362 return 0; ··· 673 666 sdev->use_10_for_rw = 0; 674 667 675 668 sdev->cdl_supported = 1; 669 + 670 + /* 671 + * If the device supports CDL, make sure that the current drive 672 + * feature status is consistent with the user controlled 673 + * cdl_enable state. 674 + */ 675 + scsi_cdl_enable(sdev, sdev->cdl_enable); 676 676 } else { 677 677 sdev->cdl_supported = 0; 678 678 }
+5 -1
drivers/scsi/scsi_debug.c
··· 926 926 static const int condition_met_result = SAM_STAT_CONDITION_MET; 927 927 928 928 static struct dentry *sdebug_debugfs_root; 929 + static ASYNC_DOMAIN_EXCLUSIVE(sdebug_async_domain); 929 930 930 931 static void sdebug_err_free(struct rcu_head *head) 931 932 { ··· 1149 1148 if (!targetip) 1150 1149 return -ENOMEM; 1151 1150 1151 + async_synchronize_full_domain(&sdebug_async_domain); 1152 + 1152 1153 targetip->debugfs_entry = debugfs_create_dir(dev_name(&starget->dev), 1153 1154 sdebug_debugfs_root); 1154 1155 ··· 1177 1174 targetip = (struct sdebug_target_info *)starget->hostdata; 1178 1175 if (targetip) { 1179 1176 starget->hostdata = NULL; 1180 - async_schedule(sdebug_tartget_cleanup_async, targetip); 1177 + async_schedule_domain(sdebug_tartget_cleanup_async, targetip, 1178 + &sdebug_async_domain); 1181 1179 } 1182 1180 } 1183 1181
+23
drivers/scsi/scsi_transport_sas.c
··· 416 416 } 417 417 EXPORT_SYMBOL_GPL(sas_is_tlr_enabled); 418 418 419 + /** 420 + * sas_ata_ncq_prio_supported - Check for ATA NCQ command priority support 421 + * @sdev: SCSI device 422 + * 423 + * Check if an ATA device supports NCQ priority using VPD page 89h (ATA 424 + * Information). Since this VPD page is implemented only for ATA devices, 425 + * this function always returns false for SCSI devices. 426 + */ 427 + bool sas_ata_ncq_prio_supported(struct scsi_device *sdev) 428 + { 429 + struct scsi_vpd *vpd; 430 + bool ncq_prio_supported = false; 431 + 432 + rcu_read_lock(); 433 + vpd = rcu_dereference(sdev->vpd_pg89); 434 + if (vpd && vpd->len >= 214) 435 + ncq_prio_supported = (vpd->data[213] >> 4) & 1; 436 + rcu_read_unlock(); 437 + 438 + return ncq_prio_supported; 439 + } 440 + EXPORT_SYMBOL_GPL(sas_ata_ncq_prio_supported); 441 + 419 442 /* 420 443 * SAS Phy attributes 421 444 */
+18 -8
drivers/scsi/sd.c
··· 63 63 #include <scsi/scsi_cmnd.h> 64 64 #include <scsi/scsi_dbg.h> 65 65 #include <scsi/scsi_device.h> 66 + #include <scsi/scsi_devinfo.h> 66 67 #include <scsi/scsi_driver.h> 67 68 #include <scsi/scsi_eh.h> 68 69 #include <scsi/scsi_host.h> ··· 3119 3118 struct scsi_mode_data data; 3120 3119 int res; 3121 3120 3121 + if (sdp->sdev_bflags & BLIST_SKIP_IO_HINTS) 3122 + return; 3123 + 3122 3124 res = scsi_mode_sense(sdp, /*dbd=*/0x8, /*modepage=*/0x0a, 3123 3125 /*subpage=*/0x05, buffer, SD_BUF_SIZE, SD_TIMEOUT, 3124 3126 sdkp->max_retries, &data, &sshdr); ··· 3569 3565 3570 3566 static void sd_read_block_zero(struct scsi_disk *sdkp) 3571 3567 { 3572 - unsigned int buf_len = sdkp->device->sector_size; 3573 - char *buffer, cmd[10] = { }; 3568 + struct scsi_device *sdev = sdkp->device; 3569 + unsigned int buf_len = sdev->sector_size; 3570 + u8 *buffer, cmd[16] = { }; 3574 3571 3575 3572 buffer = kmalloc(buf_len, GFP_KERNEL); 3576 3573 if (!buffer) 3577 3574 return; 3578 3575 3579 - cmd[0] = READ_10; 3580 - put_unaligned_be32(0, &cmd[2]); /* Logical block address 0 */ 3581 - put_unaligned_be16(1, &cmd[7]); /* Transfer 1 logical block */ 3576 + if (sdev->use_16_for_rw) { 3577 + cmd[0] = READ_16; 3578 + put_unaligned_be64(0, &cmd[2]); /* Logical block address 0 */ 3579 + put_unaligned_be32(1, &cmd[10]);/* Transfer 1 logical block */ 3580 + } else { 3581 + cmd[0] = READ_10; 3582 + put_unaligned_be32(0, &cmd[2]); /* Logical block address 0 */ 3583 + put_unaligned_be16(1, &cmd[7]); /* Transfer 1 logical block */ 3584 + } 3582 3585 3583 3586 scsi_execute_cmd(sdkp->device, cmd, REQ_OP_DRV_IN, buffer, buf_len, 3584 3587 SD_TIMEOUT, sdkp->max_retries, NULL); ··· 4117 4106 { 4118 4107 struct scsi_disk *sdkp = dev_get_drvdata(dev); 4119 4108 4120 - sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 4121 - 4122 4109 if (opal_unlock_from_suspend(sdkp->opal_dev)) { 4123 4110 sd_printk(KERN_NOTICE, sdkp, "OPAL unlock failed\n"); 4124 4111 return -EIO; ··· 4133 4124 if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */ 4134 4125 return 0; 4135 4126 4127 + sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 4128 + 4136 4129 if (!sd_do_start_stop(sdkp->device, runtime)) { 4137 4130 sdkp->suspended = false; 4138 4131 return 0; 4139 4132 } 4140 4133 4141 - sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 4142 4134 ret = sd_start_stop_device(sdkp, 1); 4143 4135 if (!ret) { 4144 4136 sd_resume(dev);
+1 -1
drivers/scsi/sr.h
··· 65 65 int sr_get_last_session(struct cdrom_device_info *, struct cdrom_multisession *); 66 66 int sr_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *); 67 67 int sr_reset(struct cdrom_device_info *); 68 - int sr_select_speed(struct cdrom_device_info *cdi, int speed); 68 + int sr_select_speed(struct cdrom_device_info *cdi, unsigned long speed); 69 69 int sr_audio_ioctl(struct cdrom_device_info *, unsigned int, void *); 70 70 71 71 int sr_is_xa(Scsi_CD *);
+4 -1
drivers/scsi/sr_ioctl.c
··· 425 425 return 0; 426 426 } 427 427 428 - int sr_select_speed(struct cdrom_device_info *cdi, int speed) 428 + int sr_select_speed(struct cdrom_device_info *cdi, unsigned long speed) 429 429 { 430 430 Scsi_CD *cd = cdi->handle; 431 431 struct packet_command cgc; 432 + 433 + /* avoid exceeding the max speed or overflowing integer bounds */ 434 + speed = clamp(0, speed, 0xffff / 177); 432 435 433 436 if (speed == 0) 434 437 speed = 0xffff; /* set to max */
+14 -14
drivers/ufs/core/ufs-mcq.c
··· 105 105 * @hba: per adapter instance 106 106 * @req: pointer to the request to be issued 107 107 * 108 - * Return: the hardware queue instance on which the request would 109 - * be queued. 108 + * Return: the hardware queue instance on which the request will be or has 109 + * been queued. %NULL if the request has already been freed. 110 110 */ 111 111 struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba, 112 112 struct request *req) 113 113 { 114 - u32 utag = blk_mq_unique_tag(req); 115 - u32 hwq = blk_mq_unique_tag_to_hwq(utag); 114 + struct blk_mq_hw_ctx *hctx = READ_ONCE(req->mq_hctx); 116 115 117 - return &hba->uhq[hwq]; 116 + return hctx ? &hba->uhq[hctx->queue_num] : NULL; 118 117 } 119 118 120 119 /** ··· 530 531 if (!cmd) 531 532 return -EINVAL; 532 533 hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd)); 534 + if (!hwq) 535 + return 0; 533 536 } else { 534 537 hwq = hba->dev_cmd_queue; 535 538 } ··· 651 650 struct ufshcd_lrb *lrbp = &hba->lrb[tag]; 652 651 struct ufs_hw_queue *hwq; 653 652 unsigned long flags; 654 - int err = FAILED; 653 + int err; 655 654 656 655 if (!ufshcd_cmd_inflight(lrbp->cmd)) { 657 656 dev_err(hba->dev, 658 657 "%s: skip abort. cmd at tag %d already completed.\n", 659 658 __func__, tag); 660 - goto out; 659 + return FAILED; 661 660 } 662 661 663 662 /* Skip task abort in case previous aborts failed and report failure */ 664 663 if (lrbp->req_abort_skip) { 665 664 dev_err(hba->dev, "%s: skip abort. tag %d failed earlier\n", 666 665 __func__, tag); 667 - goto out; 666 + return FAILED; 668 667 } 669 668 670 669 hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd)); ··· 676 675 */ 677 676 dev_err(hba->dev, "%s: cmd found in sq. hwq=%d, tag=%d\n", 678 677 __func__, hwq->id, tag); 679 - goto out; 678 + return FAILED; 680 679 } 681 680 682 681 /* ··· 684 683 * in the completion queue either. Query the device to see if 685 684 * the command is being processed in the device. 686 685 */ 687 - if (ufshcd_try_to_abort_task(hba, tag)) { 686 + err = ufshcd_try_to_abort_task(hba, tag); 687 + if (err) { 688 688 dev_err(hba->dev, "%s: device abort failed %d\n", __func__, err); 689 689 lrbp->req_abort_skip = true; 690 - goto out; 690 + return FAILED; 691 691 } 692 692 693 - err = SUCCESS; 694 693 spin_lock_irqsave(&hwq->cq_lock, flags); 695 694 if (ufshcd_cmd_inflight(lrbp->cmd)) 696 695 ufshcd_release_scsi_cmd(hba, lrbp); 697 696 spin_unlock_irqrestore(&hwq->cq_lock, flags); 698 697 699 - out: 700 - return err; 698 + return SUCCESS; 701 699 }
+6 -3
drivers/ufs/core/ufshcd.c
··· 1369 1369 * make sure that there are no outstanding requests when 1370 1370 * clock scaling is in progress 1371 1371 */ 1372 - ufshcd_scsi_block_requests(hba); 1372 + blk_mq_quiesce_tagset(&hba->host->tag_set); 1373 1373 mutex_lock(&hba->wb_mutex); 1374 1374 down_write(&hba->clk_scaling_lock); 1375 1375 ··· 1378 1378 ret = -EBUSY; 1379 1379 up_write(&hba->clk_scaling_lock); 1380 1380 mutex_unlock(&hba->wb_mutex); 1381 - ufshcd_scsi_unblock_requests(hba); 1381 + blk_mq_unquiesce_tagset(&hba->host->tag_set); 1382 1382 goto out; 1383 1383 } 1384 1384 ··· 1399 1399 1400 1400 mutex_unlock(&hba->wb_mutex); 1401 1401 1402 - ufshcd_scsi_unblock_requests(hba); 1402 + blk_mq_unquiesce_tagset(&hba->host->tag_set); 1403 1403 ufshcd_release(hba); 1404 1404 } 1405 1405 ··· 6462 6462 /* Release cmd in MCQ mode if abort succeeds */ 6463 6463 if (is_mcq_enabled(hba) && (*ret == 0)) { 6464 6464 hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(lrbp->cmd)); 6465 + if (!hwq) 6466 + return 0; 6465 6467 spin_lock_irqsave(&hwq->cq_lock, flags); 6466 6468 if (ufshcd_cmd_inflight(lrbp->cmd)) 6467 6469 ufshcd_release_scsi_cmd(hba, lrbp); ··· 8831 8829 (hba->quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH)) { 8832 8830 /* Reset the device and controller before doing reinit */ 8833 8831 ufshcd_device_reset(hba); 8832 + ufs_put_device_desc(hba); 8834 8833 ufshcd_hba_stop(hba); 8835 8834 ufshcd_vops_reinit_notify(hba); 8836 8835 ret = ufshcd_hba_enable(hba);
+6
drivers/usb/storage/scsiglue.c
··· 79 79 if (us->protocol == USB_PR_BULK && us->max_lun > 0) 80 80 sdev->sdev_bflags |= BLIST_FORCELUN; 81 81 82 + /* 83 + * Some USB storage devices reset if the IO advice hints grouping mode 84 + * page is queried. Hence skip that mode page. 85 + */ 86 + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS; 87 + 82 88 return 0; 83 89 } 84 90
+7
drivers/usb/storage/uas.c
··· 21 21 #include <scsi/scsi.h> 22 22 #include <scsi/scsi_eh.h> 23 23 #include <scsi/scsi_dbg.h> 24 + #include <scsi/scsi_devinfo.h> 24 25 #include <scsi/scsi_cmnd.h> 25 26 #include <scsi/scsi_device.h> 26 27 #include <scsi/scsi_host.h> ··· 820 819 { 821 820 struct uas_dev_info *devinfo = 822 821 (struct uas_dev_info *)sdev->host->hostdata; 822 + 823 + /* 824 + * Some USB storage devices reset if the IO advice hints grouping mode 825 + * page is queried. Hence skip that mode page. 826 + */ 827 + sdev->sdev_bflags |= BLIST_SKIP_IO_HINTS; 823 828 824 829 sdev->hostdata = devinfo; 825 830 return 0;
+1 -1
include/linux/cdrom.h
··· 77 77 unsigned int clearing, int slot); 78 78 int (*tray_move) (struct cdrom_device_info *, int); 79 79 int (*lock_door) (struct cdrom_device_info *, int); 80 - int (*select_speed) (struct cdrom_device_info *, int); 80 + int (*select_speed) (struct cdrom_device_info *, unsigned long); 81 81 int (*get_last_session) (struct cdrom_device_info *, 82 82 struct cdrom_multisession *); 83 83 int (*get_mcn) (struct cdrom_device_info *,
+3 -1
include/scsi/scsi_devinfo.h
··· 69 69 #define BLIST_RETRY_ITF ((__force blist_flags_t)(1ULL << 32)) 70 70 /* Always retry ABORTED_COMMAND with ASC 0xc1 */ 71 71 #define BLIST_RETRY_ASC_C1 ((__force blist_flags_t)(1ULL << 33)) 72 + /* Do not query the IO Advice Hints Grouping mode page */ 73 + #define BLIST_SKIP_IO_HINTS ((__force blist_flags_t)(1ULL << 34)) 72 74 73 - #define __BLIST_LAST_USED BLIST_RETRY_ASC_C1 75 + #define __BLIST_LAST_USED BLIST_SKIP_IO_HINTS 74 76 75 77 #define __BLIST_HIGH_UNUSED (~(__BLIST_LAST_USED | \ 76 78 (__force blist_flags_t) \
+2
include/scsi/scsi_transport_sas.h
··· 200 200 void sas_disable_tlr(struct scsi_device *); 201 201 void sas_enable_tlr(struct scsi_device *); 202 202 203 + bool sas_ata_ncq_prio_supported(struct scsi_device *sdev); 204 + 203 205 extern struct sas_rphy *sas_end_device_alloc(struct sas_port *); 204 206 extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type); 205 207 void sas_rphy_free(struct sas_rphy *);