All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Haverkamp <markh@linux-foundation.org>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	"Moore, Eric" <Eric.Moore@lsi.com>
Subject: [PATCH] scsi spi transport: SCSI domain validation after reset
Date: Mon, 05 Feb 2007 12:49:00 -0800	[thread overview]
Message-ID: <1170708540.2573.10.camel@markh3.pdx.osdl.net> (raw)

James,

Some months ago, I had problems with a mis-behaving disk that failed
domain validation on a fusion card resulting in an infinite loop of
domain validation.  At the time Eric proposed a patch to the mptspi
driver to reload devices with parameters previously negotiated when a
reset occurred.  You indicated that a more generic solution should be
done.

This patch updates spi_dv_device_internal() to check if domain
validation has already been performed on a device and just sets it
previously negotiated parameters.  This solved the "infinite domain
validation" loop for me when a reset is performed as a result of command
timeout with the mis-behaving device.

Signed-off-by Mark Haverkamp <markh@linux-foundation.org>

---

Applies to scsi-misc-2.6

---

Index: scsi-misc-2.6/drivers/scsi/scsi_transport_spi.c
===================================================================
--- scsi-misc-2.6.orig/drivers/scsi/scsi_transport_spi.c
+++ scsi-misc-2.6/drivers/scsi/scsi_transport_spi.c
@@ -363,6 +363,7 @@ static int child_iter(struct device *dev
 {
 	struct scsi_device *sdev = to_scsi_device(dev);
 
+	spi_initial_dv(sdev->sdev_target) = 0;
 	spi_dv_device(sdev);
 	return 1;
 }
@@ -787,6 +788,29 @@ spi_dv_device_internal(struct scsi_devic
 	struct scsi_target *starget = sdev->sdev_target;
 	struct Scsi_Host *shost = sdev->host;
 	int len = sdev->inquiry_len;
+
+	/*
+	 * If dv has been done already on this target, just set its
+         * previously determined parameters.
+         */
+	if (spi_initial_dv(starget)) {
+		DV_SET(dt, spi_dt(starget));
+		DV_SET(iu, spi_iu(starget));
+		DV_SET(width, spi_width(starget));
+		DV_SET(offset, spi_offset(starget));
+		DV_SET(period, spi_period(starget));
+		DV_SET(qas, spi_qas(starget));
+		DV_SET(rd_strm, spi_rd_strm(starget));
+		DV_SET(wr_flow, spi_wr_flow(starget));
+		DV_SET(rti, spi_rti(starget));
+		DV_SET(pcomp_en, spi_pcomp_en(starget));
+		if (spi_dv_device_compare_inquiry(sdev, buffer,
+		    buffer, DV_LOOPS) == SPI_COMPARE_SUCCESS)
+			return;
+		starget_printk(KERN_ERR, starget,
+				"Domain Validation Inquiry Failed\n");
+	}
+
 	/* first set us up for narrow async */
 	DV_SET(offset, 0);
 	DV_SET(width, 0);
@@ -917,8 +941,10 @@ spi_dv_device(struct scsi_device *sdev)
 	if (unlikely(scsi_device_get(sdev)))
 		return;
 
-	if (unlikely(spi_dv_in_progress(starget)))
+	if (unlikely(spi_dv_in_progress(starget))) {
+		scsi_device_put(sdev);
 		return;
+	}
 	spi_dv_in_progress(starget) = 1;
 
 	buffer = kzalloc(len, GFP_KERNEL);

-- 
Mark Haverkamp <markh@linux-foundation.org>


             reply	other threads:[~2007-02-05 20:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-05 20:49 Mark Haverkamp [this message]
2007-02-05 21:50 ` [PATCH] scsi spi transport: SCSI domain validation after reset James Bottomley
2007-02-05 22:01   ` Mark Haverkamp
2007-02-07 23:51 Eric Moore
2007-02-12 16:14 ` Mark Haverkamp
2007-02-12 21:45   ` James Bottomley
2007-02-12 23:00     ` Mark Haverkamp

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=1170708540.2573.10.camel@markh3.pdx.osdl.net \
    --to=markh@linux-foundation.org \
    --cc=Eric.Moore@lsi.com \
    --cc=James.Bottomley@steeleye.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 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.