Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Aug 2014 13:16:00 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r270327 - head/sys/cam/ata
Message-ID:  <201408221316.s7MDG0G0037975@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Aug 22 13:15:59 2014
New Revision: 270327
URL: http://svnweb.freebsd.org/changeset/base/270327

Log:
  We should never enter the PROBE_SETAN phase if we're not ATAPI, since
  that's ATAPI specific. Instead, skip to PROBE_SET_MULTI instead for
  non ATAPI protocols. The prior code incorrectly terminated the probe
  with a break, rather than arranging for probedone to get called. This
  caused panics or worse on some systems.

Modified:
  head/sys/cam/ata/ata_xpt.c

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c	Fri Aug 22 13:01:22 2014	(r270326)
+++ head/sys/cam/ata/ata_xpt.c	Fri Aug 22 13:15:59 2014	(r270327)
@@ -458,18 +458,12 @@ negotiate:
 		    0, 0x02);
 		break;
 	case PROBE_SETAN:
-		/* 
-		 * Only ATAPI defines this bit to mean AEN, but remember
-		 * what transport thinks about AEN.
-		 */
-		if ((softc->caps & CTS_SATA_CAPS_H_AN) && 
-		    periph->path->device->protocol == PROTO_ATAPI)
+		/* Remember what transport thinks about AEN. */
+		if (softc->caps & CTS_SATA_CAPS_H_AN)
 			path->device->inq_flags |= SID_AEN;
 		else
 			path->device->inq_flags &= ~SID_AEN;
 		xpt_async(AC_GETDEV_CHANGED, path, NULL);
-		if (periph->path->device->protocol != PROTO_ATAPI)
-			break;
 		cam_fill_ataio(ataio,
 		    1,
 		    probedone,
@@ -1057,7 +1051,8 @@ noerror:
 		}
 		/* FALLTHROUGH */
 	case PROBE_SETDMAAA:
-		if ((ident_buf->satasupport & ATA_SUPPORT_ASYNCNOTIF) &&
+		if (path->device->protocol != PROTO_ATA &&
+		    (ident_buf->satasupport & ATA_SUPPORT_ASYNCNOTIF) &&
 		    (!(softc->caps & CTS_SATA_CAPS_H_AN)) !=
 		    (!(ident_buf->sataenabled & ATA_SUPPORT_ASYNCNOTIF))) {
 			PROBE_SET_ACTION(softc, PROBE_SETAN);
@@ -1178,7 +1173,7 @@ notsata:
 		else
 			caps = 0;
 		/* Remember what transport thinks about AEN. */
-		if (caps & CTS_SATA_CAPS_H_AN)
+		if ((caps & CTS_SATA_CAPS_H_AN) && path->device->protocol != PROTO_ATA)
 			path->device->inq_flags |= SID_AEN;
 		else
 			path->device->inq_flags &= ~SID_AEN;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408221316.s7MDG0G0037975>