public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: "Darrick J. Wong" <djwong@us.ibm.com>
Cc: linux-scsi@vger.kernel.org, andmike@us.ibm.com, alexisb@us.ibm.com
Subject: Re: timeout during sas discovery (aic94xx)
Date: Tue, 29 Aug 2006 08:53:43 -0500	[thread overview]
Message-ID: <1156859623.3458.3.camel@mulgrave.il.steeleye.com> (raw)
In-Reply-To: <44F3D428.60705@us.ibm.com>

On Mon, 2006-08-28 at 22:44 -0700, Darrick J. Wong wrote:
> Uh... I don't think that phy_reset function ever gets called.  My
> ten-second grep of the libsas/aic94xx code doesn't yield and takers.
> Maybe one of those functions that gets called after time index 575.791
> should be doing that?

I see the same thing occasionally in my sata on expanders setup.

The problem is that the error handling in the SMP functions isn't
robust.  Try this patch; it works for me(tm), but it's obviously wrong
since it simply blasts a reset.

James

Index: BUILD-2.6/drivers/scsi/libsas/sas_discover.c
===================================================================
--- BUILD-2.6.orig/drivers/scsi/libsas/sas_discover.c	2006-08-28 11:46:47.000000000 -0500
+++ BUILD-2.6/drivers/scsi/libsas/sas_discover.c	2006-08-28 17:32:08.000000000 -0500
@@ -136,10 +136,15 @@ static int sas_execute_task(struct sas_t
 			res2 = i->dft->lldd_abort_task(task);
 			SAS_DPRINTK("came back from abort task\n");
 			if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {
-				if (res2 == TMF_RESP_FUNC_COMPLETE)
-					continue; /* Retry the task */
-				else
-					goto ex_err;
+				if (res2 != TMF_RESP_FUNC_COMPLETE) {
+					/* bigger hammer */
+					SAS_DPRINTK("Resetting device\n");
+					sas_device_reset(task->dev, 1);
+					/* wait for things to settle */
+					msleep(500);
+					/* Retry the task */
+					continue;
+				}
 			}
 		}
 		if (task->task_status.stat == SAM_BUSY ||
Index: BUILD-2.6/drivers/scsi/libsas/sas_init.c
===================================================================
--- BUILD-2.6.orig/drivers/scsi/libsas/sas_init.c	2006-08-28 11:55:32.000000000 -0500
+++ BUILD-2.6/drivers/scsi/libsas/sas_init.c	2006-08-28 17:33:10.000000000 -0500
@@ -173,6 +173,19 @@ static struct sas_function_template sft 
 	.get_linkerrors = sas_get_linkerrors,
 };
 
+int sas_device_reset(struct domain_device *dev, int hard_reset)
+{
+	struct sas_rphy *rphy = dev->rphy;
+	struct sas_port *port = dev_to_sas_port(rphy->dev.parent);
+	struct sas_phy *phy;
+
+	mutex_lock(&port->phy_list_mutex);
+	list_for_each_entry(phy, &port->phy_list, port_siblings)
+		sas_phy_reset(phy, hard_reset);
+	mutex_unlock(&port->phy_list_mutex);
+	return 0;
+}
+
 struct scsi_transport_template *
 sas_domain_attach_transport(struct sas_domain_function_template *dft)
 {
Index: BUILD-2.6/drivers/scsi/libsas/sas_internal.h
===================================================================
--- BUILD-2.6.orig/drivers/scsi/libsas/sas_internal.h	2006-08-28 12:00:43.000000000 -0500
+++ BUILD-2.6/drivers/scsi/libsas/sas_internal.h	2006-08-28 12:01:35.000000000 -0500
@@ -75,6 +75,8 @@ int sas_smp_get_phy_events(struct sas_ph
 
 struct domain_device *sas_find_dev_by_rphy(struct sas_rphy *rphy);
 
+int sas_device_reset(struct domain_device *dev, int hard_reset);
+
 void sas_hae_reset(void *);
 
 static inline void sas_queue_event(int event, spinlock_t *lock,



  reply	other threads:[~2006-08-29 13:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-28 23:18 timeout during sas discovery (aic94xx) malahal
2006-08-29  5:44 ` Darrick J. Wong
2006-08-29 13:53   ` James Bottomley [this message]
2006-08-29 16:03     ` Mike Anderson
2006-08-29 16:22       ` James Bottomley
2006-08-29 16:50         ` 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=1156859623.3458.3.camel@mulgrave.il.steeleye.com \
    --to=james.bottomley@steeleye.com \
    --cc=alexisb@us.ibm.com \
    --cc=andmike@us.ibm.com \
    --cc=djwong@us.ibm.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