From: Christoph Lameter The following patch removes the f_error field and all checks of f_error. Trond said: f_error was introduced for NFS, and made sense when we were guaranteed always to have a file pointer around when write errors occurred. Since then, we have (for various reasons) had to introduce the nfs_open_context in order to track the file read/write state, and it made sense to move our f_error tracking there too. Signed-off-by: Christoph Lameter Acked-by: Trond Myklebust Signed-off-by: Andrew Morton --- fs/nfs/direct.c | 5 ----- fs/open.c | 16 ++++------------ include/linux/fs.h | 1 - mm/filemap.c | 6 ------ 4 files changed, 4 insertions(+), 24 deletions(-) diff -puN fs/nfs/direct.c~remove-f_error-field-from-struct-file fs/nfs/direct.c --- 25/fs/nfs/direct.c~remove-f_error-field-from-struct-file Mon Jun 6 15:32:01 2005 +++ 25-akpm/fs/nfs/direct.c Mon Jun 6 15:32:02 2005 @@ -751,11 +751,6 @@ nfs_file_direct_write(struct kiocb *iocb retval = -EFAULT; if (!access_ok(VERIFY_READ, iov.iov_base, iov.iov_len)) goto out; - if (file->f_error) { - retval = file->f_error; - file->f_error = 0; - goto out; - } retval = -EFBIG; if (limit != RLIM_INFINITY) { if (pos >= limit) { diff -puN fs/open.c~remove-f_error-field-from-struct-file fs/open.c --- 25/fs/open.c~remove-f_error-field-from-struct-file Mon Jun 6 15:32:02 2005 +++ 25-akpm/fs/open.c Mon Jun 6 15:32:02 2005 @@ -980,23 +980,15 @@ asmlinkage long sys_creat(const char __u */ int filp_close(struct file *filp, fl_owner_t id) { - int retval; - - /* Report and clear outstanding errors */ - retval = filp->f_error; - if (retval) - filp->f_error = 0; + int retval = 0; if (!file_count(filp)) { printk(KERN_ERR "VFS: Close: file count is 0\n"); - return retval; + return 0; } - if (filp->f_op && filp->f_op->flush) { - int err = filp->f_op->flush(filp); - if (!retval) - retval = err; - } + if (filp->f_op && filp->f_op->flush) + retval = filp->f_op->flush(filp); dnotify_flush(filp, id); locks_remove_posix(filp, id); diff -puN include/linux/fs.h~remove-f_error-field-from-struct-file include/linux/fs.h --- 25/include/linux/fs.h~remove-f_error-field-from-struct-file Mon Jun 6 15:32:02 2005 +++ 25-akpm/include/linux/fs.h Mon Jun 6 15:32:02 2005 @@ -581,7 +581,6 @@ struct file { atomic_t f_count; unsigned int f_flags; mode_t f_mode; - int f_error; loff_t f_pos; struct fown_struct f_owner; unsigned int f_uid, f_gid; diff -puN mm/filemap.c~remove-f_error-field-from-struct-file mm/filemap.c --- 25/mm/filemap.c~remove-f_error-field-from-struct-file Mon Jun 6 15:32:02 2005 +++ 25-akpm/mm/filemap.c Mon Jun 6 15:32:02 2005 @@ -1827,12 +1827,6 @@ inline int generic_write_checks(struct f if (unlikely(*pos < 0)) return -EINVAL; - if (unlikely(file->f_error)) { - int err = file->f_error; - file->f_error = 0; - return err; - } - if (!isblk) { /* FIXME: this is for backwards compatibility with 2.4 */ if (file->f_flags & O_APPEND) _