Subject: Re: "Device Busy", how to clear?
To: maximum entropy <entropy@zippy.bernstein.com>
From: Anders Magnusson <ragge@ludd.luth.se>
List: port-vax
Date: 12/09/1998 19:35:18
> >From: Rick Copeland <rickgc@calweb.com>
> >
> >I am using a uVAX 3600 with a TU81+, now and then I get a "device busy"
> >after I execute a command like mt -f /dev/nrmt0 fsf 2 when the tape deck is
> >offline (at the deck).  How do I clear this "device busy" with out having
> >to down the entire system?
> 
> I suspect there's a bug in /sys/arch/vax/mscp/mscp_tape.c:mtopen().
> 
>         if (mt->mt_inuse)
>                         return EBUSY;
>         mt->mt_inuse = 1;
> 
>         if (mt_putonline(mt) == MSCP_FAILED)
>                 return EIO;
> 
>         return 0;
> 
> If mt_putonline() fails, mt->mt_inuse will be set but the device won't
> be opened.  It will therefore never get closed, and will be stuck
> always returning EBUSY ("device busy").  I think the mt->mt_inuse flag
> should be set just before the return.
> 
Correct, that't the bug, I'll fix it now, but mt_inuse must be set before
mt_putonline() is called, so I'll clear mt_inuse if mt_putonline() fails
instead of setting it later. Thanks for this report.

-- Ragge