scsi: qla2xxx: Fix unload when NVMe devices are configured

This patch fixes driver unload issue when FC-NVMe devices are configured.

Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Himanshu Madhani 2019-02-15 14:37:14 -08:00 committed by Martin K. Petersen
parent 03aaa89fe4
commit e476fe8af5
1 changed files with 10 additions and 12 deletions

View File

@ -607,6 +607,7 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work)
struct fc_port *fcport = container_of(work, struct fc_port, struct fc_port *fcport = container_of(work, struct fc_port,
nvme_del_work); nvme_del_work);
struct qla_nvme_rport *qla_rport, *trport; struct qla_nvme_rport *qla_rport, *trport;
scsi_qla_host_t *base_vha;
if (!IS_ENABLED(CONFIG_NVME_FC)) if (!IS_ENABLED(CONFIG_NVME_FC))
return; return;
@ -614,6 +615,15 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work)
ql_log(ql_log_warn, NULL, 0x2112, ql_log(ql_log_warn, NULL, 0x2112,
"%s: unregister remoteport on %p\n",__func__, fcport); "%s: unregister remoteport on %p\n",__func__, fcport);
base_vha = pci_get_drvdata(fcport->vha->hw->pdev);
if (test_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags)) {
ql_dbg(ql_dbg_disc, fcport->vha, 0x2114,
"%s: Notify FC-NVMe transport, set devloss=0\n",
__func__);
nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0);
}
list_for_each_entry_safe(qla_rport, trport, list_for_each_entry_safe(qla_rport, trport,
&fcport->vha->nvme_rport_list, list) { &fcport->vha->nvme_rport_list, list) {
if (qla_rport->fcport == fcport) { if (qla_rport->fcport == fcport) {
@ -630,23 +640,11 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work)
void qla_nvme_delete(struct scsi_qla_host *vha) void qla_nvme_delete(struct scsi_qla_host *vha)
{ {
struct qla_nvme_rport *qla_rport, *trport;
fc_port_t *fcport;
int nv_ret; int nv_ret;
if (!IS_ENABLED(CONFIG_NVME_FC)) if (!IS_ENABLED(CONFIG_NVME_FC))
return; return;
list_for_each_entry_safe(qla_rport, trport,
&vha->nvme_rport_list, list) {
fcport = qla_rport->fcport;
ql_log(ql_log_info, fcport->vha, 0x2114, "%s: fcport=%p\n",
__func__, fcport);
nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0);
}
if (vha->nvme_local_port) { if (vha->nvme_local_port) {
init_completion(&vha->nvme_del_done); init_completion(&vha->nvme_del_done);
ql_log(ql_log_info, vha, 0x2116, ql_log(ql_log_info, vha, 0x2116,