aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/tcm_qla2xxx.c
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2012-05-18 16:58:23 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-06-12 22:37:47 -0400
commitaaf68b753313f1e67fd2e8996e32ab2813f441fa (patch)
tree6cf09eb22c16e668f976a2a885271395d6b1923a /drivers/scsi/qla2xxx/tcm_qla2xxx.c
parent4149268e7816d719b0fde8e89aaa6db8c168fc43 (diff)
tcm_qla2xxx: Convert to TFO->put_session() usage
This patch converts tcm_qla2xxx code to use an internal kref_put() for se_session->sess_kref in order to ensure that qla_hw_data->hardware_lock can be held while calling qlt_unreg_sess() for the final put. Signed-off-by: Joern Engel <joern@logfs.org> Cc: Roland Dreier <roland@purestorage.com> Cc: Arun Easi <arun.easi@qlogic.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/scsi/qla2xxx/tcm_qla2xxx.c')
-rw-r--r--drivers/scsi/qla2xxx/tcm_qla2xxx.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 436598f57404..3cee5b67d65b 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -844,9 +844,28 @@ static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct qla_tgt_sess *sess)
844 se_nacl, nacl->nport_wwnn, nacl->nport_id); 844 se_nacl, nacl->nport_wwnn, nacl->nport_id);
845} 845}
846 846
847static void tcm_qla2xxx_release_session(struct kref *kref)
848{
849 struct se_session *se_sess = container_of(kref,
850 struct se_session, sess_kref);
851
852 qlt_unreg_sess(se_sess->fabric_sess_ptr);
853}
854
855static void tcm_qla2xxx_put_session(struct se_session *se_sess)
856{
857 struct qla_tgt_sess *sess = se_sess->fabric_sess_ptr;
858 struct qla_hw_data *ha = sess->vha->hw;
859 unsigned long flags;
860
861 spin_lock_irqsave(&ha->hardware_lock, flags);
862 kref_put(&se_sess->sess_kref, tcm_qla2xxx_release_session);
863 spin_unlock_irqrestore(&ha->hardware_lock, flags);
864}
865
847static void tcm_qla2xxx_put_sess(struct qla_tgt_sess *sess) 866static void tcm_qla2xxx_put_sess(struct qla_tgt_sess *sess)
848{ 867{
849 target_put_session(sess->se_sess); 868 tcm_qla2xxx_put_session(sess->se_sess);
850} 869}
851 870
852static void tcm_qla2xxx_shutdown_sess(struct qla_tgt_sess *sess) 871static void tcm_qla2xxx_shutdown_sess(struct qla_tgt_sess *sess)
@@ -1731,6 +1750,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = {
1731 .new_cmd_map = NULL, 1750 .new_cmd_map = NULL,
1732 .check_stop_free = tcm_qla2xxx_check_stop_free, 1751 .check_stop_free = tcm_qla2xxx_check_stop_free,
1733 .release_cmd = tcm_qla2xxx_release_cmd, 1752 .release_cmd = tcm_qla2xxx_release_cmd,
1753 .put_session = tcm_qla2xxx_put_session,
1734 .shutdown_session = tcm_qla2xxx_shutdown_session, 1754 .shutdown_session = tcm_qla2xxx_shutdown_session,
1735 .close_session = tcm_qla2xxx_close_session, 1755 .close_session = tcm_qla2xxx_close_session,
1736 .sess_get_index = tcm_qla2xxx_sess_get_index, 1756 .sess_get_index = tcm_qla2xxx_sess_get_index,
@@ -1779,6 +1799,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
1779 .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl, 1799 .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl,
1780 .tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index, 1800 .tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index,
1781 .release_cmd = tcm_qla2xxx_release_cmd, 1801 .release_cmd = tcm_qla2xxx_release_cmd,
1802 .put_session = tcm_qla2xxx_put_session,
1782 .shutdown_session = tcm_qla2xxx_shutdown_session, 1803 .shutdown_session = tcm_qla2xxx_shutdown_session,
1783 .close_session = tcm_qla2xxx_close_session, 1804 .close_session = tcm_qla2xxx_close_session,
1784 .sess_get_index = tcm_qla2xxx_sess_get_index, 1805 .sess_get_index = tcm_qla2xxx_sess_get_index,