Tape UNSAFE error

utzoo!decvax!watmath!dmmartindale utzoo!decvax!watmath!dmmartindale
Sun Dec 13 04:46:38 AEST 1981


I suspect the problem with the TM11 UNSAFE is identical to the
same bug in the ht driver.  What happens is that the first open
attempt causes a SENSE operation to be done; this sets UNSAFE if
the drive is offline.  When the second open attempt is made, the
error bit is still sitting there but gets cleared in the process
of checking.  I fixed it by making sure a drive clear is done if
necessary.  Below are the changes I made in ht.c; it shouldn't be
too difficult to find the corresponding places in tm.c.
(this code may be more conservative than it needs to be)

htustart(mi)
	register struct mba_device *mi;
{
	register struct htdevice *htaddr =
	    (struct htdevice *)mi->mi_drv;
	register struct buf *bp = mi->mi_tab.b_actf;
	register struct tu_softc *sc = &tu_softc[TUUNIT(bp->b_dev)];
	daddr_t blkno;
#ifdef FIX
	int sense = 0;
#endif FIX

	htaddr->httc = sc->sc_dens;
	if (bp == &chtbuf[HTUNIT(bp->b_dev)] && bp->b_command == HT_SENSE) {
		htaddr->htcs1 = HT_SENSE|HT_GO;
		mbclrattn(mi);
#ifdef FIX
		sense++;
#endif FIX
	}
	sc->sc_dsreg = htaddr->htds;
	sc->sc_erreg = htaddr->hter;
	sc->sc_resid = htaddr->htfc;
	sc->sc_flags &= ~(H_WRITTEN|H_REWIND);
	if ((htaddr->htdt & HTDT_SPR) == 0 || (htaddr->htds & HTDS_MOL) == 0)
		if (sc->sc_openf > 0)
			sc->sc_openf = -1;
#ifdef FIX
	if (sense && (htaddr->htds&HTDS_ERR)!=0)
		htaddr->htcs1 = HT_DCLR|HT_GO;
#endif FIX
	if (sc->sc_openf < 0) {
		bp->b_flags |= B_ERROR;
		return (MBU_NEXT);
	}



More information about the Comp.bugs.4bsd.ucb-fixes mailing list