Bug 20573

Summary: ATA MFC Breaks -STABL
Product: Base System Reporter: Cy Schubert <Cy.Schubert>
Component: kernAssignee: Søren Schmidt <sos>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-RELEASE   
Hardware: Any   
OS: Any   

Description Cy Schubert 2000-08-13 12:00:01 UTC
Controller is locked after the following messages:

Aug  8 10:38:41 cwsys /kernel: ata1-master: timeout waiting to give command=c8 s
=d0 e=00
Aug  8 10:38:41 cwsys /kernel: ad2: error executing command

The original error is probably due to a marginal drive, which needs to
be replaced, however -stable prior to June 20 (MFC done on June 11)
resets the controller and controller is not hung.

Fix: 

After backing out MFC the following error messages are produced:

Aug 13 03:40:57 cwsys /kernel: ata1-master: timeout waiting to give command=c8 s
=d0 e=00
Aug 13 03:40:57 cwsys /kernel: ad2: error executing command
Aug 13 03:41:02 cwsys /kernel: ad2: READ command timeout - resetting
Aug 13 03:41:02 cwsys /kernel: ata1: resetting devices .. done

Controller is not hung.

MFC backed out is:

sos         2000/06/11 10:02:46 PDT

  Modified files:        (Branch: RELENG_4)
    sys/dev/ata          ata-all.c ata-all.h ata-disk.c ata-dma.c
                         atapi-cd.h
  Log:
  MFC:
  
  Update with latest fixes from -current, brings -stable functionality
  up to and including following -current revisions:
  
  ata-all.c  $FreeBSD: src/sys/dev/ata/ata-all.c,v 1.57 2000/05/28 07:51:23
  ata-all.h  $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.27 2000/04/09 15:08:26
  ata-disk.c $FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.69 2000/05/23 19:05:56
  ata-dma.c  $FreeBSD: src/sys/dev/ata/ata-dma.c,v 1.38 2000/05/23 19:05:56
  atapi-cd.h $FreeBSD: src/sys/dev/ata/atapi-cd.h,v 1.18 2000/05/28 07:50:19
    
  Revision  Changes    Path
  1.50.2.4  +5 -5      src/sys/dev/ata/ata-all.c
  1.26.2.1  +4 -1      src/sys/dev/ata/ata-all.h
  1.60.2.3  +36 -24    src/sys/dev/ata/ata-disk.c
  1.35.2.2  +9 -5      src/sys/dev/ata/ata-dma.c
  1.15.2.2  +2 -2      src/sys/dev/ata/atapi-cd.h
How-To-Repeat: 
Occurs randomly.
Comment 1 Søren Schmidt freebsd_committer freebsd_triage 2000-08-13 12:29:57 UTC
State Changed
From-To: open->analyzed


I'm the ATA guy :) 

Please try the following patch it should help: 

Index: ata-disk.c 
=================================================================== 
RCS file: /home/ncvs/src/sys/dev/ata/ata-disk.c,v 
retrieving revision 1.73 
diff -u -r1.73 ata-disk.c 
--- ata-disk.c	2000/08/06 18:01:47	1.73 
+++ ata-disk.c	2000/08/13 11:25:21 
@@ -391,7 +391,7 @@ 

if (ata_command(adp->controller, adp->unit, cmd,  
cylinder, head, sector, count, 0, ATA_IMMEDIATE)) { 
-	    printf("ad%d: error executing commandn", adp->lun); 
+	    printf("ad%d: error executing command", adp->lun); 
goto transfer_failed; 
} 

@@ -429,12 +429,21 @@ 

transfer_failed: 
untimeout((timeout_t *)ad_timeout, request, request->timeout_handle); 
-    request->bp->bio_error = EIO; 
-    request->bp->bio_flags |= BIO_ERROR; 
-    request->bp->bio_resid = request->bytecount; 
-    devstat_end_transaction_bio(&adp->stats, request->bp); 
-    biodone(request->bp); 
-    free(request, M_AD); 
+    printf(" - resettingn"); 
+ 
+    /* if retries still permit, reinject this request */ 
+    if (request->retries++ < AD_MAX_RETRIES) 
+	TAILQ_INSERT_HEAD(&adp->controller->ata_queue, request, chain); 
+    else { 
+	/* retries all used up, return error */ 
+	request->bp->bio_error = EIO; 
+	request->bp->bio_flags |= BIO_ERROR; 
+	request->bp->bio_resid = request->bytecount; 
+	devstat_end_transaction_bio(&adp->stats, request->bp); 
+	biodone(request->bp); 
+	free(request, M_AD); 
+    } 
+    ata_reinit(adp->controller); 
}
Comment 2 Søren Schmidt freebsd_committer freebsd_triage 2000-08-13 12:29:57 UTC
Responsible Changed
From-To: freebsd-bugs->sos
Comment 3 Søren Schmidt freebsd_committer freebsd_triage 2000-11-14 08:29:16 UTC
State Changed
From-To: analyzed->closed

fixed in 4.2.