From garry@NetworkPhysics.COM  Wed Feb 15 00:41:34 2006
Return-Path: <garry@NetworkPhysics.COM>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3991B16A420
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 15 Feb 2006 00:41:34 +0000 (GMT)
	(envelope-from garry@NetworkPhysics.COM)
Received: from NetworkPhysics.COM (fw.networkphysics.com [205.158.104.176])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E869D43D46
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 15 Feb 2006 00:41:33 +0000 (GMT)
	(envelope-from garry@NetworkPhysics.COM)
Received: from focus5.fractal.networkphysics.com (focus5.fractal.networkphysics.com [10.10.0.112])
	by NetworkPhysics.COM (8.12.10/8.12.10) with ESMTP id k1F0fXPY055238
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 14 Feb 2006 16:41:33 -0800 (PST)
	(envelope-from garry@NetworkPhysics.COM)
Received: (from garry@localhost)
	by focus5.fractal.networkphysics.com (8.13.1/8.12.10/Submit) id k1F0fXwC023235;
	Tue, 14 Feb 2006 16:41:33 -0800 (PST)
	(envelope-from garry)
Message-Id: <200602150041.k1F0fXwC023235@focus5.fractal.networkphysics.com>
Date: Tue, 14 Feb 2006 16:41:33 -0800 (PST)
From: Garry Belka <garry@NetworkPhysics.COM>
Reply-To: Garry Belka <garry@NetworkPhysics.COM>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: ATA_SMART command is missing
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         93368
>Category:       kern
>Synopsis:       [ata] [patch] ATA_SMART command is missing
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    remko
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 15 00:50:05 GMT 2006
>Closed-Date:    Mon Feb 19 12:38:48 GMT 2007
>Last-Modified:  Mon Feb 19 12:38:48 GMT 2007
>Originator:     Garry Belka
>Release:        FreeBSD 5.4-RELEASE i386
>Organization:
Network Physics
>Environment:
System: FreeBSD tempo.fractal.networkphysics.com 5.4-RELEASE FreeBSD i386
>Description:
	ATA_SMART (0xb0) command is not defined. On error ATA driver prints
"Unknown CMD" instead of "SMART".

and, btw, there is a more serious bug lurking in ATA. In composite requests
with dependency, a first stage  read will be marked as done,
even if it failed with error. Composite handling in ata_completed()
will immediately restart the channel I/O.
That will start a dependent write part of the composite,
likely to result in data corruption unless the whole disk failed.

>How-To-Repeat:
	run smartd on a failing disk
>Fix:
apply a trivial patch below.
Index: sys/dev/ata/ata-queue.c
===================================================================
RCS file: /u1/Repo/FreeBSD/sys/dev/ata/ata-queue.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- sys/dev/ata/ata-queue.c     19 Jan 2006 19:09:32 -0000      1.10
+++ sys/dev/ata/ata-queue.c     15 Feb 2006 00:06:47 -0000      1.11
@@ -800,6 +800,7 @@
        case 0xa0: return ("PACKET_CMD");
        case 0xa1: return ("ATAPI_IDENTIFY");
        case 0xa2: return ("SERVICE");
+       case 0xb0: return ("SMART");
        case 0xc0: return ("CFA ERASE");
        case 0xc4: return ("READ_MUL");
        case 0xc5: return ("WRITE_MUL");
Index: sys/sys/ata.h
===================================================================
RCS file: /u1/Repo/FreeBSD/sys/sys/ata.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- sys/sys/ata.h       5 Nov 2005 00:25:25 -0000       1.5
+++ sys/sys/ata.h       15 Feb 2006 00:06:47 -0000      1.6
@@ -240,6 +240,7 @@
 #define ATA_PACKET_CMD                  0xa0    /* packet command */
 #define ATA_ATAPI_IDENTIFY              0xa1    /* get ATAPI params*/
 #define ATA_SERVICE                     0xa2    /* service command */
+#define ATA_SMART_CMD                   0xb0
 #define ATA_CFA_ERASE                   0xc0    /* CFA erase */
 #define ATA_READ_MUL                    0xc4    /* read multi */
 #define ATA_WRITE_MUL                   0xc5    /* write multi */




>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Feb 15 02:29:06 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93368 
State-Changed-From-To: open->feedback 
State-Changed-By: remko 
State-Changed-When: Fri Jan 26 21:52:22 UTC 2007 
State-Changed-Why:  
Hello Soren, what about this patch? Is it OK? Can you commit it? Or can I? 

Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93368 
State-Changed-From-To: feedback->patched 
State-Changed-By: remko 
State-Changed-When: Sat Jan 27 21:17:16 UTC 2007 
State-Changed-Why:  
After approval from Soren I have committed this in -HEAD, 
I will MFC this in a little (After this had been found stable). 


Responsible-Changed-From-To: sos->remko 
Responsible-Changed-By: remko 
Responsible-Changed-When: Sat Jan 27 21:17:16 UTC 2007 
Responsible-Changed-Why:  
Grab the PR from sos since I committed this and I should be haunted 
by terrible beasts and not Soren ;-) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93368 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/93368: commit references a PR
Date: Sat, 27 Jan 2007 21:16:06 +0000 (UTC)

 remko       2007-01-27 21:15:59 UTC
 
   FreeBSD src repository (doc committer)
 
   Modified files:
     sys/dev/ata          ata-queue.c 
     sys/sys              ata.h 
   Log:
   Add the SMART command to the ATA instruction set.
   When the disk has an error, it will now print SMART
   instead of 'Unknown CMD'.
   
   PR:             kern/93368
   Submitted by:   Garry Belka <garry at NetworkPhysics dot COM>
   Approved by:    sos
   
   Revision  Changes    Path
   1.67      +1 -0      src/sys/dev/ata/ata-queue.c
   1.35      +1 -0      src/sys/sys/ata.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/93368: commit references a PR
Date: Fri,  2 Feb 2007 07:42:59 +0000 (UTC)

 remko       2007-02-02 07:42:44 UTC
 
   FreeBSD src repository (doc committer)
 
   Modified files:        (Branch: RELENG_6)
     sys/sys              ata.h 
     sys/dev/ata          ata-queue.c 
   Log:
   MFC:
   
     Fix a typo in ata-queue.c
   
     PR:             kern/107100
     Submitted by:   Stephen J. Roznowski <sjr at comcast dot net>
     Approved by:    sos
   
   and
   
     Add the SMART command to the ATA instruction set.
     When the disk has an error, it will now print SMART
     instead of 'Unknown CMD'.
   
     PR:             kern/93368
     Submitted by:   Garry Belka <garry at NetworkPhysics dot COM>
     Approved by:    sos
   
   Approved by:    sos (implicitly with the previous two commits)
   
   Revision  Changes    Path
   1.50.2.7  +3 -2      src/sys/dev/ata/ata-queue.c
   1.26.2.6  +1 -0      src/sys/sys/ata.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/93368: commit references a PR
Date: Fri,  2 Feb 2007 07:54:18 +0000 (UTC)

 remko       2007-02-02 07:54:10 UTC
 
   FreeBSD src repository (doc committer)
 
   Modified files:        (Branch: RELENG_5)
     sys/dev/ata          ata-queue.c 
     sys/sys              ata.h 
   Log:
   MFC:
   
     Fix a typo in ata-queue.c
   
     PR:             kern/107100
     Submitted by:   Stephen J. Roznowski <sjr at comcast dot net>
     Approved by:    sos
   
   and
   
     Add the SMART command to the ATA instruction set.
     When the disk has an error, it will now print SMART
     instead of 'Unknown CMD'.
   
     PR:             kern/93368
     Submitted by:   Garry Belka <garry at NetworkPhysics dot COM>
     Approved by:    sos
   
   Approved by:    sos (implicitly with the two previous commits).
   
   Revision  Changes    Path
   1.32.2.9  +3 -2      src/sys/dev/ata/ata-queue.c
   1.23.2.1  +1 -0      src/sys/sys/ata.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: remko 
State-Changed-When: Mon Feb 19 12:38:47 UTC 2007 
State-Changed-Why:  
This had been recently MFC'ed to RELENG_6 and RELENG_5 (R6: 1.50.2.7 +3 
-2 src/sys/dev/ata/ata-queue.c 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93368 
>Unformatted:
