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:
"Six fixes: the four driver ones are pretty trivial.

The larger two core changes are to try to fix various USB attached
devices which have somewhat eccentric ways of handling the VPD and
other mode pages which necessitate multiple revalidates (that were
removed in the interests of efficiency) and updating the heuristic for
supported VPD pages"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: jazz_esp: Only build if SCSI core is builtin
scsi: smartpqi: Fix disable_managed_interrupts
scsi: ufs: Uninitialized variable in ufshcd_devfreq_target()
scsi: target: pscsi: Fix bio_put() for error case
scsi: core: Consult supported VPD page list prior to fetching page
scsi: sd: usb_storage: uas: Access media prior to querying device properties

+72 -13
+1 -1
drivers/scsi/Kconfig
··· 1270 1270 1271 1271 config JAZZ_ESP 1272 1272 bool "MIPS JAZZ FAS216 SCSI support" 1273 - depends on MACH_JAZZ && SCSI 1273 + depends on MACH_JAZZ && SCSI=y 1274 1274 select SCSI_SPI_ATTRS 1275 1275 help 1276 1276 This is the driver for the onboard SCSI host adapter of MIPS Magnum
+20 -2
drivers/scsi/scsi.c
··· 328 328 return result + 4; 329 329 } 330 330 331 + enum scsi_vpd_parameters { 332 + SCSI_VPD_HEADER_SIZE = 4, 333 + SCSI_VPD_LIST_SIZE = 36, 334 + }; 335 + 331 336 static int scsi_get_vpd_size(struct scsi_device *sdev, u8 page) 332 337 { 333 - unsigned char vpd_header[SCSI_VPD_HEADER_SIZE] __aligned(4); 338 + unsigned char vpd[SCSI_VPD_LIST_SIZE] __aligned(4); 334 339 int result; 335 340 336 341 if (sdev->no_vpd_size) 337 342 return SCSI_DEFAULT_VPD_LEN; 338 343 339 344 /* 345 + * Fetch the supported pages VPD and validate that the requested page 346 + * number is present. 347 + */ 348 + if (page != 0) { 349 + result = scsi_vpd_inquiry(sdev, vpd, 0, sizeof(vpd)); 350 + if (result < SCSI_VPD_HEADER_SIZE) 351 + return 0; 352 + 353 + result -= SCSI_VPD_HEADER_SIZE; 354 + if (!memchr(&vpd[SCSI_VPD_HEADER_SIZE], page, result)) 355 + return 0; 356 + } 357 + /* 340 358 * Fetch the VPD page header to find out how big the page 341 359 * is. This is done to prevent problems on legacy devices 342 360 * which can not handle allocation lengths as large as 343 361 * potentially requested by the caller. 344 362 */ 345 - result = scsi_vpd_inquiry(sdev, vpd_header, page, sizeof(vpd_header)); 363 + result = scsi_vpd_inquiry(sdev, vpd, page, SCSI_VPD_HEADER_SIZE); 346 364 if (result < 0) 347 365 return 0; 348 366
+25 -1
drivers/scsi/sd.c
··· 3407 3407 return true; 3408 3408 } 3409 3409 3410 + static void sd_read_block_zero(struct scsi_disk *sdkp) 3411 + { 3412 + unsigned int buf_len = sdkp->device->sector_size; 3413 + char *buffer, cmd[10] = { }; 3414 + 3415 + buffer = kmalloc(buf_len, GFP_KERNEL); 3416 + if (!buffer) 3417 + return; 3418 + 3419 + cmd[0] = READ_10; 3420 + put_unaligned_be32(0, &cmd[2]); /* Logical block address 0 */ 3421 + put_unaligned_be16(1, &cmd[7]); /* Transfer 1 logical block */ 3422 + 3423 + scsi_execute_cmd(sdkp->device, cmd, REQ_OP_DRV_IN, buffer, buf_len, 3424 + SD_TIMEOUT, sdkp->max_retries, NULL); 3425 + kfree(buffer); 3426 + } 3427 + 3410 3428 /** 3411 3429 * sd_revalidate_disk - called the first time a new disk is seen, 3412 3430 * performs disk spin up, read_capacity, etc. ··· 3464 3446 */ 3465 3447 if (sdkp->media_present) { 3466 3448 sd_read_capacity(sdkp, buffer); 3467 - 3449 + /* 3450 + * Some USB/UAS devices return generic values for mode pages 3451 + * until the media has been accessed. Trigger a READ operation 3452 + * to force the device to populate mode pages. 3453 + */ 3454 + if (sdp->read_before_ms) 3455 + sd_read_block_zero(sdkp); 3468 3456 /* 3469 3457 * set the default to rotational. All non-rotational devices 3470 3458 * support the block characteristics VPD page, which will
+4 -1
drivers/scsi/smartpqi/smartpqi_init.c
··· 6533 6533 { 6534 6534 struct pqi_ctrl_info *ctrl_info = shost_to_hba(shost); 6535 6535 6536 - blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT], 6536 + if (!ctrl_info->disable_managed_interrupts) 6537 + return blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT], 6537 6538 ctrl_info->pci_dev, 0); 6539 + else 6540 + return blk_mq_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT]); 6538 6541 } 6539 6542 6540 6543 static inline bool pqi_is_tape_changer_device(struct pqi_scsi_dev *device)
+6 -3
drivers/target/target_core_pscsi.c
··· 907 907 908 908 return 0; 909 909 fail: 910 - if (bio) 911 - bio_put(bio); 910 + if (bio) { 911 + bio_uninit(bio); 912 + kfree(bio); 913 + } 912 914 while (req->bio) { 913 915 bio = req->bio; 914 916 req->bio = bio->bi_next; 915 - bio_put(bio); 917 + bio_uninit(bio); 918 + kfree(bio); 916 919 } 917 920 req->biotail = NULL; 918 921 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
+1 -1
drivers/ufs/core/ufshcd.c
··· 1469 1469 int ret = 0; 1470 1470 struct ufs_hba *hba = dev_get_drvdata(dev); 1471 1471 ktime_t start; 1472 - bool scale_up, sched_clk_scaling_suspend_work = false; 1472 + bool scale_up = false, sched_clk_scaling_suspend_work = false; 1473 1473 struct list_head *clk_list = &hba->clk_list_head; 1474 1474 struct ufs_clk_info *clki; 1475 1475 unsigned long irq_flags;
+7
drivers/usb/storage/scsiglue.c
··· 180 180 sdev->use_192_bytes_for_3f = 1; 181 181 182 182 /* 183 + * Some devices report generic values until the media has been 184 + * accessed. Force a READ(10) prior to querying device 185 + * characteristics. 186 + */ 187 + sdev->read_before_ms = 1; 188 + 189 + /* 183 190 * Some devices don't like MODE SENSE with page=0x3f, 184 191 * which is the command used for checking if a device 185 192 * is write-protected. Now that we tell the sd driver
+7
drivers/usb/storage/uas.c
··· 879 879 sdev->guess_capacity = 1; 880 880 881 881 /* 882 + * Some devices report generic values until the media has been 883 + * accessed. Force a READ(10) prior to querying device 884 + * characteristics. 885 + */ 886 + sdev->read_before_ms = 1; 887 + 888 + /* 882 889 * Some devices don't like MODE SENSE with page=0x3f, 883 890 * which is the command used for checking if a device 884 891 * is write-protected. Now that we tell the sd driver
+1 -4
include/scsi/scsi_device.h
··· 100 100 unsigned char data[]; 101 101 }; 102 102 103 - enum scsi_vpd_parameters { 104 - SCSI_VPD_HEADER_SIZE = 4, 105 - }; 106 - 107 103 struct scsi_device { 108 104 struct Scsi_Host *host; 109 105 struct request_queue *request_queue; ··· 204 208 unsigned use_10_for_rw:1; /* first try 10-byte read / write */ 205 209 unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ 206 210 unsigned set_dbd_for_ms:1; /* Set "DBD" field in mode sense */ 211 + unsigned read_before_ms:1; /* perform a READ before MODE SENSE */ 207 212 unsigned no_report_opcodes:1; /* no REPORT SUPPORTED OPERATION CODES */ 208 213 unsigned no_write_same:1; /* no WRITE SAME command */ 209 214 unsigned use_16_for_rw:1; /* Use read/write(16) over read/write(10) */