diff mbox series

[3/3] target: iscsi: close session without connections

Message ID 20221003202723.22714-4-d.bogdanov@yadro.com (mailing list archive)
State New, archived
Headers show
Series fixes related to iSCSI Time2Retain timer | expand

Commit Message

Dmitry Bogdanov Oct. 3, 2022, 8:27 p.m. UTC
During Time2Retain timer there are no connections in the session.
A session stop due to ACL/TPG removal is done by stopping its
connections. For session in recovery it stops Time2Retain timer and
that's it. The session hanges forever.

Call directly a session closure when no connections in the session.
Do it in other context to make it possible to wait for session usage
counter, that is decreased always after invocation of session stop.

Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
---
 drivers/target/iscsi/iscsi_target.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 3e91523e540b..967c969cfc10 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4738,6 +4738,12 @@  void iscsit_stop_session(
 	struct iscsit_conn *conn, *conn_tmp = NULL;
 	int is_last;
 
+	if (!conn_count) {
+		/* during Time2Retain timer there is no connections */
+		schedule_work(&sess->session_close_worker);
+		return;
+	}
+
 	spin_lock_bh(&sess->conn_lock);
 
 	if (connection_sleep) {