Skip to content

Commit 881eb86

Browse files
Quinn Tranmartinkpetersen
authored andcommitted
scsi: qla2xxx: Fix N2N stuck connection
Disk failed to rediscover after chip reset error injection. The chip reset happens at the time when a PLOGI is being sent. This causes a flag to be left on which blocks the retry. Clear the blocking flag. Cc: [email protected] Signed-off-by: Quinn Tran <[email protected]> Signed-off-by: Nilesh Javali <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4895009 commit 881eb86

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *);
4444
extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *);
4545

4646
extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t);
47-
extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *, bool);
47+
extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *);
4848
extern void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha,
4949
struct els_plogi *els_plogi);
5050

drivers/scsi/qla2xxx/qla_iocb.c

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,7 +3041,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
30413041

30423042
int
30433043
qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
3044-
fc_port_t *fcport, bool wait)
3044+
fc_port_t *fcport)
30453045
{
30463046
srb_t *sp;
30473047
struct srb_iocb *elsio = NULL;
@@ -3056,8 +3056,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
30563056
if (!sp) {
30573057
ql_log(ql_log_info, vha, 0x70e6,
30583058
"SRB allocation failed\n");
3059-
fcport->flags &= ~FCF_ASYNC_ACTIVE;
3060-
return -ENOMEM;
3059+
goto done;
30613060
}
30623061

30633062
fcport->flags |= FCF_ASYNC_SENT;
@@ -3066,9 +3065,6 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
30663065
ql_dbg(ql_dbg_io, vha, 0x3073,
30673066
"%s Enter: PLOGI portid=%06x\n", __func__, fcport->d_id.b24);
30683067

3069-
if (wait)
3070-
sp->flags = SRB_WAKEUP_ON_COMP;
3071-
30723068
sp->type = SRB_ELS_DCMD;
30733069
sp->name = "ELS_DCMD";
30743070
sp->fcport = fcport;
@@ -3084,7 +3080,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
30843080

30853081
if (!elsio->u.els_plogi.els_plogi_pyld) {
30863082
rval = QLA_FUNCTION_FAILED;
3087-
goto out;
3083+
goto done_free_sp;
30883084
}
30893085

30903086
resp_ptr = elsio->u.els_plogi.els_resp_pyld =
@@ -3093,7 +3089,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
30933089

30943090
if (!elsio->u.els_plogi.els_resp_pyld) {
30953091
rval = QLA_FUNCTION_FAILED;
3096-
goto out;
3092+
goto done_free_sp;
30973093
}
30983094

30993095
ql_dbg(ql_dbg_io, vha, 0x3073, "PLOGI %p %p\n", ptr, resp_ptr);
@@ -3109,7 +3105,6 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
31093105

31103106
if (els_opcode == ELS_DCMD_PLOGI && DBELL_ACTIVE(vha)) {
31113107
struct fc_els_flogi *p = ptr;
3112-
31133108
p->fl_csp.sp_features |= cpu_to_be16(FC_SP_FT_SEC);
31143109
}
31153110

@@ -3118,32 +3113,27 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
31183113
(uint8_t *)elsio->u.els_plogi.els_plogi_pyld,
31193114
sizeof(*elsio->u.els_plogi.els_plogi_pyld));
31203115

3121-
init_completion(&elsio->u.els_plogi.comp);
31223116
rval = qla2x00_start_sp(sp);
31233117
if (rval != QLA_SUCCESS) {
3124-
rval = QLA_FUNCTION_FAILED;
3118+
fcport->flags |= FCF_LOGIN_NEEDED;
3119+
set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
3120+
goto done_free_sp;
31253121
} else {
31263122
ql_dbg(ql_dbg_disc, vha, 0x3074,
31273123
"%s PLOGI sent, hdl=%x, loopid=%x, to port_id %06x from port_id %06x\n",
31283124
sp->name, sp->handle, fcport->loop_id,
31293125
fcport->d_id.b24, vha->d_id.b24);
31303126
}
31313127

3132-
if (wait) {
3133-
wait_for_completion(&elsio->u.els_plogi.comp);
3134-
3135-
if (elsio->u.els_plogi.comp_status != CS_COMPLETE)
3136-
rval = QLA_FUNCTION_FAILED;
3137-
} else {
3138-
goto done;
3139-
}
3128+
return rval;
31403129

3141-
out:
3142-
fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
3130+
done_free_sp:
31433131
qla2x00_els_dcmd2_free(vha, &elsio->u.els_plogi);
31443132
/* ref: INIT */
31453133
kref_put(&sp->cmd_kref, qla2x00_sp_release);
31463134
done:
3135+
fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
3136+
qla2x00_set_fcport_disc_state(fcport, DSC_DELETED);
31473137
return rval;
31483138
}
31493139

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5583,7 +5583,7 @@ qla2x00_do_work(struct scsi_qla_host *vha)
55835583
break;
55845584
case QLA_EVT_ELS_PLOGI:
55855585
qla24xx_els_dcmd2_iocb(vha, ELS_DCMD_PLOGI,
5586-
e->u.fcport.fcport, false);
5586+
e->u.fcport.fcport);
55875587
break;
55885588
case QLA_EVT_SA_REPLACE:
55895589
rc = qla24xx_issue_sa_replace_iocb(vha, e);

0 commit comments

Comments
 (0)