Subject: multi-volume dump fails, problem with st driver?
To: None <tech-kern@netbsd.org>
From: Scott Presnell <srp@zgi.com>
List: tech-kern
Date: 10/03/2002 17:28:50
Hi Folks, 
	I'm using NetBSD/i386 1.5.2 (patched heavily for security issues) and a
HP T4000...

ahc0 at pci1 dev 10 function 0
ahc0: interrupting at irq 10
ahc0: aic7880 Wide Channel A, SCSI Id=7, 16/255 SCBs
scsibus0 at ahc0 channel 0: 16 targets, 8 luns per target
scsibus0: waiting 2 seconds for devices to settle...
ahc0: target 5 using 8bit transfers
ahc0: target 5 using asynchronous transfers
st0 at scsibus0 target 5 lun 0: <HP, T4000s, 1.10> SCSI2 1/sequential removable
st0: rogue, drive empty

... with quirks as follows:

	{{T_SEQUENTIAL, T_REMOV,
	 "HP      ", "T4000s          ", ""},     {ST_Q_UNIMODAL|ST_Q_NOPREVENT, 0, {
		{0, 0, QIC_3095},			/* minor 0-3 */
		{0, 0, QIC_3095},			/* minor 4-7 */
		{0, 0, QIC_3095},			/* minor 8-11 */
		{0, 0, QIC_3095},			/* minor 12-15 */
	}}},

I added the ST_Q_NOPREVENT code to the 1.5.2 st.c (revision 1.124.2.1)
recently, but before that I had been using ADEV_NODOORLOCK to get the same
effect, the device got pretty confused without it.

Normal dumps, even multi session dumps work fine, but recently I've been
trying to perform multi-volume dumps of a filesystem...

Everything is fine until I insert the second tape: dump thinks it's already
at the EOT and aborts (but it's certainly not, since I just rewound it).

In trying to address this, I've looked at the SCSI output at the time of
the dump, and find the following at the time of the EOT for the first tape:

Oct  2 22:33:30 dirt /netbsd: st0(ahc0:5:0):  Check Condition on CDB: 0x0a 01 00 00 80 00
Oct  2 22:33:30 dirt /netbsd:     SENSE KEY:  No Additional Sense
Oct  2 22:33:30 dirt /netbsd:                 EOM Detected
Oct  2 22:33:30 dirt /netbsd:      ASC/ASCQ:  End-Of-Partition/Medium Detected
Oct  2 22:33:30 dirt /netbsd: 
Oct  2 22:33:30 dirt /netbsd: st0(ahc0:5:0):  DEFERRED ERROR, key = 0x0
Oct  2 22:33:32 dirt /netbsd: st0(ahc0:5:0):  Check Condition on CDB: 0x0a 01 00 00 80 00
Oct  2 22:33:32 dirt /netbsd:     SENSE KEY:  No Additional Sense
Oct  2 22:33:32 dirt /netbsd:                 EOM Detected
Oct  2 22:33:32 dirt /netbsd:      ASC/ASCQ:  End-Of-Partition/Medium Detected
Oct  2 22:33:32 dirt /netbsd: 
Oct  2 22:33:34 dirt /netbsd: st0(ahc0:5:0):  Check Condition on CDB: 0x0a 01 00 00 80 00
Oct  2 22:33:34 dirt /netbsd:     SENSE KEY:  No Additional Sense
Oct  2 22:33:34 dirt /netbsd:                 EOM Detected
Oct  2 22:33:34 dirt /netbsd:      ASC/ASCQ:  End-Of-Partition/Medium Detected
Oct  2 22:33:34 dirt /netbsd: 
Oct  2 22:33:36 dirt /netbsd: st0(ahc0:5:0):  Check Condition on CDB: 0x10 00 00 00 01 00
Oct  2 22:33:36 dirt /netbsd:     SENSE KEY:  No Additional Sense
Oct  2 22:33:36 dirt /netbsd:                 EOM Detected
Oct  2 22:33:36 dirt /netbsd:      ASC/ASCQ:  End-Of-Partition/Medium Detected
Oct  2 22:33:36 dirt /netbsd: 


I apologize up front for not being more SCSI conversant, but I would like
to take a shot at fixing this...

What is the meaning of DEFERRED ERROR in this context..? Is the EOM error
being deferred until the next time I try and read/write the tape
(e.g. volume 2 of the dump)?  Why?

Can I approach this by clearing deferred errors in the driver when a new
tape is mounted?  How/Where would I clear such a pending error? 

I'm assuming four EOM errors from three slaves + parent in dump, would
that be expected, or is that another clue?

There were no errors at the time of inserting the second tape, checking
it's status, and then continuing the dump (except for the fatal "EOT
detected at start of the tape!")

    Thanks for any help on trying to fix this.

    - Scott Presnell

dirt# /sbin/dump 0ucBbf 4194304 128 /dev/nrst0 /usr/share/mp3
  DUMP: Date of this level 0 dump: Wed Oct  2 20:10:13 2002
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rwd2e (/usr/share/mp3) to /dev/nrst0
  DUMP: Label: none
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 4325032 tape blocks on 1.03 tape(s).
  DUMP: Volume 1 started at: Wed Oct  2 20:10:43 2002
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: 3.34% done, finished in 2:24
  DUMP: ...
  DUMP: 93.09% done, finished in 0:10
  DUMP: End of tape detected
  DUMP: Closing /dev/nrst0
  DUMP: Volume 1 completed at: Wed Oct  2 22:33:36 2002
  DUMP: Volume 1 took 2:22:53
  DUMP: Volume 1 transfer rate: 479 KB/s
  DUMP: Change Volumes: Mount volume #2
  DUMP: Is the new volume mounted and ready to go?: ("yes" or "no") yes
  DUMP: Volume 2 started at: Thu Oct  3 05:55:40 2002
  DUMP: Volume 2 begins with blocks from inode 478147
  DUMP: EOT detected at start of the tape!
  DUMP: The ENTIRE dump is aborted.