Subject: Re: port-i386/2080: panic when dd-ing to floppy
To: Arne Juul <arnej@imf.unit.no>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: netbsd-bugs
Date: 02/15/1996 14:44:30
Re. the disk_unbusy() panic...I recently checked in a change that should 
have fixed this problem...at least, it did for a couple of folks...

Which revision of fd.c are you using?  Here's which one is fixed:

/*      $NetBSD: fd.c,v 1.84 1996/02/10 18:31:13 thorpej Exp $  */

Look in fdcretry() ... it should be setting the state to DOSEEK instead 
of SEEKCOMPLETE in the first case.

If that's not the problem, could you please turn on debugging in the 
driver?  I don't have easy access to x86 systems with floppies, and I 
can't reproduce this on my SPARC (very similar driver).  There are only 
two states which can call disk_unbusy(): SEEKCOMPLETE and IOCOMPLETE, and 
they are only set from the SEEKWAIT and DOIO states, respectively.  
SEEKWAIT is set from DOSEEK.  DOSEEK and DOIO are the only two states 
which call disk_busy().  The pattern typically looks like this:

DOSEEK->SEEKWAIT->SEEKCOMPLETE->DOIO->IOCOMPLETE
 busy              unbusy       busy   unbusy

fdcretry() is safe by starting it at the beginning of the cycle.  At 
worst case, you should have *extra* busies, which could happen in the 
case of timeouts.  (I'm not really sure how to safely check for that...)

--------------------------------------------------------------------------
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939