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@xxxxxxxxx> --- drivers/target/iscsi/iscsi_target.c | 6 ++++++ 1 file changed, 6 insertions(+) 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) { -- 2.25.1