From e727c42bd55794765c460b7ac2b6cc969f2a9698 Mon Sep 17 00:00:00 2001 From: "Martin K. Petersen" Date: Tue, 14 Apr 2015 16:56:23 -0400 Subject: sd: Unregister integrity profile The new integrity code did not correctly unregister the profile for SD disks. Call blk_integrity_unregister() when we release a disk. Signed-off-by: Martin K. Petersen Reported-by: Sagi Grimberg Tested-by: Sagi Grimberg Cc: stable@vger.kernel.org # v3.17+ Signed-off-by: James Bottomley --- drivers/scsi/sd.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/scsi') diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index dcc42446f58a..79beebf53302 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3076,6 +3076,7 @@ static void scsi_disk_release(struct device *dev) ida_remove(&sd_index_ida, sdkp->index); spin_unlock(&sd_index_lock); + blk_integrity_unregister(disk); disk->private_data = NULL; put_disk(disk); put_device(&sdkp->device->sdev_gendev); -- cgit v1.2.3 From e557990e358934fb168d30371c9c0f63e314c6b8 Mon Sep 17 00:00:00 2001 From: "Martin K. Petersen" Date: Tue, 14 Apr 2015 17:11:03 -0400 Subject: sd: Fix missing ATO tag check 3aec2f41a8bae introduced a merge error where we would end up check for sdkp instead of sdkp->ATO. Fix this so we register app tag capability correctly. Signed-off-by: Martin K. Petersen Cc: # v3.17+ Reviewed-by: Sagi Grimberg Signed-off-by: James Bottomley --- drivers/scsi/sd_dif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/scsi') diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c index 14c7d42a11c2..5c06d292b94c 100644 --- a/drivers/scsi/sd_dif.c +++ b/drivers/scsi/sd_dif.c @@ -77,7 +77,7 @@ void sd_dif_config_host(struct scsi_disk *sdkp) disk->integrity->flags |= BLK_INTEGRITY_DEVICE_CAPABLE; - if (!sdkp) + if (!sdkp->ATO) return; if (type == SD_DIF_TYPE3_PROTECTION) -- cgit v1.2.3 From 16b8528d20607925899b1df93bfd8fbab98d267c Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 15 Apr 2015 09:44:37 -0700 Subject: megaraid_sas: use raw_smp_processor_id() We only want to steer the I/O completion towards a queue, but don't actually access any per-CPU data, so the raw_ version is fine to use and avoids the warnings when using smp_processor_id(). Signed-off-by: Christoph Hellwig Reported-by: Andy Lutomirski Tested-by: Andy Lutomirski Acked-by: Sumit Saxena Cc: Signed-off-by: James Bottomley --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/scsi') diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 675b5e7aba94..5a0800d19970 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1584,11 +1584,11 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, fp_possible = io_info.fpOkForIo; } - /* Use smp_processor_id() for now until cmd->request->cpu is CPU + /* Use raw_smp_processor_id() for now until cmd->request->cpu is CPU id by default, not CPU group id, otherwise all MSI-X queues won't be utilized */ cmd->request_desc->SCSIIO.MSIxIndex = instance->msix_vectors ? - smp_processor_id() % instance->msix_vectors : 0; + raw_smp_processor_id() % instance->msix_vectors : 0; if (fp_possible) { megasas_set_pd_lba(io_request, scp->cmd_len, &io_info, scp, @@ -1693,7 +1693,10 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance, << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT; cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle; cmd->request_desc->SCSIIO.MSIxIndex = - instance->msix_vectors ? smp_processor_id() % instance->msix_vectors : 0; + instance->msix_vectors ? + raw_smp_processor_id() % + instance->msix_vectors : + 0; os_timeout_value = scmd->request->timeout / HZ; if (instance->secure_jbod_support && -- cgit v1.2.3 From 8041708ed4d993c5466c20926210598afa97194e Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Fri, 27 Mar 2015 14:31:12 +0100 Subject: am53c974: Fix crash during modprobe On systems with shared interrupts the interrupt routine might be called as soon as the interrupt is enabled. As this might happen before pci_set_drvdata() is called the system would crash. Reported-by: Andreas Brogle Tested-by: Andreas Brogle Signed-off-by: Hannes Reinecke Signed-off-by: James Bottomley --- drivers/scsi/am53c974.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/scsi') diff --git a/drivers/scsi/am53c974.c b/drivers/scsi/am53c974.c index a6f5ee80fadc..beea30e5a34a 100644 --- a/drivers/scsi/am53c974.c +++ b/drivers/scsi/am53c974.c @@ -476,6 +476,8 @@ static int pci_esp_probe_one(struct pci_dev *pdev, goto fail_unmap_regs; } + pci_set_drvdata(pdev, pep); + err = request_irq(pdev->irq, scsi_esp_intr, IRQF_SHARED, DRV_MODULE_NAME, esp); if (err < 0) { @@ -496,8 +498,6 @@ static int pci_esp_probe_one(struct pci_dev *pdev, /* Assume 40MHz clock */ esp->cfreq = 40000000; - pci_set_drvdata(pdev, pep); - err = scsi_esp_register(esp, &pdev->dev); if (err) goto fail_free_irq; @@ -507,6 +507,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev, fail_free_irq: free_irq(pdev->irq, esp); fail_unmap_command_block: + pci_set_drvdata(pdev, NULL); pci_free_consistent(pdev, 16, esp->command_block, esp->command_block_dma); fail_unmap_regs: @@ -530,6 +531,7 @@ static void pci_esp_remove_one(struct pci_dev *pdev) scsi_esp_unregister(esp); free_irq(pdev->irq, esp); + pci_set_drvdata(pdev, NULL); pci_free_consistent(pdev, 16, esp->command_block, esp->command_block_dma); pci_iounmap(pdev, esp->regs); -- cgit v1.2.3 From 56cbd0ccc1b508de19561211d7ab9e1c77e6b384 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Wed, 15 Apr 2015 22:16:01 -0700 Subject: mvsas: fix panic on expander attached SATA devices mvsas is giving a General protection fault when it encounters an expander attached ATA device. Analysis of mvs_task_prep_ata() shows that the driver is assuming all ATA devices are locally attached and obtaining the phy mask by indexing the local phy table (in the HBA structure) with the phy id. Since expanders have many more phys than the HBA, this is causing the index into the HBA phy table to overflow and returning rubbish as the pointer. mvs_task_prep_ssp() instead does the phy mask using the port properties. Mirror this in mvs_task_prep_ata() to fix the panic. Reported-by: Adam Talbot Tested-by: Adam Talbot Cc: Signed-off-by: James Bottomley --- drivers/scsi/mvsas/mv_sas.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/scsi') diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c index 2d5ab6d969ec..454536c49315 100644 --- a/drivers/scsi/mvsas/mv_sas.c +++ b/drivers/scsi/mvsas/mv_sas.c @@ -441,14 +441,11 @@ static u32 mvs_get_ncq_tag(struct sas_task *task, u32 *tag) static int mvs_task_prep_ata(struct mvs_info *mvi, struct mvs_task_exec_info *tei) { - struct sas_ha_struct *sha = mvi->sas; struct sas_task *task = tei->task; struct domain_device *dev = task->dev; struct mvs_device *mvi_dev = dev->lldd_dev; struct mvs_cmd_hdr *hdr = tei->hdr; struct asd_sas_port *sas_port = dev->port; - struct sas_phy *sphy = dev->phy; - struct asd_sas_phy *sas_phy = sha->sas_phy[sphy->number]; struct mvs_slot_info *slot; void *buf_prd; u32 tag = tei->tag, hdr_tag; @@ -468,7 +465,7 @@ static int mvs_task_prep_ata(struct mvs_info *mvi, slot->tx = mvi->tx_prod; del_q = TXQ_MODE_I | tag | (TXQ_CMD_STP << TXQ_CMD_SHIFT) | - (MVS_PHY_ID << TXQ_PHY_SHIFT) | + ((sas_port->phy_mask & TXQ_PHY_MASK) << TXQ_PHY_SHIFT) | (mvi_dev->taskfileset << TXQ_SRS_SHIFT); mvi->tx[mvi->tx_prod] = cpu_to_le32(del_q); -- cgit v1.2.3