Skip to content

Commit 2eb9238

Browse files
Quinn Tranmartinkpetersen
authored andcommitted
scsi: qla2xxx: on session delete, return nvme cmd
- on session delete or chip reset, reject all NVME commands. - on NVME command submission error, free srb resource. Signed-off-by: Quinn Tran <[email protected]> Signed-off-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6a81533 commit 2eb9238

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

drivers/scsi/qla2xxx/qla_nvme.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,16 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
239239
struct qla_hw_data *ha;
240240
srb_t *sp;
241241

242+
243+
if (!fcport || (fcport && fcport->deleted))
244+
return rval;
245+
242246
vha = fcport->vha;
243247
ha = vha->hw;
248+
249+
if (!ha->flags.fw_started)
250+
return rval;
251+
244252
/* Alloc SRB structure */
245253
sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC);
246254
if (!sp)
@@ -272,6 +280,7 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
272280
"qla2x00_start_sp failed = %d\n", rval);
273281
atomic_dec(&sp->ref_count);
274282
wake_up(&sp->nvme_ls_waitq);
283+
sp->free(sp);
275284
return rval;
276285
}
277286

@@ -486,11 +495,11 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
486495

487496
fcport = qla_rport->fcport;
488497

489-
vha = fcport->vha;
490-
491-
if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))
498+
if (!qpair || !fcport || (qpair && !qpair->fw_started) ||
499+
(fcport && fcport->deleted))
492500
return rval;
493501

502+
vha = fcport->vha;
494503
/*
495504
* If we know the dev is going away while the transport is still sending
496505
* IO's return busy back to stall the IO Q. This happens when the
@@ -523,6 +532,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
523532
"qla2x00_start_nvme_mq failed = %d\n", rval);
524533
atomic_dec(&sp->ref_count);
525534
wake_up(&sp->nvme_ls_waitq);
535+
sp->free(sp);
526536
}
527537

528538
return rval;
@@ -549,14 +559,13 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport)
549559

550560
complete(&fcport->nvme_del_done);
551561

552-
if (!test_bit(UNLOADING, &fcport->vha->dpc_flags)) {
553-
INIT_WORK(&fcport->free_work, qlt_free_session_done);
554-
schedule_work(&fcport->free_work);
555-
}
562+
INIT_WORK(&fcport->free_work, qlt_free_session_done);
563+
schedule_work(&fcport->free_work);
556564

557565
fcport->nvme_flag &= ~NVME_FLAG_DELETING;
558566
ql_log(ql_log_info, fcport->vha, 0x2110,
559-
"remoteport_delete of %p completed.\n", fcport);
567+
"remoteport_delete of %p %8phN completed.\n",
568+
fcport, fcport->port_name);
560569
}
561570

562571
static struct nvme_fc_port_template qla_nvme_fc_transport = {
@@ -588,7 +597,8 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work)
588597
return;
589598

590599
ql_log(ql_log_warn, NULL, 0x2112,
591-
"%s: unregister remoteport on %p\n",__func__, fcport);
600+
"%s: unregister remoteport on %p %8phN\n",
601+
__func__, fcport, fcport->port_name);
592602

593603
nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0);
594604
init_completion(&fcport->nvme_del_done);

0 commit comments

Comments
 (0)