Skip to content

Commit 07c4b9e

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: "24 fixes, all in drivers. The lion's share (16) are qla2xxx and the rest are iscsi (3), ufs (2), smarpqi, lpfc and libsas" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (24 commits) scsi: iscsi: Avoid potential deadlock in iscsi_if_rx func scsi: iscsi: Fix a potential deadlock in the timeout handler scsi: smartpqi: Update attribute name to `driver_version` scsi: libsas: stop discovering if oob mode is disconnected scsi: ufs: Disable autohibern8 feature in Cadence UFS scsi: iscsi: qla4xxx: fix double free in probe scsi: ufs: Give an unique ID to each ufs-bsg scsi: qla2xxx: Add debug dump of LOGO payload and ELS IOCB scsi: qla2xxx: Ignore PORT UPDATE after N2N PLOGI scsi: qla2xxx: Don't defer relogin unconditonally scsi: qla2xxx: Send Notify ACK after N2N PLOGI scsi: qla2xxx: Configure local loop for N2N target scsi: qla2xxx: Fix PLOGI payload and ELS IOCB dump length scsi: qla2xxx: Don't call qlt_async_event twice scsi: qla2xxx: Allow PLOGI in target mode scsi: qla2xxx: Change discovery state before PLOGI scsi: qla2xxx: Drop superfluous INIT_WORK of del_work scsi: qla2xxx: Initialize free_work before flushing it scsi: qla2xxx: Use explicit LOGO in target mode scsi: qla2xxx: Ignore NULL pointer in tcm_qla2xxx_free_mcmd ...
2 parents f61cf8d + bba340c commit 07c4b9e

File tree

19 files changed

+111
-46
lines changed

19 files changed

+111
-46
lines changed

Documentation/scsi/smartpqi.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ smartpqi specific entries in /sys
2929
smartpqi host attributes:
3030
-------------------------
3131
/sys/class/scsi_host/host*/rescan
32-
/sys/class/scsi_host/host*/version
32+
/sys/class/scsi_host/host*/driver_version
3333

3434
The host rescan attribute is a write only attribute. Writing to this
3535
attribute will trigger the driver to scan for new, changed, or removed

drivers/scsi/libiscsi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)
19451945

19461946
ISCSI_DBG_EH(session, "scsi cmd %p timedout\n", sc);
19471947

1948-
spin_lock(&session->frwd_lock);
1948+
spin_lock_bh(&session->frwd_lock);
19491949
task = (struct iscsi_task *)sc->SCp.ptr;
19501950
if (!task) {
19511951
/*
@@ -2072,7 +2072,7 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)
20722072
done:
20732073
if (task)
20742074
task->last_timeout = jiffies;
2075-
spin_unlock(&session->frwd_lock);
2075+
spin_unlock_bh(&session->frwd_lock);
20762076
ISCSI_DBG_EH(session, "return %s\n", rc == BLK_EH_RESET_TIMER ?
20772077
"timer reset" : "shutdown or nh");
20782078
return rc;

drivers/scsi/libsas/sas_discover.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,21 @@ static int sas_get_port_device(struct asd_sas_port *port)
8181
else
8282
dev->dev_type = SAS_SATA_DEV;
8383
dev->tproto = SAS_PROTOCOL_SATA;
84-
} else {
84+
} else if (port->oob_mode == SAS_OOB_MODE) {
8585
struct sas_identify_frame *id =
8686
(struct sas_identify_frame *) dev->frame_rcvd;
8787
dev->dev_type = id->dev_type;
8888
dev->iproto = id->initiator_bits;
8989
dev->tproto = id->target_bits;
90+
} else {
91+
/* If the oob mode is OOB_NOT_CONNECTED, the port is
92+
* disconnected due to race with PHY down. We cannot
93+
* continue to discover this port
94+
*/
95+
sas_put_device(dev);
96+
pr_warn("Port %016llx is disconnected when discovering\n",
97+
SAS_ADDR(port->attached_sas_addr));
98+
return -ENODEV;
9099
}
91100

92101
sas_init_dev(dev);

drivers/scsi/lpfc/lpfc_bsg.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4489,12 +4489,6 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job,
44894489
phba->mbox_ext_buf_ctx.seqNum++;
44904490
nemb_tp = phba->mbox_ext_buf_ctx.nembType;
44914491

4492-
dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL);
4493-
if (!dd_data) {
4494-
rc = -ENOMEM;
4495-
goto job_error;
4496-
}
4497-
44984492
pbuf = (uint8_t *)dmabuf->virt;
44994493
size = job->request_payload.payload_len;
45004494
sg_copy_to_buffer(job->request_payload.sg_list,
@@ -4531,6 +4525,13 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job,
45314525
"2968 SLI_CONFIG ext-buffer wr all %d "
45324526
"ebuffers received\n",
45334527
phba->mbox_ext_buf_ctx.numBuf);
4528+
4529+
dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL);
4530+
if (!dd_data) {
4531+
rc = -ENOMEM;
4532+
goto job_error;
4533+
}
4534+
45344535
/* mailbox command structure for base driver */
45354536
pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
45364537
if (!pmboxq) {
@@ -4579,6 +4580,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job,
45794580
return SLI_CONFIG_HANDLED;
45804581

45814582
job_error:
4583+
if (pmboxq)
4584+
mempool_free(pmboxq, phba->mbox_mem_pool);
45824585
lpfc_bsg_dma_page_free(phba, dmabuf);
45834586
kfree(dd_data);
45844587

drivers/scsi/qla2xxx/qla_attr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ qla2x00_sysfs_read_nvram(struct file *filp, struct kobject *kobj,
178178

179179
faddr = ha->flt_region_nvram;
180180
if (IS_QLA28XX(ha)) {
181+
qla28xx_get_aux_images(vha, &active_regions);
181182
if (active_regions.aux.vpd_nvram == QLA27XX_SECONDARY_IMAGE)
182183
faddr = ha->flt_region_nvram_sec;
183184
}

drivers/scsi/qla2xxx/qla_bsg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@ qla2x00_get_flash_image_status(struct bsg_job *bsg_job)
23992399
struct qla_active_regions regions = { };
24002400
struct active_regions active_regions = { };
24012401

2402-
qla28xx_get_aux_images(vha, &active_regions);
2402+
qla27xx_get_active_image(vha, &active_regions);
24032403
regions.global_image = active_regions.global;
24042404

24052405
if (IS_QLA28XX(ha)) {

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,7 @@ typedef struct fc_port {
24012401
unsigned int id_changed:1;
24022402
unsigned int scan_needed:1;
24032403
unsigned int n2n_flag:1;
2404+
unsigned int explicit_logout:1;
24042405

24052406
struct completion nvme_del_done;
24062407
uint32_t nvme_prli_service_param;

drivers/scsi/qla2xxx/qla_fw.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,10 @@ struct qla_flt_header {
15231523
#define FLT_REG_NVRAM_SEC_28XX_1 0x10F
15241524
#define FLT_REG_NVRAM_SEC_28XX_2 0x111
15251525
#define FLT_REG_NVRAM_SEC_28XX_3 0x113
1526+
#define FLT_REG_MPI_PRI_28XX 0xD3
1527+
#define FLT_REG_MPI_SEC_28XX 0xF0
1528+
#define FLT_REG_PEP_PRI_28XX 0xD1
1529+
#define FLT_REG_PEP_SEC_28XX 0xF1
15261530

15271531
struct qla_flt_region {
15281532
uint16_t code;

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ static int qla_post_els_plogi_work(struct scsi_qla_host *vha, fc_port_t *fcport)
533533

534534
e->u.fcport.fcport = fcport;
535535
fcport->flags |= FCF_ASYNC_ACTIVE;
536+
fcport->disc_state = DSC_LOGIN_PEND;
536537
return qla2x00_post_work(vha, e);
537538
}
538539

@@ -1526,8 +1527,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
15261527
}
15271528
}
15281529

1529-
/* for pure Target Mode. Login will not be initiated */
1530-
if (vha->host->active_mode == MODE_TARGET)
1530+
/* Target won't initiate port login if fabric is present */
1531+
if (vha->host->active_mode == MODE_TARGET && !N2N_TOPO(vha->hw))
15311532
return 0;
15321533

15331534
if (fcport->flags & FCF_ASYNC_SENT) {
@@ -1719,6 +1720,10 @@ void qla24xx_handle_relogin_event(scsi_qla_host_t *vha,
17191720
void qla_handle_els_plogi_done(scsi_qla_host_t *vha,
17201721
struct event_arg *ea)
17211722
{
1723+
/* for pure Target Mode, PRLI will not be initiated */
1724+
if (vha->host->active_mode == MODE_TARGET)
1725+
return;
1726+
17221727
ql_dbg(ql_dbg_disc, vha, 0x2118,
17231728
"%s %d %8phC post PRLI\n",
17241729
__func__, __LINE__, ea->fcport->port_name);
@@ -4852,6 +4857,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
48524857
}
48534858

48544859
INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn);
4860+
INIT_WORK(&fcport->free_work, qlt_free_session_done);
48554861
INIT_WORK(&fcport->reg_work, qla_register_fcport_fn);
48564862
INIT_LIST_HEAD(&fcport->gnl_entry);
48574863
INIT_LIST_HEAD(&fcport->list);
@@ -4930,14 +4936,8 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
49304936
set_bit(RSCN_UPDATE, &flags);
49314937
clear_bit(LOCAL_LOOP_UPDATE, &flags);
49324938

4933-
} else if (ha->current_topology == ISP_CFG_N) {
4934-
clear_bit(RSCN_UPDATE, &flags);
4935-
if (qla_tgt_mode_enabled(vha)) {
4936-
/* allow the other side to start the login */
4937-
clear_bit(LOCAL_LOOP_UPDATE, &flags);
4938-
set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
4939-
}
4940-
} else if (ha->current_topology == ISP_CFG_NL) {
4939+
} else if (ha->current_topology == ISP_CFG_NL ||
4940+
ha->current_topology == ISP_CFG_N) {
49414941
clear_bit(RSCN_UPDATE, &flags);
49424942
set_bit(LOCAL_LOOP_UPDATE, &flags);
49434943
} else if (!vha->flags.online ||
@@ -5054,7 +5054,6 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
50545054
memcpy(&ha->plogi_els_payld.data,
50555055
(void *)ha->init_cb,
50565056
sizeof(ha->plogi_els_payld.data));
5057-
set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
50585057
} else {
50595058
ql_dbg(ql_dbg_init, vha, 0x00d1,
50605059
"PLOGI ELS param read fail.\n");

drivers/scsi/qla2xxx/qla_iocb.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2405,11 +2405,19 @@ qla2x00_login_iocb(srb_t *sp, struct mbx_entry *mbx)
24052405
static void
24062406
qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio)
24072407
{
2408+
u16 control_flags = LCF_COMMAND_LOGO;
24082409
logio->entry_type = LOGINOUT_PORT_IOCB_TYPE;
2409-
logio->control_flags =
2410-
cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO);
2411-
if (!sp->fcport->keep_nport_handle)
2412-
logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT);
2410+
2411+
if (sp->fcport->explicit_logout) {
2412+
control_flags |= LCF_EXPL_LOGO|LCF_FREE_NPORT;
2413+
} else {
2414+
control_flags |= LCF_IMPL_LOGO;
2415+
2416+
if (!sp->fcport->keep_nport_handle)
2417+
control_flags |= LCF_FREE_NPORT;
2418+
}
2419+
2420+
logio->control_flags = cpu_to_le16(control_flags);
24132421
logio->nport_handle = cpu_to_le16(sp->fcport->loop_id);
24142422
logio->port_id[0] = sp->fcport->d_id.b.al_pa;
24152423
logio->port_id[1] = sp->fcport->d_id.b.area;
@@ -2617,6 +2625,10 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode,
26172625

26182626
memcpy(elsio->u.els_logo.els_logo_pyld, &logo_pyld,
26192627
sizeof(struct els_logo_payload));
2628+
ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x3075, "LOGO buffer:");
2629+
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x010a,
2630+
elsio->u.els_logo.els_logo_pyld,
2631+
sizeof(*elsio->u.els_logo.els_logo_pyld));
26202632

26212633
rval = qla2x00_start_sp(sp);
26222634
if (rval != QLA_SUCCESS) {
@@ -2676,7 +2688,8 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
26762688
ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3073,
26772689
"PLOGI ELS IOCB:\n");
26782690
ql_dump_buffer(ql_log_info, vha, 0x0109,
2679-
(uint8_t *)els_iocb, 0x70);
2691+
(uint8_t *)els_iocb,
2692+
sizeof(*els_iocb));
26802693
} else {
26812694
els_iocb->control_flags = 1 << 13;
26822695
els_iocb->tx_byte_count =
@@ -2688,6 +2701,11 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
26882701
els_iocb->rx_byte_count = 0;
26892702
els_iocb->rx_address = 0;
26902703
els_iocb->rx_len = 0;
2704+
ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3076,
2705+
"LOGO ELS IOCB:");
2706+
ql_dump_buffer(ql_log_info, vha, 0x010b,
2707+
els_iocb,
2708+
sizeof(*els_iocb));
26912709
}
26922710

26932711
sp->vha->qla_stats.control_requests++;
@@ -2934,7 +2952,8 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
29342952

29352953
ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x3073, "PLOGI buffer:\n");
29362954
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x0109,
2937-
(uint8_t *)elsio->u.els_plogi.els_plogi_pyld, 0x70);
2955+
(uint8_t *)elsio->u.els_plogi.els_plogi_pyld,
2956+
sizeof(*elsio->u.els_plogi.els_plogi_pyld));
29382957

29392958
rval = qla2x00_start_sp(sp);
29402959
if (rval != QLA_SUCCESS) {

0 commit comments

Comments
 (0)