scsi: qla2xxx: Cleanup NPIV host in target mode during config teardown
When we tear down the NPIV host configuration in target mode, the qla_tgt struct was left dangling on the global list. This patch cleans up link list and frees memory. Signed-off-by: Quinn Tran <quinn.tran@cavium.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
1f4c7c380b
commit
bdbe24de28
|
@ -1528,6 +1528,7 @@ static void qlt_release(struct qla_tgt *tgt)
|
||||||
u64 key = 0;
|
u64 key = 0;
|
||||||
u16 i;
|
u16 i;
|
||||||
struct qla_qpair_hint *h;
|
struct qla_qpair_hint *h;
|
||||||
|
struct qla_hw_data *ha = vha->hw;
|
||||||
|
|
||||||
if ((vha->vha_tgt.qla_tgt != NULL) && !tgt->tgt_stop &&
|
if ((vha->vha_tgt.qla_tgt != NULL) && !tgt->tgt_stop &&
|
||||||
!tgt->tgt_stopped)
|
!tgt->tgt_stopped)
|
||||||
|
@ -1548,12 +1549,18 @@ static void qlt_release(struct qla_tgt *tgt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
kfree(tgt->qphints);
|
kfree(tgt->qphints);
|
||||||
|
mutex_lock(&qla_tgt_mutex);
|
||||||
|
list_del(&vha->vha_tgt.qla_tgt->tgt_list_entry);
|
||||||
|
mutex_unlock(&qla_tgt_mutex);
|
||||||
|
|
||||||
btree_for_each_safe64(&tgt->lun_qpair_map, key, node)
|
btree_for_each_safe64(&tgt->lun_qpair_map, key, node)
|
||||||
btree_remove64(&tgt->lun_qpair_map, key);
|
btree_remove64(&tgt->lun_qpair_map, key);
|
||||||
|
|
||||||
btree_destroy64(&tgt->lun_qpair_map);
|
btree_destroy64(&tgt->lun_qpair_map);
|
||||||
|
|
||||||
|
if (ha->tgt.tgt_ops && ha->tgt.tgt_ops->remove_target)
|
||||||
|
ha->tgt.tgt_ops->remove_target(vha);
|
||||||
|
|
||||||
vha->vha_tgt.qla_tgt = NULL;
|
vha->vha_tgt.qla_tgt = NULL;
|
||||||
|
|
||||||
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00d,
|
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00d,
|
||||||
|
@ -6175,10 +6182,6 @@ int qlt_remove_target(struct qla_hw_data *ha, struct scsi_qla_host *vha)
|
||||||
/* free left over qfull cmds */
|
/* free left over qfull cmds */
|
||||||
qlt_init_term_exchange(vha);
|
qlt_init_term_exchange(vha);
|
||||||
|
|
||||||
mutex_lock(&qla_tgt_mutex);
|
|
||||||
list_del(&vha->vha_tgt.qla_tgt->tgt_list_entry);
|
|
||||||
mutex_unlock(&qla_tgt_mutex);
|
|
||||||
|
|
||||||
ql_dbg(ql_dbg_tgt, vha, 0xe03c, "Unregistering target for host %ld(%p)",
|
ql_dbg(ql_dbg_tgt, vha, 0xe03c, "Unregistering target for host %ld(%p)",
|
||||||
vha->host_no, ha);
|
vha->host_no, ha);
|
||||||
qlt_release(vha->vha_tgt.qla_tgt);
|
qlt_release(vha->vha_tgt.qla_tgt);
|
||||||
|
|
|
@ -705,6 +705,7 @@ struct qla_tgt_func_tmpl {
|
||||||
int (*get_dif_tags)(struct qla_tgt_cmd *cmd, uint16_t *pfw_prot_opts);
|
int (*get_dif_tags)(struct qla_tgt_cmd *cmd, uint16_t *pfw_prot_opts);
|
||||||
int (*chk_dif_tags)(uint32_t tag);
|
int (*chk_dif_tags)(uint32_t tag);
|
||||||
void (*add_target)(struct scsi_qla_host *);
|
void (*add_target)(struct scsi_qla_host *);
|
||||||
|
void (*remove_target)(struct scsi_qla_host *);
|
||||||
};
|
};
|
||||||
|
|
||||||
int qla2x00_wait_for_hba_online(struct scsi_qla_host *);
|
int qla2x00_wait_for_hba_online(struct scsi_qla_host *);
|
||||||
|
|
Loading…
Reference in New Issue