Skip to content

Commit baf23ed

Browse files
Quinn Tranmartinkpetersen
authored andcommitted
scsi: qla2xxx: move IO flush to the front of NVME rport unregistration
On session deletion, current qla code would unregister an NVMe session before flushing IOs. This patch would move the unregistration of NVMe session after IO flush. This way FC-NVMe layer would not have to wait for stuck IOs. In addition, qla2xxx would stop accepting new IOs during session deletion. Signed-off-by: Quinn Tran <[email protected]> Signed-off-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4c2a2d0 commit baf23ed

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2339,7 +2339,6 @@ typedef struct fc_port {
23392339
unsigned int id_changed:1;
23402340
unsigned int scan_needed:1;
23412341

2342-
struct work_struct nvme_del_work;
23432342
struct completion nvme_del_done;
23442343
uint32_t nvme_prli_service_param;
23452344
#define NVME_PRLI_SP_CONF BIT_7

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,4 +908,6 @@ void qlt_clr_qp_table(struct scsi_qla_host *vha);
908908
void qlt_set_mode(struct scsi_qla_host *);
909909
int qla2x00_set_data_rate(scsi_qla_host_t *vha, uint16_t mode);
910910

911+
/* nvme.c */
912+
void qla_nvme_unregister_remote_port(struct fc_port *fcport);
911913
#endif /* _QLA_GBL_H */

drivers/scsi/qla2xxx/qla_nvme.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
static struct nvme_fc_port_template qla_nvme_fc_transport;
1414

15-
static void qla_nvme_unregister_remote_port(struct work_struct *);
16-
1715
int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport)
1816
{
1917
struct qla_nvme_rport *rport;
@@ -38,7 +36,6 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport)
3836
(fcport->nvme_flag & NVME_FLAG_REGISTERED))
3937
return 0;
4038

41-
INIT_WORK(&fcport->nvme_del_work, qla_nvme_unregister_remote_port);
4239
fcport->nvme_flag &= ~NVME_FLAG_RESETTING;
4340

4441
memset(&req, 0, sizeof(struct nvme_fc_port_info));
@@ -619,16 +616,11 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport)
619616
fcport = qla_rport->fcport;
620617
fcport->nvme_remote_port = NULL;
621618
fcport->nvme_flag &= ~NVME_FLAG_REGISTERED;
622-
623-
complete(&fcport->nvme_del_done);
624-
625-
INIT_WORK(&fcport->free_work, qlt_free_session_done);
626-
schedule_work(&fcport->free_work);
627-
628619
fcport->nvme_flag &= ~NVME_FLAG_DELETING;
629620
ql_log(ql_log_info, fcport->vha, 0x2110,
630621
"remoteport_delete of %p %8phN completed.\n",
631622
fcport, fcport->port_name);
623+
complete(&fcport->nvme_del_done);
632624
}
633625

634626
static struct nvme_fc_port_template qla_nvme_fc_transport = {
@@ -650,10 +642,8 @@ static struct nvme_fc_port_template qla_nvme_fc_transport = {
650642
.fcprqst_priv_sz = sizeof(struct nvme_private),
651643
};
652644

653-
static void qla_nvme_unregister_remote_port(struct work_struct *work)
645+
void qla_nvme_unregister_remote_port(struct fc_port *fcport)
654646
{
655-
struct fc_port *fcport = container_of(work, struct fc_port,
656-
nvme_del_work);
657647
int ret;
658648

659649
if (!IS_ENABLED(CONFIG_NVME_FC))

drivers/scsi/qla2xxx/qla_target.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,12 @@ void qlt_free_session_done(struct work_struct *work)
10131013
else
10141014
logout_started = true;
10151015
}
1016+
} /* if sess->logout_on_delete */
1017+
1018+
if (sess->nvme_flag & NVME_FLAG_REGISTERED &&
1019+
!(sess->nvme_flag & NVME_FLAG_DELETING)) {
1020+
sess->nvme_flag |= NVME_FLAG_DELETING;
1021+
qla_nvme_unregister_remote_port(sess);
10161022
}
10171023
}
10181024

@@ -1164,14 +1170,8 @@ void qlt_unreg_sess(struct fc_port *sess)
11641170
sess->last_rscn_gen = sess->rscn_gen;
11651171
sess->last_login_gen = sess->login_gen;
11661172

1167-
if (sess->nvme_flag & NVME_FLAG_REGISTERED &&
1168-
!(sess->nvme_flag & NVME_FLAG_DELETING)) {
1169-
sess->nvme_flag |= NVME_FLAG_DELETING;
1170-
schedule_work(&sess->nvme_del_work);
1171-
} else {
1172-
INIT_WORK(&sess->free_work, qlt_free_session_done);
1173-
schedule_work(&sess->free_work);
1174-
}
1173+
INIT_WORK(&sess->free_work, qlt_free_session_done);
1174+
schedule_work(&sess->free_work);
11751175
}
11761176
EXPORT_SYMBOL(qlt_unreg_sess);
11771177

0 commit comments

Comments
 (0)