Skip to content

Commit 7d64c39

Browse files
committed
scsi: qla2xxx: Fix re-login for Nport Handle in use
(bsc#1043726,FATE#324770). suse-commit: 61a3218debeac9066a0db9174a625ee6186d3761
1 parent 62f02d3 commit 7d64c39

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
@@ -1453,6 +1453,8 @@ static void
14531453
qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
14541454
{
14551455
port_id_t cid; /* conflict Nport id */
1456+
u16 lid;
1457+
struct fc_port *conflict_fcport;
14561458

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

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

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,7 +2373,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
23732373
int res = 0;
23742374
uint16_t state_flags = 0;
23752375
uint16_t retry_delay = 0;
2376-
uint8_t no_logout = 0;
23772376

23782377
sts = (sts_entry_t *) pkt;
23792378
sts24 = (struct sts_entry_24xx *) pkt;
@@ -2644,7 +2643,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
26442643
break;
26452644

26462645
case CS_PORT_LOGGED_OUT:
2647-
no_logout = 1;
26482646
case CS_PORT_CONFIG_CHG:
26492647
case CS_PORT_BUSY:
26502648
case CS_INCOMPLETE:
@@ -2675,9 +2673,6 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
26752673
port_state_str[atomic_read(&fcport->state)],
26762674
comp_status);
26772675

2678-
if (no_logout)
2679-
fcport->logout_on_delete = 0;
2680-
26812676
qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1);
26822677
qlt_schedule_sess_for_deletion_lock(fcport);
26832678
}

0 commit comments

Comments
 (0)