Subject: Re: Long rewind time on atapi tape drive
To: Paul Goyette <paul@whooppee.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: current-users
Date: 10/09/2007 21:39:31
On Tue, Oct 09, 2007 at 08:57:23AM -0700, Paul Goyette wrote:
> I've got a Travan-20 tape drive that frequently takes longer than one 
> minute (sometimes as much as two full minutes) to rewind the tape, 
> resulting in a lost interrupt:
> 
> 	viaide0:0:0: lost interrupt
> 	        type: atapi tc_bcount: 0 tc_skip: 0
> 
> If this is done as part of a "mt rewoff" (rewind and offline) command, 
> the offline part never happens and the tape is not unloaded.
> 
> I've narrowed this down to the following code in sys/dev/scsipi/st.c
> 
> /*
>  *  Rewind the device
>  */
> static int
> st_rewind(struct st_softc *st, u_int immediate, int flags)
> {
> 	struct scsi_rewind cmd;
> 	int error;
> 	int nmarks;
> 
> 	...
> 
> 	/*
> 	 * ATAPI tapes always need immediate to be set
> 	 */
> 	if (scsipi_periph_bustype(st->sc_periph) == SCSIPI_BUSTYPE_ATAPI)
> 		immediate = SR_IMMED;
> 
> 	memset(&cmd, 0, sizeof(cmd));
> 	cmd.opcode = REWIND;
> 	cmd.byte2 = immediate;
> 
> 	error = scsipi_command(st->sc_periph, (void *)&cmd, sizeof(cmd), 0, 
> 	0,
> 	    ST_RETRIES, immediate ? ST_CTL_TIME: ST_SPC_TIME, NULL, flags);
> 	...
> 
> ST_SPC_TIME is a fairly long (4 hours!) delay which might be rather 
> excessive to wait, but ST_CTL_TIME is only 30 seconds which is 
> definitely not enough time for the tape to rewind.
> 
> Is this really the right thing to do?  If so, is it unreasonable to 
> increase the value of ST_CTL_TIME to something closer to the typical 
> reality of two minutes?

Yes, it makes sense. I suspect that some LTO drives might time out too ...

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--