diff mbox series

[SRU,B,F,3/3] scsi: target: iscsi: calling iscsit_stop_session() inside iscsit_close_session() has no effect

Message ID 20200420183936.40908-4-kelsey.skunberg@canonical.com
State New
Headers show
Series Fix LIO from hanging in iscsit_free_session and iscsit_stop_session | expand

Commit Message

Kelsey Skunberg April 20, 2020, 6:39 p.m. UTC
From: Maurizio Lombardi <mlombard@redhat.com>

BugLink: https://bugs.launchpad.net/bugs/1871688

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 <rahul.kundu@chelsio.com>
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 626bac73371eed79e2afa2966de393da96cf925e)
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
---
 drivers/target/iscsi/iscsi_target.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index d1ce94c608a9..3c40fefeb331 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4377,8 +4377,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);