linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Hannes Reinecke <hare@suse.de>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: SCSI LLDs, the SCSI error handler and host resource lifetime
Date: Mon, 26 Nov 2012 18:23:43 +0100	[thread overview]
Message-ID: <50B3A59F.3050506@acm.org> (raw)
In-Reply-To: <50AC808D.1060700@suse.de>

On 11/21/12 08:19, Hannes Reinecke wrote:
> Hmm.
> This would still mean that the eh thread will run until finished.
> Which can take _A LOT_ of time (we're speaking hours here).
> I would rather have an additional return code in the various 
> scsi_try_XXX functions to terminate the loop quickly.

Hello Hannes,

Since I'm not sure that I understood you properly: is something like
the patch below what you had in mind ?

Thanks,

Bart.

[PATCH] Skip invoking error handler once device removal started

---
 drivers/scsi/scsi_error.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index c1b05a8..697f7f2 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -582,7 +582,8 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd)
 	if (!hostt->eh_bus_reset_handler)
 		return FAILED;
 
-	rtn = hostt->eh_bus_reset_handler(scmd);
+	rtn = scsi_host_scan_allowed(host) ?
+		hostt->eh_bus_reset_handler(scmd) : FAST_IO_FAIL;
 
 	if (rtn == SUCCESS) {
 		if (!hostt->skip_settle_delay)
@@ -621,7 +622,8 @@ static int scsi_try_target_reset(struct scsi_cmnd *scmd)
 	if (!hostt->eh_target_reset_handler)
 		return FAILED;
 
-	rtn = hostt->eh_target_reset_handler(scmd);
+	rtn =  scsi_host_scan_allowed(host) ?
+		hostt->eh_target_reset_handler(scmd) : FAST_IO_FAIL;
 	if (rtn == SUCCESS) {
 		spin_lock_irqsave(host->host_lock, flags);
 		__starget_for_each_device(scsi_target(scmd->device), NULL,
@@ -645,12 +647,14 @@ static int scsi_try_target_reset(struct scsi_cmnd *scmd)
 static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
 {
 	int rtn;
-	struct scsi_host_template *hostt = scmd->device->host->hostt;
+	struct Scsi_Host *host = scmd->device->host;
+	struct scsi_host_template *hostt = host->hostt;
 
 	if (!hostt->eh_device_reset_handler)
 		return FAILED;
 
-	rtn = hostt->eh_device_reset_handler(scmd);
+	rtn = scsi_host_scan_allowed(host) ?
+		hostt->eh_device_reset_handler(scmd) : FAST_IO_FAIL;
 	if (rtn == SUCCESS)
 		__scsi_report_device_reset(scmd->device, NULL);
 	return rtn;
-- 
1.7.10.4



  parent reply	other threads:[~2012-11-26 17:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20 14:24 SCSI LLDs, the SCSI error handler and host resource lifetime Bart Van Assche
2012-11-21  7:19 ` Hannes Reinecke
2012-11-21 12:26   ` Bart Van Assche
2012-11-26 17:23   ` Bart Van Assche [this message]
2012-11-27 15:37     ` 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=50B3A59F.3050506@acm.org \
    --to=bvanassche@acm.org \
    --cc=hare@suse.de \
    --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).