[RFD] What error should FS return when I/O failure occurs?

From: fs
Date: Mon May 16 2005 - 01:08:16 EST


Hi, ML subscribers,

I'm taking part in the project DOUBT[1], and my sub-project
focuses on the consistency and coherency of FS[2].
There is something I'm still confused - What error should FS
return when I/O failure occurs? It seems there are no relevant
documents or standards on this issue.

I'll just show some examples to make things clear:
1. For EXT3 partition , we mount it as RW, but when I/O occurs, the
I/O related functions return EROFS(ReadOnly?), while other FSes
return EIO.
2. Assume a program doing the following: open - write(async) - close
When user-mode app calls sys_write, for EXT2/JFS, no error
returns, for EXT3, EROFS returns, for XFS/ReiserFS, EIO returns.

I know each FS has its own implementation, but from users'
perspective, they don't care what FS they're using. So, when
handling errors from syscall, they can't do the following(p-code):
ret = sys_write(fd, buf, size);
if(ret < 0){
/* the following is I/O failure related. */
if((IsEXT3() && errno == EROFS) ||
((IsXFS() || IsReiserFS()) && errno == EIO)){
/* do some things about I/O failure */
....
}else{
....
}
}
When I/O failure occurs, there should be some standards which
define the ONLY error that should be returned from VFS, right?
What they should do is (p-code):
ret = sys_write(fd, buf, size);
if(ret < 0){
if(errno == EIO){
...
}else
...
}


Ref
[1]http://developer.osdl.jp/projects/doubt/
[2]http://developer.osdl.jp/projects/doubt/fs-consistency-and-coherency/index.html

regards,
----
Qu Fuping


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/