mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
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>
This commit is contained in:
parent
337c060701
commit
99367f01b8
4 changed files with 9 additions and 9 deletions
|
@ -4168,7 +4168,7 @@ int iscsit_close_connection(
|
|||
if (!atomic_read(&sess->session_reinstatement) &&
|
||||
atomic_read(&sess->session_fall_back_to_erl0)) {
|
||||
spin_unlock_bh(&sess->conn_lock);
|
||||
iscsit_close_session(sess);
|
||||
target_put_session(sess->se_sess);
|
||||
|
||||
return 0;
|
||||
} else if (atomic_read(&sess->session_logout)) {
|
||||
|
@ -4289,7 +4289,7 @@ static void iscsit_logout_post_handler_closesession(
|
|||
iscsit_dec_conn_usage_count(conn);
|
||||
iscsit_stop_session(sess, 1, 1);
|
||||
iscsit_dec_session_usage_count(sess);
|
||||
iscsit_close_session(sess);
|
||||
target_put_session(sess->se_sess);
|
||||
}
|
||||
|
||||
static void iscsit_logout_post_handler_samecid(
|
||||
|
@ -4455,7 +4455,7 @@ int iscsit_free_session(struct iscsi_session *sess)
|
|||
} else
|
||||
spin_unlock_bh(&sess->conn_lock);
|
||||
|
||||
iscsit_close_session(sess);
|
||||
target_put_session(sess->se_sess);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1698,8 +1698,8 @@ static int lio_tpg_shutdown_session(struct se_session *se_sess)
|
|||
atomic_set(&sess->session_reinstatement, 1);
|
||||
spin_unlock(&sess->conn_lock);
|
||||
|
||||
iscsit_inc_session_usage_count(sess);
|
||||
iscsit_stop_time2retain_timer(sess);
|
||||
iscsit_stop_session(sess, 1, 1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1715,8 +1715,6 @@ static void lio_tpg_close_session(struct se_session *se_sess)
|
|||
* If the iSCSI Session for the iSCSI Initiator Node exists,
|
||||
* forcefully shutdown the iSCSI NEXUS.
|
||||
*/
|
||||
iscsit_stop_session(sess, 1, 1);
|
||||
iscsit_dec_session_usage_count(sess);
|
||||
iscsit_close_session(sess);
|
||||
}
|
||||
|
||||
|
|
|
@ -783,7 +783,7 @@ static void iscsit_handle_time2retain_timeout(unsigned long data)
|
|||
}
|
||||
|
||||
spin_unlock_bh(&se_tpg->session_lock);
|
||||
iscsit_close_session(sess);
|
||||
target_put_session(sess->se_sess);
|
||||
}
|
||||
|
||||
extern void iscsit_start_time2retain_handler(struct iscsi_session *sess)
|
||||
|
|
|
@ -180,14 +180,16 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn)
|
|||
if (sess->session_state == TARG_SESS_STATE_FAILED) {
|
||||
spin_unlock_bh(&sess->conn_lock);
|
||||
iscsit_dec_session_usage_count(sess);
|
||||
return iscsit_close_session(sess);
|
||||
target_put_session(sess->se_sess);
|
||||
return 0;
|
||||
}
|
||||
spin_unlock_bh(&sess->conn_lock);
|
||||
|
||||
iscsit_stop_session(sess, 1, 1);
|
||||
iscsit_dec_session_usage_count(sess);
|
||||
|
||||
return iscsit_close_session(sess);
|
||||
target_put_session(sess->se_sess);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void iscsi_login_set_conn_values(
|
||||
|
|
Loading…
Reference in a new issue