Skip to content

Commit 4f87e90

Browse files
Merge branch 7.1/scsi-fixes into 7.2/scsi-staging
Pull in outstanding commits from 7.1 branch. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 7c08d43 + 5d5221f commit 4f87e90

23 files changed

Lines changed: 246 additions & 78 deletions

drivers/scsi/device_handler/scsi_dh_alua.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#define TPGS_MODE_EXPLICIT 0x2
3838

3939
#define ALUA_RTPG_SIZE 128
40-
#define ALUA_FAILOVER_TIMEOUT 60
40+
#define ALUA_FAILOVER_TIMEOUT 255 /* max 255 (8-bit value) */
4141
#define ALUA_FAILOVER_RETRIES 5
4242
#define ALUA_RTPG_DELAY_MSECS 5
4343
#define ALUA_RTPG_RETRY_DELAY 2

drivers/scsi/fcoe/fcoe_ctlr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
13851385

13861386
while (rlen >= sizeof(*desc)) {
13871387
dlen = desc->fip_dlen * FIP_BPW;
1388-
if (dlen > rlen)
1388+
if (dlen < sizeof(*desc) || dlen > rlen)
13891389
goto err;
13901390
/* Drop CVL if there are duplicate critical descriptors */
13911391
if ((desc->fip_dtype < 32) &&

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ static void prep_ata_v3_hw(struct hisi_hba *hisi_hba,
14911491
phy_id = device->phy->identify.phy_identifier;
14921492
hdr->dw0 |= cpu_to_le32((1U << phy_id)
14931493
<< CMD_HDR_PHY_ID_OFF);
1494-
hdr->dw0 |= CMD_HDR_FORCE_PHY_MSK;
1494+
hdr->dw0 |= cpu_to_le32(CMD_HDR_FORCE_PHY_MSK);
14951495
hdr->dw0 |= cpu_to_le32(4U << CMD_HDR_CMD_OFF);
14961496
}
14971497

drivers/scsi/isci/host.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,9 @@ void isci_host_deinit(struct isci_host *ihost)
12521252

12531253
wait_for_stop(ihost);
12541254

1255+
/* No further IRQ-driven scheduling can happen past wait_for_stop(). */
1256+
tasklet_kill(&ihost->completion_tasklet);
1257+
12551258
/* phy stop is after controller stop to allow port and device to
12561259
* go idle before shutting down the phys, but the expectation is
12571260
* that i/o has been shut off well before we reach this

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,6 +3612,15 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
36123612
complete(&cmd_fusion->done);
36133613
break;
36143614
case MPI2_FUNCTION_SCSI_IO_REQUEST: /*Fast Path IO.*/
3615+
/*
3616+
* Firmware can send stale/duplicate completions for
3617+
* commands already returned to the pool. scmd_local
3618+
* would be NULL for such cases. Skip processing to
3619+
* avoid NULL pointer access.
3620+
*/
3621+
if (!scmd_local)
3622+
break;
3623+
36153624
/* Update load balancing info */
36163625
if (fusion->load_balance_info &&
36173626
(megasas_priv(cmd_fusion->scmd)->status &

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2738,8 +2738,20 @@ scsih_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim)
27382738
pcie_device->enclosure_level,
27392739
pcie_device->connector_name);
27402740

2741+
/*
2742+
* The HBA firmware passes the NVMe drive's MDTS
2743+
* (Maximum Data Transfer Size) up to the driver. However,
2744+
* the driver hardcodes a 4K buffer size for the PRP list,
2745+
* accommodating at most 512 entries. This strictly limits
2746+
* the maximum supported NVMe I/O transfer to 2 MiB.
2747+
*
2748+
* Cap max_hw_sectors to the smaller of the drive's reported
2749+
* MDTS or the 2 MiB driver limit to prevent kernel oopses.
2750+
*/
2751+
lim->max_hw_sectors = SZ_2M >> SECTOR_SHIFT;
27412752
if (pcie_device->nvme_mdts)
2742-
lim->max_hw_sectors = pcie_device->nvme_mdts / 512;
2753+
lim->max_hw_sectors = min(lim->max_hw_sectors,
2754+
pcie_device->nvme_mdts >> SECTOR_SHIFT);
27432755

27442756
pcie_device_put(pcie_device);
27452757
spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);

drivers/scsi/pmcraid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ struct pmcraid_hostrcb {
657657
*/
658658
struct pmcraid_instance {
659659
/* Array of allowed-to-be-exposed resources, initialized from
660-
* Configutation Table, later updated with CCNs
660+
* Configuration Table, later updated with CCNs
661661
*/
662662
struct pmcraid_resource_entry *res_entries;
663663

drivers/scsi/scsi_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6945,7 +6945,7 @@ static int scsi_debug_device_reset(struct scsi_cmnd *SCpnt)
69456945
++num_dev_resets;
69466946

69476947
if (SDEBUG_OPT_ALL_NOISE & sdebug_opts)
6948-
sdev_printk(KERN_INFO, sdp, "doing device reset");
6948+
sdev_printk(KERN_INFO, sdp, "doing device reset\n");
69496949

69506950
scsi_debug_stop_all_queued(sdp);
69516951
if (devip) {

drivers/scsi/scsi_devinfo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ static struct {
218218
{"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
219219
{"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
220220
{"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
221-
{"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC},
221+
{"Promise", "VTrak E310", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC},
222+
{"Promise", "VTrak E610", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC},
222223
{"Promise", "", NULL, BLIST_SPARSELUN},
223224
{"QEMU", "QEMU CD-ROM", NULL, BLIST_SKIP_VPD_PAGES},
224225
{"QNAP", "iSCSI Storage", NULL, BLIST_MAX_1024},

drivers/scsi/scsi_lib.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,10 +575,33 @@ void scsi_requeue_run_queue(struct work_struct *work)
575575

576576
void scsi_run_host_queues(struct Scsi_Host *shost)
577577
{
578-
struct scsi_device *sdev;
578+
struct scsi_device *sdev, *prev = NULL;
579+
unsigned long flags;
579580

580-
shost_for_each_device(sdev, shost)
581+
spin_lock_irqsave(shost->host_lock, flags);
582+
__shost_for_each_device(sdev, shost) {
583+
/*
584+
* Only skip devices so deep into removal they will never need
585+
* another kick to their queues. Thus scsi_device_get() cannot
586+
* be used as it would skip devices in SDEV_CANCEL state which
587+
* may need a queue kick.
588+
*/
589+
if (sdev->sdev_state == SDEV_DEL ||
590+
!get_device(&sdev->sdev_gendev))
591+
continue;
592+
spin_unlock_irqrestore(shost->host_lock, flags);
593+
594+
if (prev)
595+
put_device(&prev->sdev_gendev);
581596
scsi_run_queue(sdev->request_queue);
597+
598+
prev = sdev;
599+
600+
spin_lock_irqsave(shost->host_lock, flags);
601+
}
602+
spin_unlock_irqrestore(shost->host_lock, flags);
603+
if (prev)
604+
put_device(&prev->sdev_gendev);
582605
}
583606

584607
static void scsi_uninit_cmd(struct scsi_cmnd *cmd)

0 commit comments

Comments
 (0)