SCSI target development
 help / color / mirror / Atom feed
From: Maurizio Lombardi <mlombard@redhat.com>
To: target-devel@vger.kernel.org
Cc: martin.petersen@oracle.com, bvanassche@acm.org, ddiss@suse.de,
	mcoleman@datto.com, linux-scsi@vger.kernel.org
Subject: [PATCH RESEND 3/3] iscsi target: calling iscsit_stop_session() inside iscsit_close_session() has no
Date: Fri, 13 Mar 2020 17:06:56 +0000	[thread overview]
Message-ID: <20200313170656.9716-4-mlombard@redhat.com> (raw)
In-Reply-To: <20200313170656.9716-1-mlombard@redhat.com>

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.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
 drivers/target/iscsi/iscsi_target.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 9e90edc875f1..14f4842e3517 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4385,8 +4385,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);
-- 
2.21.0

  parent reply	other threads:[~2020-03-13 17:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13 17:06 [PATCH RESEND 0/3] Fix a race condition in the target driver Maurizio Lombardi
2020-03-13 17:06 ` [PATCH RESEND 1/3] target: remove boilerplate code Maurizio Lombardi
2020-03-13 17:06 ` [PATCH RESEND 2/3] target: fix target hang when multiple threads try to destroy the same iscsi sessi Maurizio Lombardi
2020-03-13 17:06 ` Maurizio Lombardi [this message]
2020-03-27  2:33 ` [PATCH RESEND 0/3] Fix a race condition in the target driver Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200313170656.9716-4-mlombard@redhat.com \
    --to=mlombard@redhat.com \
    --cc=bvanassche@acm.org \
    --cc=ddiss@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mcoleman@datto.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox