Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jul 2002 22:06:38 +0100
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Hans Ottevanger <hansot@iae.nl>
Cc:        John Baldwin <jhb@FreeBSD.org>, stable@FreeBSD.org, Mark Hartley <mark@work.drapple.com>, Jesse Gross <jesse_gross@yahoo.com>, John Prince <johnp@lodgenet.com>
Subject:   Re: READ_BIG problems 
Message-ID:   <200207252206.aa43155@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Thu, 25 Jul 2002 22:44:09 %2B0200." <3D406319.1136A6EA@iae.nl> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <3D406319.1136A6EA@iae.nl>, Hans Ottevanger writes:
>acd0: READ_BIG command timeout - resetting
>ata1: resetting devices .. done
>acd0: READ_BIG command timeout - resetting
>ata1: resetting devices .. done

Could people seeing this and other ATA problems try the patch below?
This should fix some unlikely races that could potentially be
responsible for these problems, though I suspect it will not make
any difference.

The second part of the patch is a workaround for the "atprq" hangs
on ATAPI tape drives.

Ian

Index: ata-all.c
===================================================================
RCS file: /home/iedowse/CVS/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.50.2.37
diff -u -r1.50.2.37 ata-all.c
--- ata-all.c	19 Jun 2002 08:30:48 -0000	1.50.2.37
+++ ata-all.c	18 Jul 2002 17:00:27 -0000
@@ -228,10 +228,10 @@
 	!ch->r_io || !ch->r_altio || !ch->r_irq)
 	return ENXIO;
 
+    s = splbio();
     /* make sure channel is not busy */
     ATA_SLEEPLOCK_CH(ch, ATA_CONTROL);
 
-    s = splbio();
 #if NATADISK > 0
     if (ch->devices & ATA_ATA_MASTER && ch->device[MASTER].driver)
 	ad_detach(&ch->device[MASTER], 1);
@@ -669,10 +669,12 @@
 #endif
     int s;
 
-    if (!ATA_LOCK_CH(ch, ATA_ACTIVE))
+    s = splbio();
+    if (!ATA_LOCK_CH(ch, ATA_ACTIVE)) {
+	splx(s);
 	return;
+    }
 
-    s = splbio();
 #if NATADISK > 0
     /* find & call the responsible driver if anything on the ATA queue */
     if (TAILQ_EMPTY(&ch->ata_queue)) {
Index: atapi-all.c
===================================================================
RCS file: /home/iedowse/CVS/src/sys/dev/ata/atapi-all.c,v
retrieving revision 1.46.2.14
diff -u -r1.46.2.14 atapi-all.c
--- atapi-all.c	14 Jul 2002 12:35:28 -0000	1.46.2.14
+++ atapi-all.c	14 Jul 2002 23:39:00 -0000
@@ -186,6 +186,7 @@
     request->flags = flags;
     request->timeout = timeout * hz;
     request->ccbsize = atadev->param->packet_size ? 16 : 12;
+    request->error = EINPROGRESS;
     bcopy(ccb, request->ccb, request->ccbsize);
     if (callback) {
 	request->callback = callback;
@@ -215,7 +216,8 @@
     }
 
     /* wait for request to complete */
-    tsleep((caddr_t)request, PRIBIO, "atprq", 0);
+    if (request->error == EINPROGRESS)
+	tsleep((caddr_t)request, PRIBIO, "atprq", 0);
     splx(s);
     error = request->error;
     if (error)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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