All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	Matthew Wilcox <willy@infradead.org>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 3/4] sym53c8xx_2: split off bus reset from sym_eh_handler()
Date: Thu, 19 Aug 2021 11:07:15 +0200	[thread overview]
Message-ID: <20210819090716.94049-4-hare@suse.de> (raw)
In-Reply-To: <20210819090716.94049-1-hare@suse.de>

Bus reset is similar to host reset, and we also need to wait for
all commands to complete. So split off bus reset from sym_eh_handler()
and wait for all commands to complete after resetting the SCSI bus.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/sym53c8xx_2/sym_glue.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 86cba915b62d..817b2584b4aa 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -562,7 +562,6 @@ static void sym53c8xx_timer(struct timer_list *t)
  */
 #define SYM_EH_ABORT		0
 #define SYM_EH_DEVICE_RESET	1
-#define SYM_EH_BUS_RESET	2
 
 static int sym_eh_wait_for_commands(struct Scsi_Host *shost)
 {
@@ -621,10 +620,6 @@ static int sym_eh_handler(struct Scsi_Host *shost, int op,
 	case SYM_EH_DEVICE_RESET:
 		sts = sym_reset_scsi_target(np, cmd->device->id);
 		break;
-	case SYM_EH_BUS_RESET:
-		sym_reset_scsi_bus(np, 1);
-		sts = 0;
-		break;
 	default:
 		break;
 	}
@@ -681,10 +676,26 @@ static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd)
 	struct Scsi_Host *shost = cmd->device->host;
 	struct sym_data *sym_data = shost_priv(shost);
 	struct pci_dev *pdev = sym_data->pdev;
+	struct sym_hcb *np = sym_data->ncb;
+	int rval = SUCCESS;
 
 	if (pci_channel_offline(pdev))
 		return FAILED;
-	return sym_eh_handler(shost, SYM_EH_BUS_RESET, "BUS RESET", cmd);
+
+	shost_printk(KERN_WARNING, shost, "BUS RESET operation started\n");
+
+	spin_lock_irq(shost->host_lock);
+	if (sym_reset_scsi_bus(np, 1))
+		rval = FAILED;
+	spin_unlock_irq(shost->host_lock);
+
+	if (rval == SUCCESS)
+		rval = sym_eh_wait_for_commands(shost);
+
+	shost_printk(KERN_WARNING, shost, "BUS RESET operation %s.\n",
+			rval == SUCCESS ? "complete" : "failed");
+
+	return rval;
 }
 
 static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd)
-- 
2.29.2


  parent reply	other threads:[~2021-08-19  9:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19  9:07 [PATCH 0/4] sym53c8xx_2: Fixes for SCSI EH rework Hannes Reinecke
2021-08-19  9:07 ` [PATCH 1/4] sym53c8xx_2: move PCI EEH handling to host reset Hannes Reinecke
2021-08-20  5:13   ` Christoph Hellwig
2021-08-19  9:07 ` [PATCH 2/4] sym53c8xx_2: split off host reset from sym_eh_handler() Hannes Reinecke
2021-08-19  9:07 ` Hannes Reinecke [this message]
2021-08-19  9:07 ` [PATCH 4/4] sym53c8xx_2: rework reset handling Hannes Reinecke

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=20210819090716.94049-4-hare@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=willy@infradead.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 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.