From blank@uni-trier.de Fri May 21 02:30:04 1999
Return-Path: <blank@uni-trier.de>
Received: from rzmail.uni-trier.de (rzmail.uni-trier.de [136.199.8.220])
	by hub.freebsd.org (Postfix) with ESMTP id 10B5914E9D
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 May 1999 02:29:57 -0700 (PDT)
	(envelope-from blank@uni-trier.de)
Received: from uni-trier.de (blank@rzppp-78.uni-trier.de [136.199.4.78]) by rzmail.uni-trier.de (8.8.5/8.6.9) with ESMTP id LAA01585 for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 May 1999 11:29:45 +0200 (CEST)
Received: (from blank@localhost)
	by uni-trier.de (8.9.3/8.9.3) id LAA00624;
	Fri, 21 May 1999 11:29:00 +0200 (CEST)
	(envelope-from blank)
Message-Id: <199905210929.LAA00624@uni-trier.de>
Date: Fri, 21 May 1999 11:29:00 +0200 (CEST)
From: blank@uni-trier.de
Reply-To: blank@uni-trier.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: SCSI tape driver fails on media type recognition
X-Send-Pr-Version: 3.2

>Number:         11815
>Category:       kern
>Synopsis:       SCSI tape driver fails on media type recognition
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    mjacob
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 21 02:40:02 PDT 1999
>Closed-Date:    Fri Dec 3 15:46:47 PST 1999
>Last-Modified:  Fri Dec  3 15:47:12 PST 1999
>Originator:     Sascha Blank
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
>Environment:

A FreeBSD 3.2-STABLE system, CVSupped on Thursday, May 20th at about 18:50
o'clock CEST.  A "make world" has been performed after that.

Import messages from dmesg output:

...
ncr0: <ncr 53c815 fast10 scsi> rev 0x03 int a irq 11 on pci0.8.0
...
sa0 at ncr0 bus 0 target 0 lun 0
sa0: <TANDBERG TDC 4100 =07:> Removable Sequential Access SCSI-2 device 
sa0: 4.807MB/s transfers (4.807MHz, offset 8)
...

The tape drive's firmware has revision 07:28, and the drive itself is
the only device connected to the ncr0 controller.

ident /usr/src/sys/cam/scsi/scsi_sa.c:
     $Id: scsi_sa.c,v 1.16.2.4 1999/05/11 05:40:43 mjacob Exp $

>Description:

When I insert a tape of my choice into the drive and do a "mt status", I
get the following status report:

Mode      Density              Blocksize      bpi      Compression
Current:  0x11:QIC-320         1024 bytes     16000    disabled
---------available modes---------
0:        0x11:QIC-320         1024 bytes     16000    none
1:        0x11:QIC-320         1024 bytes     16000    none
2:        0x11:QIC-320         1024 bytes     16000    none
3:        0x11:QIC-320         1024 bytes     16000    none
---------------------------------
Current Driver State: at rest.
---------------------------------
File Number: 0	Record Number: 0

The output is always the same, no matter whether I have inserted a
QIC-120, a QIC-150 or a QIC-1000 tape!

Doing tape operations like reading from or writing to the tape doesn't
make a change either, even a "mt erase" doesn't help; the "mt status"
output after these operations is always the same as shown above (except
for the blocksize that I might have to change to 512 to be able to read
"smaller" tapes like QIC-120s).

>How-To-Repeat:

See above.

>Fix:
	
The problem is introduced by changes that were made to scsi_sa.c when
going from revision 1.16.2.3 to 1.16.2.4.  Going back to version
1.16.2.3 makes the media type recognition work again.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->mjacob 
Responsible-Changed-By: mjacob 
Responsible-Changed-When: Fri May 21 16:31:29 PDT 1999 
Responsible-Changed-Why:  
My responsibility. 

From: Matthew Jacob <mjacob@feral.com>
To: blank@uni-trier.de
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/11815: SCSI tape driver fails on media type recognition
Date: Fri, 21 May 1999 17:06:51 -0700 (PDT)

 > >Description:
 > 
 > When I insert a tape of my choice into the drive and do a "mt status", I
 > get the following status report:
 > 
 > Mode      Density              Blocksize      bpi      Compression
 > Current:  0x11:QIC-320         1024 bytes     16000    disabled
 > ---------available modes---------
 > 0:        0x11:QIC-320         1024 bytes     16000    none
 > 1:        0x11:QIC-320         1024 bytes     16000    none
 > 2:        0x11:QIC-320         1024 bytes     16000    none
 > 3:        0x11:QIC-320         1024 bytes     16000    none
 > ---------------------------------
 > Current Driver State: at rest.
 > ---------------------------------
 > File Number: 0	Record Number: 0
 > 
 > The output is always the same, no matter whether I have inserted a
 > QIC-120, a QIC-150 or a QIC-1000 tape!
 > 
 > Doing tape operations like reading from or writing to the tape doesn't
 > make a change either, even a "mt erase" doesn't help; the "mt status"
 > output after these operations is always the same as shown above (except
 > for the blocksize that I might have to change to 512 to be able to read
 > "smaller" tapes like QIC-120s).
 > 
 
 There are a couple of problems here.
 
 The MTIOCGET ioctl does not, in fact, actually ask the tape drive
 what it's currently set to. It goes entirely off of values based upon what
 was determined, possibly incorrectly because the drive may not have
 looked at the media, at samount time. Therefore, the information you see
 may be incorrect because the tape drive can and will change the
 information after a media access is performed- but because driver only
 fetches it at samount time, you'll never know!
 
 I have some changes in the works that will force the read at samount time,
 but they're not ready for release. This is also because the detection of
 changed volumes is broken still (half fixed now, but I had to get rid of
 reserve/release to do this).
 
 You should be able to change this to 512 bytes and QIC-150 density. It
 might not let you change the compression field, but this all shouldn't
 matter because the density is driven by the media inserted, not by the
 tape drive, right? 
 
 So, I'd be curious to know whether you can set 512 blocksize if you have a
 QIC-120 or QIC-150. Can you?
 
 Other random things I've notice- MTOFFL doesn't clear the
 SA_FLAG_TAPE_MOUNTED bit. That's bad.
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: mjacob 
State-Changed-When: Fri Dec 3 15:46:47 PST 1999 
State-Changed-Why:  
fixed in both -current and -stable 
>Unformatted:
