From hausen@punkt.de  Fri Feb 13 00:49:54 1998
Received: from sun-1.punkt.de (sun-1.punkt.de [194.77.232.232])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA24028
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 13 Feb 1998 00:49:52 -0800 (PST)
          (envelope-from hausen@punkt.de)
Received: from hugo10.ka.punkt.de (ry93@hugo10.ka.punkt.de [194.77.233.242])
	by sun-1.punkt.de (8.8.8/8.8.5) with ESMTP id JAA06709;
	Fri, 13 Feb 1998 09:47:53 +0100 (MET)
Received: (from ry93@localhost)
	by hugo10.ka.punkt.de (8.8.7/8.8.7) id JAA00470;
	Fri, 13 Feb 1998 09:50:32 +0100 (CET)
	(envelope-from ry93)
Message-Id: <199802130850.JAA00470@hugo10.ka.punkt.de>
Date: Fri, 13 Feb 1998 09:50:32 +0100 (CET)
From: hausen@punkt.de
Reply-To: hausen@punkt.de
To: FreeBSD-gnats-submit@freebsd.org
Cc: hausen@punkt.de, egeling@punkt.de
Subject: serious bug in st driver or misconfiguration?
X-Send-Pr-Version: 3.2

>Number:         5735
>Category:       kern
>Synopsis:       Can't write to SCSI tape after "mt fsf" command
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 13 01:00:01 PST 1998
>Closed-Date:    Sat Feb 21 09:01:50 PST 1998
>Last-Modified:  Sat Feb 21 09:11:11 PST 1998
>Originator:     Patrick M. Hausen
>Release:        FreeBSD 2.2.5-RELEASE i386
>Organization:
WEB Internet Services, Karlsruhe, Germany
>Environment:

	2 Adaptec 2940
	Tandberg TDC 4220 on second controller

	Kernel config:

	controller      scbus0  #base SCSI code
	device          ch0     #SCSI media changers
	device          sd0     #SCSI disks
	device          st0     #SCSI tapes
	device          cd0     #SCSI CD-ROMs
	device          od0     #SCSI optical disk

	controller      pci0
	controller      ahc0
	controller      ahc1

	dmesg output:

	ahc1 <Adaptec 2940 SCSI host adapter> rev 3 int a irq 14 on pci0:14
	ahc1: aic7870 Single Channel, SCSI Id=7, 16 SCBs
	(ahc1:5:0): "PIONEER CD-ROM DR-124X 1.04" type 5 removable SCSI 2
	cd0(ahc1:5:0): CD-ROM can't get the size
	(ahc1:6:0): "TANDBERG  TDC 4200 =08:" type 1 removable SCSI 2
	st0(ahc1:6:0): Sequential-Access density code 0x0, 512-byte blocks, write-enable

>Description:

	Can't write or even rewind after "mt fsf".
	This makes (e.g.) Amanda fail after reading the tape-label trying
	to rewind.

>How-To-Repeat:

	ry93@hugo10:/home/ry93> dd if=/dev/zero of=/dev/nrst0 bs=5k count=10
	10+0 records in
	10+0 records out
	51200 bytes transferred in 0.104582 secs (489568 bytes/sec)
	ry93@hugo10:/home/ry93> mt -f /dev/rst0 rewind
	ry93@hugo10:/home/ry93> mt -f /dev/nrst0 fsf
	ry93@hugo10:/home/ry93> dd if=/dev/zero of=/dev/nrst0 bs=5k count=10
	dd: /dev/nrst0: Invalid argument
	1+0 records in
	0+0 records out
	0 bytes transferred in 0.010303 secs (0 bytes/sec)
	ry93@hugo10:/home/ry93> dmesg | tail -1
	st0(ahc1:6:0): ILLEGAL REQUEST asc:50,0 Write append error
	ry93@hugo10:/home/ry93> mt -f /dev/rst0 rewind
	mt: /dev/rst0: rewind: Invalid argument
	ry93@hugo10:/home/ry93> dmesg | tail -1
	st0(ahc1:6:0): ILLEGAL REQUEST asc:50,0 Write append error

>Fix:
	
	unknown

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: cwt 
State-Changed-When: Sat Feb 21 09:01:50 PST 1998 
State-Changed-Why:  
Patrick reports that Tandberg tech support replied to him: 
"From your info it seems that your customer writes 4 sessions, 
rewinds and reads 3 sessions and then tries to write over the last session. 
This is not allowed.  A tape can only be written from beginning of tape 
or from end of data (append." 

The problem was solved by changes made to the amanda tape backup utility 
which will appear in the upcoming 2.4.0 release: 

"Alexandre Oliva incoporated a change into Amanda. The software now 
consistently opens the device RO or RW until it's completely rewound 
and opened anew." 

Thanks, Patrick for researching this through to resolution and keeping 
us informed! 
>Unformatted:
