@@ -924,7 +924,8 @@ static struct qla_tgt_sess *qlt_create_sess(
}
}
- kref_get(&sess->sess_kref);
+ ha->tgt.tgt_ops->get_sess(sess);
+
ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id,
(fcport->flags & FCF_CONF_COMP_SUPPORTED));
@@ -999,7 +1000,7 @@ static struct qla_tgt_sess *qlt_create_sess(
* Take an extra reference to ->sess_kref here to handle qla_tgt_sess
* access across ->tgt.sess_lock reaquire.
*/
- kref_get(&sess->sess_kref);
+ ha->tgt.tgt_ops->get_sess(sess);
}
return sess;
@@ -1043,7 +1044,7 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, fc_port_t *fcport)
spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
return;
} else {
- kref_get(&sess->sess_kref);
+ ha->tgt.tgt_ops->get_sess(sess);
if (sess->deleted) {
qlt_undelete_sess(sess);
@@ -3978,7 +3979,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha,
/*
* Do kref_get() before returning + dropping qla_hw_data->hardware_lock.
*/
- kref_get(&sess->sess_kref);
+ ha->tgt.tgt_ops->get_sess(sess);
cmd = qlt_get_tag(vha, sess, atio);
if (!cmd) {
@@ -5814,7 +5815,7 @@ static void qlt_abort_work(struct qla_tgt *tgt,
goto out_term2;
}
- kref_get(&sess->sess_kref);
+ ha->tgt.tgt_ops->get_sess(sess);
}
spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -5878,7 +5879,7 @@ static void qlt_tmr_work(struct qla_tgt *tgt,
goto out_term;
}
- kref_get(&sess->sess_kref);
+ ha->tgt.tgt_ops->get_sess(sess);
}
iocb = a;
@@ -733,6 +733,7 @@ struct qla_tgt_func_tmpl {
int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *,
struct qla_tgt_sess *);
void (*update_sess)(struct qla_tgt_sess *, port_id_t, uint16_t, bool);
+ void (*get_sess)(struct qla_tgt_sess *);
struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *,
const uint16_t);
struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *,
@@ -932,7 +933,7 @@ struct qla_tgt_sess {
int generation;
- struct se_session *se_sess;
+ void *se_sess;
struct kref sess_kref;
struct scsi_qla_host *vha;
struct qla_tgt *tgt;
@@ -321,6 +321,14 @@ static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd)
return target_put_sess_cmd(se_cmd);
}
+static void tcm_qla2xxx_get_sess(struct qla_tgt_sess *sess)
+{
+ if (!sess)
+ return;
+
+ kref_get(&sess->sess_kref);
+}
+
/* tcm_qla2xxx_release_cmd - Callback from TCM Core to release underlying
* fabric descriptor @se_cmd command to release
*/
@@ -808,7 +816,8 @@ static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *,
*/
static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct qla_tgt_sess *sess)
{
- struct se_node_acl *se_nacl = sess->se_sess->se_node_acl;
+ struct se_node_acl *se_nacl =
+ ((struct se_session *)sess->se_sess)->se_node_acl;
struct se_portal_group *se_tpg = se_nacl->se_tpg;
struct se_wwn *se_wwn = se_tpg->se_tpg_wwn;
struct tcm_qla2xxx_lport *lport = container_of(se_wwn,
@@ -1574,12 +1583,12 @@ static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id,
struct qla_hw_data *ha = tgt->ha;
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
struct tcm_qla2xxx_lport *lport = vha->vha_tgt.target_lport_ptr;
- struct se_node_acl *se_nacl = sess->se_sess->se_node_acl;
+ struct se_node_acl *se_nacl =
+ ((struct se_session *)sess->se_sess)->se_node_acl;
struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl,
struct tcm_qla2xxx_nacl, se_node_acl);
u32 key;
-
if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24)
pr_info("Updating session %p from port %8phC loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n",
sess, sess->port_name,
@@ -1652,6 +1661,7 @@ static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id,
.free_mcmd = tcm_qla2xxx_free_mcmd,
.free_session = tcm_qla2xxx_free_session,
.update_sess = tcm_qla2xxx_update_sess,
+ .get_sess = tcm_qla2xxx_get_sess,
.check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl,
.find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id,
.find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id,