linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Smart <James.Smart@Emulex.Com>
To: linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH 1/2] Block I/O while SG reset operation in progress - midlayer portion
Date: Fri, 24 Feb 2006 11:52:16 -0500	[thread overview]
Message-ID: <43FF39C0.7080509@emulex.com> (raw)

This is the midlayer portion of the patch

This patch ensures that i/o is stopped while an eh handler is being
processed. It adds a new flag, set by the async reset callers, which
augments the host-in-reset checks and stops i/o.  The async reset
callers are already synchronized to hold off until the error thread is
no longer running.

-- james s

Signed-off-by: James Smart <James.Smart@emulex.com>


diff -upNr a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
--- a/drivers/scsi/scsi_error.c	2006-02-06 12:00:11.000000000 -0500
+++ b/drivers/scsi/scsi_error.c	2006-02-13 10:44:10.000000000 -0500
@@ -1654,7 +1654,9 @@ int
  scsi_reset_provider(struct scsi_device *dev, int flag)
  {
  	struct scsi_cmnd *scmd = scsi_get_command(dev, GFP_KERNEL);
+	struct Scsi_Host *shost = dev->host;
  	struct request req;
+	unsigned long flags;
  	int rtn;

  	scmd->request = &req;
@@ -1684,6 +1686,10 @@ scsi_reset_provider(struct scsi_device *
  	 */
  	scmd->pid			= 0;

+	spin_lock_irqsave(shost->host_lock, flags);
+	shost->tmf_in_progress = 1;
+	spin_unlock_irqrestore(shost->host_lock, flags);
+
  	switch (flag) {
  	case SCSI_TRY_RESET_DEVICE:
  		rtn = scsi_try_bus_device_reset(scmd);
@@ -1702,6 +1708,10 @@ scsi_reset_provider(struct scsi_device *
  		rtn = FAILED;
  	}

+	spin_lock_irqsave(shost->host_lock, flags);
+	shost->tmf_in_progress = 0;
+	spin_unlock_irqrestore(shost->host_lock, flags);
+
  	scsi_next_command(scmd);
  	return rtn;
  }
diff -upNr a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
--- a/include/scsi/scsi_host.h	2006-02-06 12:00:33.000000000 -0500
+++ b/include/scsi/scsi_host.h	2006-02-13 10:21:01.000000000 -0500
@@ -556,6 +556,9 @@ struct Scsi_Host {
  	 */
  	unsigned ordered_tag:1;

+	/* task mgmt function in progress */
+	unsigned tmf_in_progress:1;
+
  	/*
  	 * Optional work queue to be utilized by the transport
  	 */
@@ -633,7 +636,8 @@ static inline int scsi_host_in_recovery(
  {
  	return shost->shost_state == SHOST_RECOVERY ||
  		shost->shost_state == SHOST_CANCEL_RECOVERY ||
-		shost->shost_state == SHOST_DEL_RECOVERY;
+		shost->shost_state == SHOST_DEL_RECOVERY ||
+		shost->tmf_in_progress;
  }

  extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);


             reply	other threads:[~2006-02-24 16:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-24 16:52 James Smart [this message]
2006-02-24 20:11 ` [PATCH 1/2] Block I/O while SG reset operation in progress - midlayer portion Mike Anderson
2006-02-24 22:35   ` James Smart
2006-02-28  7:09     ` Mike Anderson

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=43FF39C0.7080509@emulex.com \
    --to=james.smart@emulex.com \
    --cc=linux-scsi@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;
as well as URLs for NNTP newsgroup(s).