From: Maurizio Lombardi Date: Fri, 13 Mar 2020 17:06:56 +0000 (+0100) Subject: scsi: target: iscsi: calling iscsit_stop_session() inside iscsit_close_session()... X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=626bac73371eed79e2afa2966de393da96cf925e;p=linux.git scsi: target: iscsi: calling iscsit_stop_session() inside iscsit_close_session() has no effect iscsit_close_session() can only be called when nconn is zero (otherwise a kernel panic is triggered). If nconn is zero then iscsit_stop_session() does nothing and exits, so calling it makes no sense. We still need to call iscsit_check_session_usage_count() because this function will sleep if the session's refcount is not zero and we don't want to destroy the session structure if it's still being referenced. Link: https://lore.kernel.org/r/20200313170656.9716-4-mlombard@redhat.com Tested-by: Rahul Kundu Signed-off-by: Maurizio Lombardi Signed-off-by: Martin K. Petersen --- diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 8ef5cf6eb5b4b..3704073258b18 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -4381,8 +4381,7 @@ int iscsit_close_session(struct iscsi_session *sess) * restart the timer and exit. */ if (!in_interrupt()) { - if (iscsit_check_session_usage_count(sess) == 1) - iscsit_stop_session(sess, 1, 1); + iscsit_check_session_usage_count(sess); } else { if (iscsit_check_session_usage_count(sess) == 2) { atomic_set(&sess->session_logout, 0);