Subject: Poor behavior on I/O error...
To: None <tech-kern@netbsd.org>
From: Michael Lyle <mlyle@recourse.net>
List: tech-kern
Date: 04/21/2001 18:01:52
Something else that I've run into a few times that I'd like to fix is 
poor handling of fd error conditions..  For instance, if one tries to
dd a floppy but there is no floppy in the drive, one gets a rather
large set of errors:

fd0a: hard error writing fsbn 984 of 984-987 (st0 40<abnrml> st1 2<write_protect> st2 0 cyl 27 head 0 sec 13)
fd0a: hard error writing fsbn 988 of 988-991 (st0 40<abnrml> st1 2<write_protect> st2 0 cyl 27 head 0 sec 17)
fd0a: hard error writing fsbn 992 of 992-995 (st0 44<abnrml,top_head> st1 2<write_protect> st2 0 cyl 27 head 1 sec 3)
fd0a: hard error writing fsbn 996 of 996-999 (st0 44<abnrml,top_head> st1 2<write_protect> st2 0 cyl 27 head 1 sec 7)

and the floppy drive continues whirring as each write operation
is attempted, and the dd process hangs for 7-8 minutes.

My idea of how to solve this is to keep a flag as to whether the disk
is usable..  it would be set to true when the disk device is opened or
a disk change event occurs;  and it would be set to false when a large
number of consecutive errors occur.  if the flag is false, fdstrategy
would discard the I/O operations.  

Comments?

Mike

-- 
Michael P. Lyle