EIO vs. ENOENT on disk failure

Philip Molter
Mon, 10 May 2004 18:48:59 -0000

I've got a filesystem-based JBOD setup.  During testing, I failed
out one of the drives and tried to access the filesystem on it.
Here are the results I got:

stat /disk                              succeeds
open /disk for reading                  succeeds
readdir (getdents) for /disk            fails EIO
open /disk/noexist for reading          fails ENOENT
open /disk/noexist for writing          fails EIO
open /disk/exists for reading           fails ENOENT
open /disk/exit for writing             fails EIO
open /disk/subdir/noexist for reading   fails ENOENT
open /disk/subdir/noexist for writing   fails ENOENT
open /disk/subdir/exist for reading     fails ENOENT
open /disk/subdir/exist for writing     fails ENOENT

I would expect every one of these to fail with an EIO given that
the underlying disk is gone and that's the cause of the failure.
What's the logic behind returning ENOENT for stats and opens when
the disk isn't there?

Thanks,
Philip

* Philip Molter
* Texas.Net Internet
* http://www.texas.net/
* philip at texas.net