All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, jejb@linux.ibm.com
Cc: Mike Christie <michael.christie@oracle.com>
Subject: [PATCH 1/2] iscsi: Unblock session then wake up error handler
Date: Fri,  5 Nov 2021 17:10:47 -0500	[thread overview]
Message-ID: <20211105221048.6541-2-michael.christie@oracle.com> (raw)
In-Reply-To: <20211105221048.6541-1-michael.christie@oracle.com>

We can race where iscsi_session_recovery_timedout has woken up the error
handler thread and it's now setting the devices to offline, and
session_recovery_timedout's call to scsi_target_unblock is also trying to
set the device's state to transport-offline. We can then get a mix of
states.

For the case where we can't relogin we want the devices to be in
transport-offline so when we have repaired the connection
__iscsi_unblock_session can set the state back to running. So this patch
has us set the device state then call into libiscsi to wake up the error
handler.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 78343d3f9385..554b6f784223 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1899,12 +1899,12 @@ static void session_recovery_timedout(struct work_struct *work)
 	}
 	spin_unlock_irqrestore(&session->lock, flags);
 
-	if (session->transport->session_recovery_timedout)
-		session->transport->session_recovery_timedout(session);
-
 	ISCSI_DBG_TRANS_SESSION(session, "Unblocking SCSI target\n");
 	scsi_target_unblock(&session->dev, SDEV_TRANSPORT_OFFLINE);
 	ISCSI_DBG_TRANS_SESSION(session, "Completed unblocking SCSI target\n");
+
+	if (session->transport->session_recovery_timedout)
+		session->transport->session_recovery_timedout(session);
 }
 
 static void __iscsi_unblock_session(struct work_struct *work)
-- 
2.25.1


  reply	other threads:[~2021-11-05 22:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 22:10 [PATCH V2 0/2] scsi: fix hang when device state is set via sysfs Mike Christie
2021-11-05 22:10 ` Mike Christie [this message]
2021-11-06 17:44   ` [PATCH 1/2] iscsi: Unblock session then wake up error handler Lee Duncan
2021-11-19  4:16   ` Martin K. Petersen
2021-11-05 22:10 ` [PATCH 2/2] scsi: Fix hang when device state is set via sysfs Mike Christie
2021-11-06 18:17   ` Lee Duncan
2021-11-08  1:50   ` Wu Bo
2021-11-19 13:35   ` James Bottomley
2021-11-19 17:13     ` Mike Christie
2021-11-19 18:19       ` James Bottomley
2021-11-09  4:09 ` [PATCH V2 0/2] scsi: fix " 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=20211105221048.6541-2-michael.christie@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=cleech@redhat.com \
    --cc=jejb@linux.ibm.com \
    --cc=lduncan@suse.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.