Bug 41382

Summary: ATAPI TAPE hung in atrpq
Product: Base System Reporter: Sean Winn <sean>
Component: kernAssignee: Søren Schmidt <sos>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.6.1-RELEASE   
Hardware: Any   
OS: Any   

Description Sean Winn 2002-08-06 17:00:06 UTC
	Seagte STT20000A (IDE Travan 5 tape drive) - using dump to write out
	a partition, dump hangs in 'atprq' (according to top) on
	closing the tape device.

How-To-Repeat: 	1:47 root@venturis [~] dump -0af /dev/nast0 /usr
	  DUMP: Date of this level 0 dump: Wed Aug  7 01:47:12 2002
	  DUMP: Date of last level 0 dump: the epoch
	  DUMP: Dumping /dev/ad0s1e (/usr) to /dev/nast0
	  DUMP: mapping (Pass I) [regular files]
	  DUMP: mapping (Pass II) [directories]
	  DUMP: estimated 131270 tape blocks.
	  DUMP: dumping (Pass III) [directories]
	  DUMP: dumping (Pass IV) [regular files]
	  DUMP: 88.75% done, finished in 0:00
	  DUMP: DUMP: 137175 tape blocks on 1 volume
	  DUMP: finished in 342 seconds, throughput 401 KBytes/sec
  	  DUMP: Closing /dev/nast0
  	  
  	  (hangs here)
Comment 1 iedowse 2002-08-06 17:47:48 UTC
In message <20020806155754.92708A6A2C@visi.gothic.net.au>, Sean writes:
>	Seagte STT20000A (IDE Travan 5 tape drive) - using dump to write out
>	a partition, dump hangs in 'atprq' (according to top) on
>	closing the tape device.

The following patch is reported to fix this problem. Can you try
it to see if it helps?

Ian

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)
Comment 2 Sean Winn 2002-08-06 18:34:31 UTC
From: "Ian Dowse" <iedowse@maths.tcd.ie>
To: "Sean" <sean@gothic.net.au>
Cc: <FreeBSD-gnats-submit@FreeBSD.org>
Sent: Wednesday, August 07, 2002 2:47 AM
Subject: Re: kern/41382: ATAPI TAPE hung in atrpq


> In message <20020806155754.92708A6A2C@visi.gothic.net.au>, Sean writes:
> > Seagte STT20000A (IDE Travan 5 tape drive) - using dump to write out
> > a partition, dump hangs in 'atprq' (according to top) on
> > closing the tape device.
>
> The following patch is reported to fix this problem. Can you try
> it to see if it helps?

Dump completed without a problem; makes the tape drive useful for backups
again :)



>
> Ian
>
> 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)
>
>
>
Comment 3 Johan Karlsson freebsd_committer freebsd_triage 2002-08-20 17:20:26 UTC
Responsible Changed
From-To: freebsd-bugs->sos

Over to ATA maintainer.
Comment 4 pinson 2002-09-03 17:32:34 UTC
ast0: TAPE <Seagate STT8000A> at ata1-master PIO4

FreeBSD 4.6.2-RELEASE #0: Sat Aug 31 00:05:36 EDT 2002
CPU: Pentium II/Pentium II Xeon/Celeron (398.27-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x651  Stepping = 1

Features=0x183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,
PA
T,PSE36,MMX,FXSR>

Prior to the patch, any tape operation to /dev/ast0 would hang after
completion.

The above patch to atapi-all.c corrected this problem with my Seagate 4/8 GB
Seagate STT8000A Travan tape drive.

Thanks for the fix!
Comment 5 Søren Schmidt freebsd_committer freebsd_triage 2002-09-12 14:58:31 UTC
State Changed
From-To: open->closed

Fix committed to current.