diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-27 04:43:32 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-03-10 17:42:25 -0500 |
commit | 99367f01b8df2018ff3328ddf4111e701d34188d (patch) | |
tree | 5ef6e2ffe8b1d3ee8bfd995b80efcb4e6d02095d /drivers/target | |
parent | 337c060701fb3d27d9945bf7af7ba194ae2153a8 (diff) |
iscsi-target: Convert to use target_put_session + sess_kref
This patch converts iscsi-target session code to use se_sess->sess_kref
counting for iscsi session shutdown. The following cases include:
*) last iscsit_close_connection() shutdown path to invoke close session
*) iscsit_logout_post_handler_closesession() for explict logout
*) iscsit_free_session() caller for explict shutdown
It also moves iscsit_stop_session() call from lio_tpg_close_session()
into lio_tpg_shutdown_session() TFO callbacks to invoke an explict
shutdown, and also changes iscsi_check_for_session_reinstatement()
login code to use se_sess->sess_kref.
(v2: Make iscsit_handle_time2retain_timeout() use target_put_session)
Cc: Andy Grover <agrover@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 6 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_configfs.c | 4 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_erl0.c | 2 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_login.c | 6 |
4 files changed, 9 insertions, 9 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index c3ef2f6f3740..d3b54ecbfcda 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -4168,7 +4168,7 @@ int iscsit_close_connection( | |||
4168 | if (!atomic_read(&sess->session_reinstatement) && | 4168 | if (!atomic_read(&sess->session_reinstatement) && |
4169 | atomic_read(&sess->session_fall_back_to_erl0)) { | 4169 | atomic_read(&sess->session_fall_back_to_erl0)) { |
4170 | spin_unlock_bh(&sess->conn_lock); | 4170 | spin_unlock_bh(&sess->conn_lock); |
4171 | iscsit_close_session(sess); | 4171 | target_put_session(sess->se_sess); |
4172 | 4172 | ||
4173 | return 0; | 4173 | return 0; |
4174 | } else if (atomic_read(&sess->session_logout)) { | 4174 | } else if (atomic_read(&sess->session_logout)) { |
@@ -4289,7 +4289,7 @@ static void iscsit_logout_post_handler_closesession( | |||
4289 | iscsit_dec_conn_usage_count(conn); | 4289 | iscsit_dec_conn_usage_count(conn); |
4290 | iscsit_stop_session(sess, 1, 1); | 4290 | iscsit_stop_session(sess, 1, 1); |
4291 | iscsit_dec_session_usage_count(sess); | 4291 | iscsit_dec_session_usage_count(sess); |
4292 | iscsit_close_session(sess); | 4292 | target_put_session(sess->se_sess); |
4293 | } | 4293 | } |
4294 | 4294 | ||
4295 | static void iscsit_logout_post_handler_samecid( | 4295 | static void iscsit_logout_post_handler_samecid( |
@@ -4455,7 +4455,7 @@ int iscsit_free_session(struct iscsi_session *sess) | |||
4455 | } else | 4455 | } else |
4456 | spin_unlock_bh(&sess->conn_lock); | 4456 | spin_unlock_bh(&sess->conn_lock); |
4457 | 4457 | ||
4458 | iscsit_close_session(sess); | 4458 | target_put_session(sess->se_sess); |
4459 | return 0; | 4459 | return 0; |
4460 | } | 4460 | } |
4461 | 4461 | ||
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index dcef63bf5f9d..1174f74f4fbc 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -1698,8 +1698,8 @@ static int lio_tpg_shutdown_session(struct se_session *se_sess) | |||
1698 | atomic_set(&sess->session_reinstatement, 1); | 1698 | atomic_set(&sess->session_reinstatement, 1); |
1699 | spin_unlock(&sess->conn_lock); | 1699 | spin_unlock(&sess->conn_lock); |
1700 | 1700 | ||
1701 | iscsit_inc_session_usage_count(sess); | ||
1702 | iscsit_stop_time2retain_timer(sess); | 1701 | iscsit_stop_time2retain_timer(sess); |
1702 | iscsit_stop_session(sess, 1, 1); | ||
1703 | 1703 | ||
1704 | return 1; | 1704 | return 1; |
1705 | } | 1705 | } |
@@ -1715,8 +1715,6 @@ static void lio_tpg_close_session(struct se_session *se_sess) | |||
1715 | * If the iSCSI Session for the iSCSI Initiator Node exists, | 1715 | * If the iSCSI Session for the iSCSI Initiator Node exists, |
1716 | * forcefully shutdown the iSCSI NEXUS. | 1716 | * forcefully shutdown the iSCSI NEXUS. |
1717 | */ | 1717 | */ |
1718 | iscsit_stop_session(sess, 1, 1); | ||
1719 | iscsit_dec_session_usage_count(sess); | ||
1720 | iscsit_close_session(sess); | 1718 | iscsit_close_session(sess); |
1721 | } | 1719 | } |
1722 | 1720 | ||
diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c index 478451167b62..1ab0560b0924 100644 --- a/drivers/target/iscsi/iscsi_target_erl0.c +++ b/drivers/target/iscsi/iscsi_target_erl0.c | |||
@@ -783,7 +783,7 @@ static void iscsit_handle_time2retain_timeout(unsigned long data) | |||
783 | } | 783 | } |
784 | 784 | ||
785 | spin_unlock_bh(&se_tpg->session_lock); | 785 | spin_unlock_bh(&se_tpg->session_lock); |
786 | iscsit_close_session(sess); | 786 | target_put_session(sess->se_sess); |
787 | } | 787 | } |
788 | 788 | ||
789 | extern void iscsit_start_time2retain_handler(struct iscsi_session *sess) | 789 | extern void iscsit_start_time2retain_handler(struct iscsi_session *sess) |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 38cb7ce8469e..18cffff9b456 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -180,14 +180,16 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn) | |||
180 | if (sess->session_state == TARG_SESS_STATE_FAILED) { | 180 | if (sess->session_state == TARG_SESS_STATE_FAILED) { |
181 | spin_unlock_bh(&sess->conn_lock); | 181 | spin_unlock_bh(&sess->conn_lock); |
182 | iscsit_dec_session_usage_count(sess); | 182 | iscsit_dec_session_usage_count(sess); |
183 | return iscsit_close_session(sess); | 183 | target_put_session(sess->se_sess); |
184 | return 0; | ||
184 | } | 185 | } |
185 | spin_unlock_bh(&sess->conn_lock); | 186 | spin_unlock_bh(&sess->conn_lock); |
186 | 187 | ||
187 | iscsit_stop_session(sess, 1, 1); | 188 | iscsit_stop_session(sess, 1, 1); |
188 | iscsit_dec_session_usage_count(sess); | 189 | iscsit_dec_session_usage_count(sess); |
189 | 190 | ||
190 | return iscsit_close_session(sess); | 191 | target_put_session(sess->se_sess); |
192 | return 0; | ||
191 | } | 193 | } |
192 | 194 | ||
193 | static void iscsi_login_set_conn_values( | 195 | static void iscsi_login_set_conn_values( |