Skip to content

Commit fa83e65

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: qla2xxx: ensure async flags are reset correctly
The fcport flags FCF_ASYNC_ACTIVE and FCF_ASYNC_SENT are used to throttle the state machine, so we need to ensure to always set and unset them correctly. Not doing so will lead to the state machine getting confused and no login attempt into remote ports. Cc: Quinn Tran <quinn.tran@cavium.com> Cc: Himanshu Madhani <himanshu.madhani@cavium.com> Fixes: 3dbec59 ("scsi: qla2xxx: Prevent multiple active discovery commands per session") Signed-off-by: Hannes Reinecke <hare@suse.com> Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 07ea4b6 commit fa83e65

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

drivers/scsi/qla2xxx/qla_gs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,6 +3179,7 @@ int qla24xx_async_gidpn(scsi_qla_host_t *vha, fc_port_t *fcport)
31793179
sp->free(sp);
31803180
fcport->flags &= ~FCF_ASYNC_SENT;
31813181
done:
3182+
fcport->flags &= ~FCF_ASYNC_ACTIVE;
31823183
return rval;
31833184
}
31843185

@@ -3370,6 +3371,7 @@ int qla24xx_async_gpsc(scsi_qla_host_t *vha, fc_port_t *fcport)
33703371
sp->free(sp);
33713372
fcport->flags &= ~FCF_ASYNC_SENT;
33723373
done:
3374+
fcport->flags &= ~FCF_ASYNC_ACTIVE;
33733375
return rval;
33743376
}
33753377

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
213213
sp->free(sp);
214214
fcport->flags &= ~FCF_ASYNC_SENT;
215215
done:
216+
fcport->flags &= ~FCF_ASYNC_ACTIVE;
216217
return rval;
217218
}
218219

@@ -263,14 +264,15 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport)
263264
done_free_sp:
264265
sp->free(sp);
265266
done:
266-
fcport->flags &= ~FCF_ASYNC_SENT;
267+
fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
267268
return rval;
268269
}
269270

270271
void
271272
qla2x00_async_prlo_done(struct scsi_qla_host *vha, fc_port_t *fcport,
272273
uint16_t *data)
273274
{
275+
fcport->flags &= ~FCF_ASYNC_ACTIVE;
274276
/* Don't re-login in target mode */
275277
if (!fcport->tgt_session)
276278
qla2x00_mark_device_lost(vha, fcport, 1, 0);
@@ -284,6 +286,7 @@ qla2x00_async_prlo_sp_done(void *s, int res)
284286
struct srb_iocb *lio = &sp->u.iocb_cmd;
285287
struct scsi_qla_host *vha = sp->vha;
286288

289+
sp->fcport->flags &= ~FCF_ASYNC_ACTIVE;
287290
if (!test_bit(UNLOADING, &vha->dpc_flags))
288291
qla2x00_post_async_prlo_done_work(sp->fcport->vha, sp->fcport,
289292
lio->u.logio.data);
@@ -322,6 +325,7 @@ qla2x00_async_prlo(struct scsi_qla_host *vha, fc_port_t *fcport)
322325
done_free_sp:
323326
sp->free(sp);
324327
done:
328+
fcport->flags &= ~FCF_ASYNC_ACTIVE;
325329
return rval;
326330
}
327331

@@ -375,6 +379,8 @@ qla2x00_async_adisc_sp_done(void *ptr, int res)
375379
"Async done-%s res %x %8phC\n",
376380
sp->name, res, sp->fcport->port_name);
377381

382+
sp->fcport->flags &= ~FCF_ASYNC_SENT;
383+
378384
memset(&ea, 0, sizeof(ea));
379385
ea.event = FCME_ADISC_DONE;
380386
ea.rc = res;
@@ -425,7 +431,7 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport,
425431
done_free_sp:
426432
sp->free(sp);
427433
done:
428-
fcport->flags &= ~FCF_ASYNC_SENT;
434+
fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
429435
qla2x00_post_async_adisc_work(vha, fcport, data);
430436
return rval;
431437
}
@@ -1799,21 +1805,22 @@ qla2x00_async_logout_done(struct scsi_qla_host *vha, fc_port_t *fcport,
17991805
qla2x00_mark_device_lost(vha, fcport, 1, 0);
18001806
qlt_logo_completion_handler(fcport, data[0]);
18011807
fcport->login_gen++;
1808+
fcport->flags &= ~FCF_ASYNC_ACTIVE;
18021809
return;
18031810
}
18041811

18051812
void
18061813
qla2x00_async_adisc_done(struct scsi_qla_host *vha, fc_port_t *fcport,
18071814
uint16_t *data)
18081815
{
1816+
fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
18091817
if (data[0] == MBS_COMMAND_COMPLETE) {
18101818
qla2x00_update_fcport(vha, fcport);
18111819

18121820
return;
18131821
}
18141822

18151823
/* Retry login. */
1816-
fcport->flags &= ~FCF_ASYNC_SENT;
18171824
if (data[1] & QLA_LOGIO_LOGIN_RETRIED)
18181825
set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
18191826
else

0 commit comments

Comments
 (0)