Skip to content

Commit 169387e

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Sixteen patches, mostly minor fixes and updates; however there are substantive driver bug fixes in pm8001, bnx2fc, zfcp, myrs and qedf" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: myrs: Fix crash in error case scsi: 53c700: Remove redundant assignment to pointer SCp scsi: ufs: Treat link loss as fatal error scsi: ufs: Use generic error code in ufshcd_set_dev_pwr_mode() scsi: bfa: Remove useless DMA-32 fallback configuration scsi: hisi_sas: Remove useless DMA-32 fallback configuration scsi: 3w-sas: Remove useless DMA-32 fallback configuration scsi: bnx2fc: Flush destroy_work queue before calling bnx2fc_interface_put() scsi: zfcp: Fix failed recovery on gone remote port with non-NPIV FCP devices scsi: pm8001: Fix bogus FW crash for maxcpus=1 scsi: qedf: Change context reset messages to ratelimited scsi: qedf: Fix refcount issue when LOGO is received during TMF scsi: qedf: Add stag_work to all the vports scsi: ufs: ufshcd-pltfrm: Check the return value of devm_kstrdup() scsi: target: iscsi: Make sure the np under each tpg is unique scsi: elx: efct: Don't use GFP_KERNEL under spin lock
2 parents 073819e + 4db0959 commit 169387e

File tree

17 files changed

+64
-48
lines changed

17 files changed

+64
-48
lines changed

drivers/s390/scsi/zfcp_fc.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ static void zfcp_fc_adisc_handler(void *data)
521521
goto out;
522522
}
523523

524+
/* re-init to undo drop from zfcp_fc_adisc() */
525+
port->d_id = ntoh24(adisc_resp->adisc_port_id);
524526
/* port is good, unblock rport without going through erp */
525527
zfcp_scsi_schedule_rport_register(port);
526528
out:
@@ -534,6 +536,7 @@ static int zfcp_fc_adisc(struct zfcp_port *port)
534536
struct zfcp_fc_req *fc_req;
535537
struct zfcp_adapter *adapter = port->adapter;
536538
struct Scsi_Host *shost = adapter->scsi_host;
539+
u32 d_id;
537540
int ret;
538541

539542
fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_ATOMIC);
@@ -558,7 +561,15 @@ static int zfcp_fc_adisc(struct zfcp_port *port)
558561
fc_req->u.adisc.req.adisc_cmd = ELS_ADISC;
559562
hton24(fc_req->u.adisc.req.adisc_port_id, fc_host_port_id(shost));
560563

561-
ret = zfcp_fsf_send_els(adapter, port->d_id, &fc_req->ct_els,
564+
d_id = port->d_id; /* remember as destination for send els below */
565+
/*
566+
* Force fresh GID_PN lookup on next port recovery.
567+
* Must happen after request setup and before sending request,
568+
* to prevent race with port->d_id re-init in zfcp_fc_adisc_handler().
569+
*/
570+
port->d_id = 0;
571+
572+
ret = zfcp_fsf_send_els(adapter, d_id, &fc_req->ct_els,
562573
ZFCP_FC_CTELS_TMO);
563574
if (ret)
564575
kmem_cache_free(zfcp_fc_req_cache, fc_req);

drivers/scsi/3w-sas.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,8 +1567,6 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
15671567
pci_try_set_mwi(pdev);
15681568

15691569
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1570-
if (retval)
1571-
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
15721570
if (retval) {
15731571
TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
15741572
retval = -ENODEV;
@@ -1786,8 +1784,6 @@ static int __maybe_unused twl_resume(struct device *dev)
17861784
pci_try_set_mwi(pdev);
17871785

17881786
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1789-
if (retval)
1790-
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
17911787
if (retval) {
17921788
TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
17931789
retval = -ENODEV;

drivers/scsi/53c700.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,6 @@ NCR_700_intr(int irq, void *dev_id)
15071507
struct scsi_cmnd *SCp = hostdata->cmd;
15081508

15091509
handled = 1;
1510-
SCp = hostdata->cmd;
15111510

15121511
if(istat & SCSI_INT_PENDING) {
15131512
udelay(10);

drivers/scsi/bfa/bfad.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -732,9 +732,6 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
732732
pci_set_master(pdev);
733733

734734
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
735-
if (rc)
736-
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
737-
738735
if (rc) {
739736
rc = -ENODEV;
740737
printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);
@@ -1559,9 +1556,6 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
15591556
pci_set_master(pdev);
15601557

15611558
rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64));
1562-
if (rc)
1563-
rc = dma_set_mask_and_coherent(&bfad->pcidev->dev,
1564-
DMA_BIT_MASK(32));
15651559
if (rc)
15661560
goto out_disable_device;
15671561

drivers/scsi/bnx2fc/bnx2fc_fcoe.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba);
8282
static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba);
8383
static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
8484
struct device *parent, int npiv);
85-
static void bnx2fc_destroy_work(struct work_struct *work);
85+
static void bnx2fc_port_destroy(struct fcoe_port *port);
8686

8787
static struct bnx2fc_hba *bnx2fc_hba_lookup(struct net_device *phys_dev);
8888
static struct bnx2fc_interface *bnx2fc_interface_lookup(struct net_device
@@ -907,9 +907,6 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
907907
__bnx2fc_destroy(interface);
908908
}
909909
mutex_unlock(&bnx2fc_dev_lock);
910-
911-
/* Ensure ALL destroy work has been completed before return */
912-
flush_workqueue(bnx2fc_wq);
913910
return;
914911

915912
default:
@@ -1215,8 +1212,8 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport)
12151212
mutex_unlock(&n_port->lp_mutex);
12161213
bnx2fc_free_vport(interface->hba, port->lport);
12171214
bnx2fc_port_shutdown(port->lport);
1215+
bnx2fc_port_destroy(port);
12181216
bnx2fc_interface_put(interface);
1219-
queue_work(bnx2fc_wq, &port->destroy_work);
12201217
return 0;
12211218
}
12221219

@@ -1525,7 +1522,6 @@ static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
15251522
port->lport = lport;
15261523
port->priv = interface;
15271524
port->get_netdev = bnx2fc_netdev;
1528-
INIT_WORK(&port->destroy_work, bnx2fc_destroy_work);
15291525

15301526
/* Configure fcoe_port */
15311527
rc = bnx2fc_lport_config(lport);
@@ -1653,8 +1649,8 @@ static void __bnx2fc_destroy(struct bnx2fc_interface *interface)
16531649
bnx2fc_interface_cleanup(interface);
16541650
bnx2fc_stop(interface);
16551651
list_del(&interface->list);
1652+
bnx2fc_port_destroy(port);
16561653
bnx2fc_interface_put(interface);
1657-
queue_work(bnx2fc_wq, &port->destroy_work);
16581654
}
16591655

16601656
/**
@@ -1694,15 +1690,12 @@ static int bnx2fc_destroy(struct net_device *netdev)
16941690
return rc;
16951691
}
16961692

1697-
static void bnx2fc_destroy_work(struct work_struct *work)
1693+
static void bnx2fc_port_destroy(struct fcoe_port *port)
16981694
{
1699-
struct fcoe_port *port;
17001695
struct fc_lport *lport;
17011696

1702-
port = container_of(work, struct fcoe_port, destroy_work);
17031697
lport = port->lport;
1704-
1705-
BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n");
1698+
BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport);
17061699

17071700
bnx2fc_if_destroy(lport);
17081701
}
@@ -2556,9 +2549,6 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev)
25562549
__bnx2fc_destroy(interface);
25572550
mutex_unlock(&bnx2fc_dev_lock);
25582551

2559-
/* Ensure ALL destroy work has been completed before return */
2560-
flush_workqueue(bnx2fc_wq);
2561-
25622552
bnx2fc_ulp_stop(hba);
25632553
/* unregister cnic device */
25642554
if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic))

drivers/scsi/elx/libefc/efc_els.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,14 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
4646

4747
efc = node->efc;
4848

49-
spin_lock_irqsave(&node->els_ios_lock, flags);
50-
5149
if (!node->els_io_enabled) {
5250
efc_log_err(efc, "els io alloc disabled\n");
53-
spin_unlock_irqrestore(&node->els_ios_lock, flags);
5451
return NULL;
5552
}
5653

5754
els = mempool_alloc(efc->els_io_pool, GFP_ATOMIC);
5855
if (!els) {
5956
atomic_add_return(1, &efc->els_io_alloc_failed_count);
60-
spin_unlock_irqrestore(&node->els_ios_lock, flags);
6157
return NULL;
6258
}
6359

@@ -74,7 +70,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
7470
&els->io.req.phys, GFP_KERNEL);
7571
if (!els->io.req.virt) {
7672
mempool_free(els, efc->els_io_pool);
77-
spin_unlock_irqrestore(&node->els_ios_lock, flags);
7873
return NULL;
7974
}
8075

@@ -94,10 +89,11 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
9489

9590
/* add els structure to ELS IO list */
9691
INIT_LIST_HEAD(&els->list_entry);
92+
spin_lock_irqsave(&node->els_ios_lock, flags);
9793
list_add_tail(&els->list_entry, &node->els_ios_list);
94+
spin_unlock_irqrestore(&node->els_ios_lock, flags);
9895
}
9996

100-
spin_unlock_irqrestore(&node->els_ios_lock, flags);
10197
return els;
10298
}
10399

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,9 +2666,6 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
26662666
goto err_out;
26672667

26682668
error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
2669-
if (error)
2670-
error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
2671-
26722669
if (error) {
26732670
dev_err(dev, "No usable DMA addressing method\n");
26742671
goto err_out;

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4695,8 +4695,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
46954695
goto err_out;
46964696

46974697
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
4698-
if (rc)
4699-
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
47004698
if (rc) {
47014699
dev_err(dev, "No usable DMA addressing method\n");
47024700
rc = -ENODEV;

drivers/scsi/myrs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,8 @@ static void myrs_cleanup(struct myrs_hba *cs)
22672267
myrs_unmap(cs);
22682268

22692269
if (cs->mmio_base) {
2270-
cs->disable_intr(cs);
2270+
if (cs->disable_intr)
2271+
cs->disable_intr(cs);
22712272
iounmap(cs->mmio_base);
22722273
cs->mmio_base = NULL;
22732274
}

drivers/scsi/pm8001/pm80xx_hwi.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4151,10 +4151,22 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec)
41514151
u32 ret = MPI_IO_STATUS_FAIL;
41524152
u32 regval;
41534153

4154+
/*
4155+
* Fatal errors are programmed to be signalled in irq vector
4156+
* pm8001_ha->max_q_num - 1 through pm8001_ha->main_cfg_tbl.pm80xx_tbl.
4157+
* fatal_err_interrupt
4158+
*/
41544159
if (vec == (pm8001_ha->max_q_num - 1)) {
4160+
u32 mipsall_ready;
4161+
4162+
if (pm8001_ha->chip_id == chip_8008 ||
4163+
pm8001_ha->chip_id == chip_8009)
4164+
mipsall_ready = SCRATCH_PAD_MIPSALL_READY_8PORT;
4165+
else
4166+
mipsall_ready = SCRATCH_PAD_MIPSALL_READY_16PORT;
4167+
41554168
regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1);
4156-
if ((regval & SCRATCH_PAD_MIPSALL_READY) !=
4157-
SCRATCH_PAD_MIPSALL_READY) {
4169+
if ((regval & mipsall_ready) != mipsall_ready) {
41584170
pm8001_ha->controller_fatal_error = true;
41594171
pm8001_dbg(pm8001_ha, FAIL,
41604172
"Firmware Fatal error! Regval:0x%x\n",

drivers/scsi/pm8001/pm80xx_hwi.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,8 +1405,12 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t;
14051405
#define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0
14061406
#define SCRATCH_PAD_IOP0_READY 0xC00
14071407
#define SCRATCH_PAD_IOP1_READY 0x3000
1408-
#define SCRATCH_PAD_MIPSALL_READY (SCRATCH_PAD_IOP1_READY | \
1408+
#define SCRATCH_PAD_MIPSALL_READY_16PORT (SCRATCH_PAD_IOP1_READY | \
14091409
SCRATCH_PAD_IOP0_READY | \
1410+
SCRATCH_PAD_ILA_READY | \
1411+
SCRATCH_PAD_RAAE_READY)
1412+
#define SCRATCH_PAD_MIPSALL_READY_8PORT (SCRATCH_PAD_IOP0_READY | \
1413+
SCRATCH_PAD_ILA_READY | \
14101414
SCRATCH_PAD_RAAE_READY)
14111415

14121416
/* boot loader state */

drivers/scsi/qedf/qedf_io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,6 +2250,7 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req,
22502250
io_req->tm_flags == FCP_TMF_TGT_RESET) {
22512251
clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags);
22522252
io_req->sc_cmd = NULL;
2253+
kref_put(&io_req->refcount, qedf_release_cmd);
22532254
complete(&io_req->tm_done);
22542255
}
22552256

drivers/scsi/qedf/qedf_main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ void qedf_ctx_soft_reset(struct fc_lport *lport)
911911
struct qed_link_output if_link;
912912

913913
if (lport->vport) {
914-
QEDF_ERR(NULL, "Cannot issue host reset on NPIV port.\n");
914+
printk_ratelimited("Cannot issue host reset on NPIV port.\n");
915915
return;
916916
}
917917

@@ -1864,6 +1864,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled)
18641864
vport_qedf->cmd_mgr = base_qedf->cmd_mgr;
18651865
init_completion(&vport_qedf->flogi_compl);
18661866
INIT_LIST_HEAD(&vport_qedf->fcports);
1867+
INIT_DELAYED_WORK(&vport_qedf->stag_work, qedf_stag_change_work);
18671868

18681869
rc = qedf_vport_libfc_config(vport, vn_port);
18691870
if (rc) {
@@ -3980,7 +3981,9 @@ void qedf_stag_change_work(struct work_struct *work)
39803981
struct qedf_ctx *qedf =
39813982
container_of(work, struct qedf_ctx, stag_work.work);
39823983

3983-
QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n");
3984+
printk_ratelimited("[%s]:[%s:%d]:%d: Performing software context reset.",
3985+
dev_name(&qedf->pdev->dev), __func__, __LINE__,
3986+
qedf->dbg_ctx.host_no);
39843987
qedf_ctx_soft_reset(qedf->lport);
39853988
}
39863989

drivers/scsi/ufs/ufshcd-pltfrm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
9292
clki->min_freq = clkfreq[i];
9393
clki->max_freq = clkfreq[i+1];
9494
clki->name = devm_kstrdup(dev, name, GFP_KERNEL);
95+
if (!clki->name) {
96+
ret = -ENOMEM;
97+
goto out;
98+
}
99+
95100
if (!strcmp(name, "ref_clk"))
96101
clki->keep_link_active = true;
97102
dev_dbg(dev, "%s: min %u max %u name %s\n", "freq-table-hz",
@@ -127,6 +132,8 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,
127132
return -ENOMEM;
128133

129134
vreg->name = devm_kstrdup(dev, name, GFP_KERNEL);
135+
if (!vreg->name)
136+
return -ENOMEM;
130137

131138
snprintf(prop_name, MAX_PROP_SIZE, "%s-max-microamp", name);
132139
if (of_property_read_u32(np, prop_name, &vreg->max_uA)) {

drivers/scsi/ufs/ufshcd.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8613,7 +8613,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba)
86138613
* @pwr_mode: device power mode to set
86148614
*
86158615
* Returns 0 if requested power mode is set successfully
8616-
* Returns non-zero if failed to set the requested power mode
8616+
* Returns < 0 if failed to set the requested power mode
86178617
*/
86188618
static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
86198619
enum ufs_dev_pwr_mode pwr_mode)
@@ -8667,8 +8667,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
86678667
sdev_printk(KERN_WARNING, sdp,
86688668
"START_STOP failed for power mode: %d, result %x\n",
86698669
pwr_mode, ret);
8670-
if (ret > 0 && scsi_sense_valid(&sshdr))
8671-
scsi_print_sense_hdr(sdp, NULL, &sshdr);
8670+
if (ret > 0) {
8671+
if (scsi_sense_valid(&sshdr))
8672+
scsi_print_sense_hdr(sdp, NULL, &sshdr);
8673+
ret = -EIO;
8674+
}
86728675
}
86738676

86748677
if (!ret)

drivers/scsi/ufs/ufshci.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ static inline u32 ufshci_version(u32 major, u32 minor)
142142
#define INT_FATAL_ERRORS (DEVICE_FATAL_ERROR |\
143143
CONTROLLER_FATAL_ERROR |\
144144
SYSTEM_BUS_FATAL_ERROR |\
145-
CRYPTO_ENGINE_FATAL_ERROR)
145+
CRYPTO_ENGINE_FATAL_ERROR |\
146+
UIC_LINK_LOST)
146147

147148
/* HCS - Host Controller Status 30h */
148149
#define DEVICE_PRESENT 0x1

drivers/target/iscsi/iscsi_target_tpg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ static bool iscsit_tpg_check_network_portal(
443443
break;
444444
}
445445
spin_unlock(&tpg->tpg_np_lock);
446+
447+
if (match)
448+
break;
446449
}
447450
spin_unlock(&tiqn->tiqn_tpg_lock);
448451

0 commit comments

Comments
 (0)