suggested ways of faking EIO?

Julian Elischer julian at
Fri Nov 23 20:34:04 PST 2007

I need to make physio make a request from disk, and have the request
come back asynchronously with an EIO. 

I have tried just reading some distance past the end of a partition, but
I'm not totally convinced that it acts exactly like as if I'd tried to read 
a bad sector. Since geom has been added, the legality of a read needs to be tested
in the geometry layer, so I suppose it must come back asynchronously, as 
that is no longer directly executed through function calls but is it
really the same as a disk failure?

Anyone done this? or does anyone have a disk with a known bad sector
I can try my test case on? :-)

the actual case in quesiton is an AIO operation that gets an error,
reported back via Kqueue.

The bug is to find out whether the correct info is fed back
by both kqueue and aio.

BTW my little test program is at:

BTW2 it took me a little time  to write it but I think it could be cleaned 
up a but and put in the documentation as sample code as to how to use kqueue 
together with AIO as I didn't find any examples of how to do this.

I'm looking at this because I received a report that
kqueue wasn't reporting the error correctly,
but this program shows to to be doing so.

For this reason I'm trying to see if I'm testing the wrong thing.

More information about the freebsd-current mailing list