Skip to content

Commit a084fd6

Browse files
Quinn Tranmartinkpetersen
authored andcommitted
scsi: qla2xxx: Fix re-login for Nport Handle in use
When NPort Handle is in use, driver needs to mark the handle as used and pick another. Instead, the code clears the handle and re-pick the same handle. Fixes: 726b854 ("qla2xxx: Add framework for async fabric discovery") Cc: <stable@vger.kernel.org> # 4.10+ Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d68b850 commit a084fd6

File tree

3 files changed

+51
-14
lines changed

3 files changed

+51
-14
lines changed

drivers/scsi/qla2xxx/qla_gs.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,7 +2833,7 @@ void qla24xx_handle_gidpn_event(scsi_qla_host_t *vha, struct event_arg *ea)
28332833
}
28342834
} else { /* fcport->d_id.b24 != ea->id.b24 */
28352835
fcport->d_id.b24 = ea->id.b24;
2836-
if (fcport->deleted == QLA_SESS_DELETED) {
2836+
if (fcport->deleted != QLA_SESS_DELETED) {
28372837
ql_dbg(ql_dbg_disc, vha, 0x2021,
28382838
"%s %d %8phC post del sess\n",
28392839
__func__, __LINE__, fcport->port_name);
@@ -3206,10 +3206,16 @@ static void qla2x00_async_gpnid_sp_done(void *s, int res)
32063206
struct event_arg ea;
32073207
struct qla_work_evt *e;
32083208

3209-
ql_dbg(ql_dbg_disc, vha, 0x2066,
3210-
"Async done-%s res %x ID %3phC. %8phC\n",
3211-
sp->name, res, ct_req->req.port_id.port_id,
3212-
ct_rsp->rsp.gpn_id.port_name);
3209+
if (res)
3210+
ql_dbg(ql_dbg_disc, vha, 0x2066,
3211+
"Async done-%s fail res %x ID %3phC. %8phC\n",
3212+
sp->name, res, ct_req->req.port_id.port_id,
3213+
ct_rsp->rsp.gpn_id.port_name);
3214+
else
3215+
ql_dbg(ql_dbg_disc, vha, 0x2066,
3216+
"Async done-%s good ID %3phC. %8phC\n",
3217+
sp->name, ct_req->req.port_id.port_id,
3218+
ct_rsp->rsp.gpn_id.port_name);
32133219

32143220
if (res) {
32153221
sp->free(sp);

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,8 @@ static void
14521452
qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
14531453
{
14541454
port_id_t cid; /* conflict Nport id */
1455+
u16 lid;
1456+
struct fc_port *conflict_fcport;
14551457

14561458
switch (ea->data[0]) {
14571459
case MBS_COMMAND_COMPLETE:
@@ -1467,8 +1469,12 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
14671469
qla24xx_post_prli_work(vha, ea->fcport);
14681470
} else {
14691471
ql_dbg(ql_dbg_disc, vha, 0x20ea,
1470-
"%s %d %8phC post gpdb\n",
1471-
__func__, __LINE__, ea->fcport->port_name);
1472+
"%s %d %8phC LoopID 0x%x in use with %06x. post gnl\n",
1473+
__func__, __LINE__, ea->fcport->port_name,
1474+
ea->fcport->loop_id, ea->fcport->d_id.b24);
1475+
1476+
set_bit(ea->fcport->loop_id, vha->hw->loop_id_map);
1477+
ea->fcport->loop_id = FC_NO_LOOP_ID;
14721478
ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset;
14731479
ea->fcport->logout_on_delete = 1;
14741480
ea->fcport->send_els_logo = 0;
@@ -1513,8 +1519,38 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
15131519
ea->fcport->d_id.b.domain, ea->fcport->d_id.b.area,
15141520
ea->fcport->d_id.b.al_pa);
15151521

1516-
qla2x00_clear_loop_id(ea->fcport);
1517-
qla24xx_post_gidpn_work(vha, ea->fcport);
1522+
lid = ea->iop[1] & 0xffff;
1523+
qlt_find_sess_invalidate_other(vha,
1524+
wwn_to_u64(ea->fcport->port_name),
1525+
ea->fcport->d_id, lid, &conflict_fcport);
1526+
1527+
if (conflict_fcport) {
1528+
/*
1529+
* Another fcport share the same loop_id/nport id.
1530+
* Conflict fcport needs to finish cleanup before this
1531+
* fcport can proceed to login.
1532+
*/
1533+
conflict_fcport->conflict = ea->fcport;
1534+
ea->fcport->login_pause = 1;
1535+
1536+
ql_dbg(ql_dbg_disc, vha, 0x20ed,
1537+
"%s %d %8phC NPortId %06x inuse with loopid 0x%x. post gidpn\n",
1538+
__func__, __LINE__, ea->fcport->port_name,
1539+
ea->fcport->d_id.b24, lid);
1540+
qla2x00_clear_loop_id(ea->fcport);
1541+
qla24xx_post_gidpn_work(vha, ea->fcport);
1542+
} else {
1543+
ql_dbg(ql_dbg_disc, vha, 0x20ed,
1544+
"%s %d %8phC NPortId %06x inuse with loopid 0x%x. sched delete\n",
1545+
__func__, __LINE__, ea->fcport->port_name,
1546+
ea->fcport->d_id.b24, lid);
1547+
1548+
qla2x00_clear_loop_id(ea->fcport);
1549+
set_bit(lid, vha->hw->loop_id_map);
1550+
ea->fcport->loop_id = lid;
1551+
ea->fcport->keep_nport_handle = 0;
1552+
qlt_schedule_sess_for_deletion(ea->fcport, false);
1553+
}
15181554
break;
15191555
}
15201556
return;

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,7 +2369,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
23692369
int res = 0;
23702370
uint16_t state_flags = 0;
23712371
uint16_t retry_delay = 0;
2372-
uint8_t no_logout = 0;
23732372

23742373
sts = (sts_entry_t *) pkt;
23752374
sts24 = (struct sts_entry_24xx *) pkt;
@@ -2640,7 +2639,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
26402639
break;
26412640

26422641
case CS_PORT_LOGGED_OUT:
2643-
no_logout = 1;
26442642
case CS_PORT_CONFIG_CHG:
26452643
case CS_PORT_BUSY:
26462644
case CS_INCOMPLETE:
@@ -2671,9 +2669,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
26712669
port_state_str[atomic_read(&fcport->state)],
26722670
comp_status);
26732671

2674-
if (no_logout)
2675-
fcport->logout_on_delete = 0;
2676-
26772672
qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1);
26782673
qlt_schedule_sess_for_deletion_lock(fcport);
26792674
}

0 commit comments

Comments
 (0)