On Thu, Jun 16, 2005 at 04:40:45AM +0900, Kenichi Okuyama wrote:
> Ted> And while the write()
> Ted> which causes an I/O error that remounts the filesystem read/only can
> Ted> (and probably does) return EIO
> No. they return EROFS from beginning.
No, trust me, the *first* read/write to a device which is returning
errors is returning EIO. But it might not be the application which
you are testing. It might be an attempt to update the inode last
access time that fails, so it might not even be returned to user space
But once the filesystem is remounted read-only the reason why EROFS is
being returned is not because of an I/O error, but because the
filesystem is now read-only. It makes perfect sense, if you think
like a computer....
> The point is pretty easy ( I think ).
> Q1. Why does file system succeed in re-mounting as r/o, when device
> is totally lost?
That's because right now there is no way for block devices to inform
the filesystem that device is totally gone.
> But in case of Mr. Qu's test, device is lost. USB cabel is
> unplugged. They are unreachable. How could such device be *MOUNTED*?
> # In other word, why can't I mount device which does not exist,
> # while I can re-mount them?
Because remounting a filesystem means toggling the in-core data
structures that writes are no longer being tolerated. It doesn't
require reading from the device, which a fresh mount requires.
> 1) devices and file systems are still under control of kernel.
> 2) devices or file systems are not under control of kernel anymore.
> I do agree that, for devices, it is device driver's responsibility
> to identify which type of error have arised. But when file system
> recieved type 2 error, he should not change it to type 1 error
> ( unless fs could really guarantee that ).
> And, therefore, for type 2, I belive they can be standardize, and I
> think we should.
The problem is the filesystem right now can't tell the difference
between type 1 and type 2 errors. All we know is that an attempt to
read or write from a block as failed. We don't know why it failed.
I agree that *if* the filesystem could be told that a block device has
disappeared, then we should do the equivalent of umount -l on the
filesystem, and revoke all open file descriptors, much like the BSD
revoke(2) system call.
But this isn't matter of "standardizing" error returns, but rather a