]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fix for fsync ignoring writing errors
authorAndrey V. Savochkin <saw@saw.sw.com.sg>
Fri, 17 Sep 2004 05:03:20 +0000 (22:03 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 17 Sep 2004 05:03:20 +0000 (22:03 -0700)
Currently metadata writing errors are ignored and not returned from
sys_fsync on ext2 and ext3 filesystems.  That is, at least ext2 and ext3.

Both ext2 and ext3 resort to sync_inode() in their ->sync_inode method,
which in turn calls ->write_inode.  ->write_inode method has void type, and
any IO errors happening inside are lost.

Make ->write_inode return the error code?

Signed-off-by: Andrey Savochkin <saw@saw.sw.com.sg>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
38 files changed:
Documentation/filesystems/Locking
Documentation/filesystems/vfs.txt
fs/adfs/adfs.h
fs/adfs/inode.c
fs/affs/inode.c
fs/bfs/inode.c
fs/ext2/ext2.h
fs/ext2/inode.c
fs/ext3/inode.c
fs/fat/inode.c
fs/fs-writeback.c
fs/hfs/hfs_fs.h
fs/hfs/inode.c
fs/hfsplus/hfsplus_fs.h
fs/hfsplus/inode.c
fs/hfsplus/super.c
fs/jfs/inode.c
fs/jfs/super.c
fs/minix/inode.c
fs/nfs/inode.c
fs/ntfs/inode.c
fs/ntfs/inode.h
fs/ntfs/super.c
fs/qnx4/inode.c
fs/reiserfs/inode.c
fs/sysv/inode.c
fs/sysv/sysv.h
fs/udf/inode.c
fs/udf/udfdecl.h
fs/ufs/inode.c
fs/umsdos/inode.c
fs/xfs/linux-2.6/xfs_super.c
include/linux/affs_fs.h
include/linux/ext3_fs.h
include/linux/fs.h
include/linux/msdos_fs.h
include/linux/reiserfs_fs.h
include/linux/ufs_fs.h

index 1c23acfb6041902e6aa4c54932f630ddb03765e7..f1c2cee131b454e9838d942459044d3067435d74 100644 (file)
@@ -90,7 +90,7 @@ prototypes:
        void (*destroy_inode)(struct inode *);
        void (*read_inode) (struct inode *);
        void (*dirty_inode) (struct inode *);
-       void (*write_inode) (struct inode *, int);
+       int (*write_inode) (struct inode *, int);
        void (*put_inode) (struct inode *);
        void (*drop_inode) (struct inode *);
        void (*delete_inode) (struct inode *);
index 9557ea1846d2cdcb509443d87acd88c12bac8796..5be10c915614210fece4627d97a6dbe0987793b2 100644 (file)
@@ -176,7 +176,7 @@ filesystem. As of kernel 2.1.99, the following members are defined:
 
 struct super_operations {
        void (*read_inode) (struct inode *);
-       void (*write_inode) (struct inode *, int);
+       int (*write_inode) (struct inode *, int);
        void (*put_inode) (struct inode *);
        void (*drop_inode) (struct inode *);
        void (*delete_inode) (struct inode *);
index b9ff42b381e6c95a1d306b67fcc50f091e2297d0..63f5df9afb71f96c5e649fbb0f2c6cf3275513b6 100644 (file)
@@ -66,7 +66,7 @@ struct adfs_discmap {
 
 /* Inode stuff */
 struct inode *adfs_iget(struct super_block *sb, struct object_info *obj);
-void adfs_write_inode(struct inode *inode,int unused);
+int adfs_write_inode(struct inode *inode,int unused);
 int adfs_notify_change(struct dentry *dentry, struct iattr *attr);
 
 /* map.c */
index 1b5d81edbf55075cc871e6749b718710a07edee9..fee82147f687b9607e102e4fa4251680a1b43e76 100644 (file)
@@ -373,10 +373,11 @@ out:
  * The adfs-specific inode data has already been updated by
  * adfs_notify_change()
  */
-void adfs_write_inode(struct inode *inode, int unused)
+int adfs_write_inode(struct inode *inode, int unused)
 {
        struct super_block *sb = inode->i_sb;
        struct object_info obj;
+       int ret;
 
        lock_kernel();
        obj.file_id     = inode->i_ino;
@@ -387,7 +388,8 @@ void adfs_write_inode(struct inode *inode, int unused)
        obj.attr        = ADFS_I(inode)->attr;
        obj.size        = inode->i_size;
 
-       adfs_dir_update(sb, &obj);
+       ret = adfs_dir_update(sb, &obj);
        unlock_kernel();
+       return ret;
 }
 MODULE_LICENSE("GPL");
index 9f929f70640c5af508523eb6748042604adedf84..3142f402e659e72e935efca6493f52c034291168 100644 (file)
@@ -181,7 +181,7 @@ bad_inode:
        return;
 }
 
-void
+int
 affs_write_inode(struct inode *inode, int unused)
 {
        struct super_block      *sb = inode->i_sb;
@@ -194,11 +194,11 @@ affs_write_inode(struct inode *inode, int unused)
 
        if (!inode->i_nlink)
                // possibly free block
-               return;
+               return 0;
        bh = affs_bread(sb, inode->i_ino);
        if (!bh) {
                affs_error(sb,"write_inode","Cannot read block %lu",inode->i_ino);
-               return;
+               return -EIO;
        }
        tail = AFFS_TAIL(sb, bh);
        if (tail->stype == cpu_to_be32(ST_ROOT)) {
@@ -226,6 +226,7 @@ affs_write_inode(struct inode *inode, int unused)
        mark_buffer_dirty_inode(bh, inode);
        affs_brelse(bh);
        affs_free_prealloc(inode);
+       return 0;
 }
 
 int
index b163efd7a2708d5d75ef7ce6bf71a4c92f7e1542..f01ebd700f20ab2d1d6292d0abe7941df1917b70 100644 (file)
@@ -85,7 +85,7 @@ static void bfs_read_inode(struct inode * inode)
        brelse(bh);
 }
 
-static void bfs_write_inode(struct inode * inode, int unused)
+static int bfs_write_inode(struct inode * inode, int unused)
 {
        unsigned long ino = inode->i_ino;
        struct bfs_inode * di;
@@ -94,7 +94,7 @@ static void bfs_write_inode(struct inode * inode, int unused)
 
        if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) {
                printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino);
-               return;
+               return -EIO;
        }
 
        lock_kernel();
@@ -103,7 +103,7 @@ static void bfs_write_inode(struct inode * inode, int unused)
        if (!bh) {
                printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino);
                unlock_kernel();
-               return;
+               return -EIO;
        }
 
        off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK;
@@ -129,6 +129,7 @@ static void bfs_write_inode(struct inode * inode, int unused)
        mark_buffer_dirty(bh);
        brelse(bh);
        unlock_kernel();
+       return 0;
 }
 
 static void bfs_delete_inode(struct inode * inode)
index 9d8770e8af0f12b22a692d474539d1fc83c671d2..80faa8694ddbba0399194eccf205c99688305497 100644 (file)
@@ -115,7 +115,7 @@ extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
 
 /* inode.c */
 extern void ext2_read_inode (struct inode *);
-extern void ext2_write_inode (struct inode *, int);
+extern int ext2_write_inode (struct inode *, int);
 extern void ext2_put_inode (struct inode *);
 extern void ext2_delete_inode (struct inode *);
 extern int ext2_sync_inode (struct inode *);
index a77e96a1a00f642137d7fdc4b10697d0ade52f48..02d2635d8fe454598325fd5d65ca8c4aab371da3 100644 (file)
@@ -1248,9 +1248,9 @@ static int ext2_update_inode(struct inode * inode, int do_sync)
        return err;
 }
 
-void ext2_write_inode(struct inode *inode, int wait)
+int ext2_write_inode(struct inode *inode, int wait)
 {
-       ext2_update_inode(inode, wait);
+       return ext2_update_inode(inode, wait);
 }
 
 int ext2_sync_inode(struct inode *inode)
index c976ddfa1a2263acedb2de9586a22203ffc1273a..41101698b3aa3350d67ccadd182d5e26164068e3 100644 (file)
@@ -2745,21 +2745,21 @@ out_brelse:
  * `stuff()' is running, and the new i_size will be lost.  Plus the inode
  * will no longer be on the superblock's dirty inode list.
  */
-void ext3_write_inode(struct inode *inode, int wait)
+int ext3_write_inode(struct inode *inode, int wait)
 {
        if (current->flags & PF_MEMALLOC)
-               return;
+               return 0;
 
        if (ext3_journal_current_handle()) {
                jbd_debug(0, "called recursively, non-PF_MEMALLOC!\n");
                dump_stack();
-               return;
+               return -EIO;
        }
 
        if (!wait)
-               return;
+               return 0;
 
-       ext3_force_commit(inode->i_sb);
+       return ext3_force_commit(inode->i_sb);
 }
 
 /*
index e8e6ea386ff376a8447bcaa31892f4f565ce91ca..d304cecd296ac544ddd3cf4b62edf89efd7ce99b 100644 (file)
@@ -1227,7 +1227,7 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
        return 0;
 }
 
-void fat_write_inode(struct inode *inode, int wait)
+int fat_write_inode(struct inode *inode, int wait)
 {
        struct super_block *sb = inode->i_sb;
        struct buffer_head *bh;
@@ -1237,14 +1237,14 @@ void fat_write_inode(struct inode *inode, int wait)
 retry:
        i_pos = MSDOS_I(inode)->i_pos;
        if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) {
-               return;
+               return 0;
        }
        lock_kernel();
        if (!(bh = sb_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) {
                printk(KERN_ERR "FAT: unable to read inode block "
                       "for updating (i_pos %lld)\n", i_pos);
                unlock_kernel();
-               return /* -EIO */;
+               return -EIO;
        }
        spin_lock(&fat_inode_lock);
        if (i_pos != MSDOS_I(inode)->i_pos) {
@@ -1277,6 +1277,7 @@ retry:
        mark_buffer_dirty(bh);
        brelse(bh);
        unlock_kernel();
+       return 0;
 }
 
 
index 09d33fad10effb11dd39cd70094b92aed0766e72..f200e0b33ccc6e4fa14f6530012da8c38239ac1f 100644 (file)
@@ -133,10 +133,11 @@ out:
 
 EXPORT_SYMBOL(__mark_inode_dirty);
 
-static void write_inode(struct inode *inode, int sync)
+static int write_inode(struct inode *inode, int sync)
 {
        if (inode->i_sb->s_op->write_inode && !is_bad_inode(inode))
-               inode->i_sb->s_op->write_inode(inode, sync);
+               return inode->i_sb->s_op->write_inode(inode, sync);
+       return 0;
 }
 
 /*
@@ -170,8 +171,11 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
        ret = do_writepages(mapping, wbc);
 
        /* Don't write the inode if only I_DIRTY_PAGES was set */
-       if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC))
-               write_inode(inode, wait);
+       if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) {
+               int err = write_inode(inode, wait);
+               if (ret == 0)
+                       ret = err;
+       }
 
        if (wait) {
                int err = filemap_fdatawait(mapping);
index ba764a1eb444ac12d27a3e2f106bf34132d518b1..2ea973d20a7c2eb82de561870b3a9c15db8e91a8 100644 (file)
@@ -198,7 +198,7 @@ extern struct address_space_operations hfs_btree_aops;
 
 extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int);
 extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, u32 *, u32 *);
-extern void hfs_write_inode(struct inode *, int);
+extern int hfs_write_inode(struct inode *, int);
 extern int hfs_inode_setattr(struct dentry *, struct iattr *);
 extern void hfs_inode_read_fork(struct inode *inode, struct hfs_extent *ext,
                                u32 log_size, u32 phys_size, u32 clump_size);
index 29d65f9c72ffbe0fab4bbf69f686f98ffd9ffa21..1bda3a6ae2b403167579ee718360fc663dbbb0ad 100644 (file)
@@ -381,7 +381,7 @@ void hfs_inode_write_fork(struct inode *inode, struct hfs_extent *ext,
                                         HFS_SB(inode->i_sb)->alloc_blksz);
 }
 
-void hfs_write_inode(struct inode *inode, int unused)
+int hfs_write_inode(struct inode *inode, int unused)
 {
        struct hfs_find_data fd;
        hfs_cat_rec rec;
@@ -395,27 +395,27 @@ void hfs_write_inode(struct inode *inode, int unused)
                        break;
                case HFS_EXT_CNID:
                        hfs_btree_write(HFS_SB(inode->i_sb)->ext_tree);
-                       return;
+                       return 0;
                case HFS_CAT_CNID:
                        hfs_btree_write(HFS_SB(inode->i_sb)->cat_tree);
-                       return;
+                       return 0;
                default:
                        BUG();
-                       return;
+                       return -EIO;
                }
        }
 
        if (HFS_IS_RSRC(inode)) {
                mark_inode_dirty(HFS_I(inode)->rsrc_inode);
-               return;
+               return 0;
        }
 
        if (!inode->i_nlink)
-               return;
+               return 0;
 
        if (hfs_find_init(HFS_SB(inode->i_sb)->cat_tree, &fd))
                /* panic? */
-               return;
+               return -EIO;
 
        fd.search_key->cat = HFS_I(inode)->cat_key;
        if (hfs_brec_find(&fd))
@@ -460,6 +460,7 @@ void hfs_write_inode(struct inode *inode, int unused)
        }
 out:
        hfs_find_exit(&fd);
+       return 0;
 }
 
 static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry,
index 9d35b9fbc2a6eba139c75cadb53dd067802d9380..57b6ec7bc833416ec53b69027391976ef87d9c5a 100644 (file)
@@ -333,7 +333,7 @@ extern struct address_space_operations hfsplus_btree_aops;
 void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *);
 void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *);
 int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *);
-void hfsplus_cat_write_inode(struct inode *);
+int hfsplus_cat_write_inode(struct inode *);
 struct inode *hfsplus_new_inode(struct super_block *, int);
 void hfsplus_delete_inode(struct inode *);
 
index 7ac2360c0227a3445bb9fa500158af0742f87965..eff1c987b6fb08acec4927cc1773b6c5e0419982 100644 (file)
@@ -484,22 +484,22 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
        return res;
 }
 
-void hfsplus_cat_write_inode(struct inode *inode)
+int hfsplus_cat_write_inode(struct inode *inode)
 {
        struct hfs_find_data fd;
        hfsplus_cat_entry entry;
 
        if (HFSPLUS_IS_RSRC(inode)) {
                mark_inode_dirty(HFSPLUS_I(inode).rsrc_inode);
-               return;
+               return 0;
        }
 
        if (!inode->i_nlink)
-               return;
+               return 0;
 
        if (hfs_find_init(HFSPLUS_SB(inode->i_sb).cat_tree, &fd))
                /* panic? */
-               return;
+               return -EIO;
 
        if (hfsplus_find_cat(inode->i_sb, inode->i_ino, &fd))
                /* panic? */
@@ -547,4 +547,5 @@ void hfsplus_cat_write_inode(struct inode *inode)
        }
 out:
        hfs_find_exit(&fd);
+       return 0;
 }
index 16e6dd8ca896f7db6b7d3e93f2c0f1872dbc80d3..4ff176a0bb58380bfe38f83bfc16a39bc63390ee 100644 (file)
@@ -94,20 +94,20 @@ static void hfsplus_read_inode(struct inode *inode)
        make_bad_inode(inode);
 }
 
-void hfsplus_write_inode(struct inode *inode, int unused)
+int hfsplus_write_inode(struct inode *inode, int unused)
 {
        struct hfsplus_vh *vhdr;
+       int ret = 0;
 
        dprint(DBG_INODE, "hfsplus_write_inode: %lu\n", inode->i_ino);
        hfsplus_ext_write_extent(inode);
        if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID) {
-               hfsplus_cat_write_inode(inode);
-               return;
+               return hfsplus_cat_write_inode(inode);
        }
        vhdr = HFSPLUS_SB(inode->i_sb).s_vhdr;
        switch (inode->i_ino) {
        case HFSPLUS_ROOT_CNID:
-               hfsplus_cat_write_inode(inode);
+               ret = hfsplus_cat_write_inode(inode);
                break;
        case HFSPLUS_EXT_CNID:
                if (vhdr->ext_file.total_size != cpu_to_be64(inode->i_size)) {
@@ -148,6 +148,7 @@ void hfsplus_write_inode(struct inode *inode, int unused)
                hfs_btree_write(HFSPLUS_SB(inode->i_sb).attr_tree);
                break;
        }
+       return ret;
 }
 
 static void hfsplus_clear_inode(struct inode *inode)
index c5e219ef6ac36f43ec4f61877386d483e6f2a2f7..d94abccb9fb1bf49083f8a5f5664495026f0c924 100644 (file)
@@ -106,10 +106,10 @@ int jfs_commit_inode(struct inode *inode, int wait)
        return rc;
 }
 
-void jfs_write_inode(struct inode *inode, int wait)
+int jfs_write_inode(struct inode *inode, int wait)
 {
        if (test_cflag(COMMIT_Nolink, inode))
-               return;
+               return 0;
        /*
         * If COMMIT_DIRTY is not set, the inode isn't really dirty.
         * It has been committed since the last change, but was still
@@ -118,12 +118,14 @@ void jfs_write_inode(struct inode *inode, int wait)
         if (!test_cflag(COMMIT_Dirty, inode)) {
                /* Make sure committed changes hit the disk */
                jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait);
-               return;
+               return 0;
         }
 
        if (jfs_commit_inode(inode, wait)) {
                jfs_err("jfs_write_inode: jfs_commit_inode failed!");
-       }
+               return -EIO;
+       } else
+               return 0;
 }
 
 void jfs_delete_inode(struct inode *inode)
index f7ed6ad08af0fc97a09a4202b34c9bc60a59ba1c..7c91ccfe382f4068b8d793b1fcf7cf304c7af776 100644 (file)
@@ -77,7 +77,7 @@ extern int jfs_sync(void *);
 extern void jfs_read_inode(struct inode *inode);
 extern void jfs_dirty_inode(struct inode *inode);
 extern void jfs_delete_inode(struct inode *inode);
-extern void jfs_write_inode(struct inode *inode, int wait);
+extern int jfs_write_inode(struct inode *inode, int wait);
 
 extern struct dentry *jfs_get_parent(struct dentry *dentry);
 extern int jfs_extendfs(struct super_block *, s64, int);
index e93ebd55f8618b35475051f13fa44aea1adbef0e..3f18c21198d7e2a848573e539316844c3fe2e142 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/vfs.h>
 
 static void minix_read_inode(struct inode * inode);
-static void minix_write_inode(struct inode * inode, int wait);
+static int minix_write_inode(struct inode * inode, int wait);
 static int minix_statfs(struct super_block *sb, struct kstatfs *buf);
 static int minix_remount (struct super_block * sb, int * flags, char * data);
 
@@ -505,9 +505,10 @@ static struct buffer_head *minix_update_inode(struct inode *inode)
                return V2_minix_update_inode(inode);
 }
 
-static void minix_write_inode(struct inode * inode, int wait)
+static int minix_write_inode(struct inode * inode, int wait)
 {
        brelse(minix_update_inode(inode));
+       return 0;
 }
 
 int minix_sync_inode(struct inode * inode)
index e2795ce27c3df547fcbdf999cdb15e175a2356b7..e2188dd7526ce7837811c1a5fdec33d0321a266b 100644 (file)
@@ -57,7 +57,7 @@ static int nfs_update_inode(struct inode *, struct nfs_fattr *, unsigned long);
 
 static struct inode *nfs_alloc_inode(struct super_block *sb);
 static void nfs_destroy_inode(struct inode *);
-static void nfs_write_inode(struct inode *,int);
+static int nfs_write_inode(struct inode *,int);
 static void nfs_delete_inode(struct inode *);
 static void nfs_clear_inode(struct inode *);
 static void nfs_umount_begin(struct super_block *);
@@ -110,12 +110,16 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr)
        return nfs_fileid_to_ino_t(fattr->fileid);
 }
 
-static void
+static int
 nfs_write_inode(struct inode *inode, int sync)
 {
        int flags = sync ? FLUSH_WAIT : 0;
+       int ret;
 
-       nfs_commit_inode(inode, 0, 0, flags);
+       ret = nfs_commit_inode(inode, 0, 0, flags);
+       if (ret < 0)
+               return ret;
+       return 0;
 }
 
 static void
index d7ad46b84f60eea45c37d9dbefe0321090df954e..c44c0e50a415930bb4086bac48571c50d52c1147 100644 (file)
@@ -2453,28 +2453,4 @@ err_out:
        return err;
 }
 
-/**
- * ntfs_write_inode_vfs - write out a dirty inode
- * @vi:                inode to write out
- * @sync:      if true, write out synchronously
- *
- * Write out a dirty inode to disk including any extent inodes if present.
- *
- * If @sync is true, commit the inode to disk and wait for io completion.  This
- * is done using write_mft_record().
- *
- * If @sync is false, just schedule the write to happen but do not wait for i/o
- * completion.  In 2.6 kernels, scheduling usually happens just by virtue of
- * marking the page (and in this case mft record) dirty but we do not implement
- * this yet as write_mft_record() largely ignores the @sync parameter and
- * always performs synchronous writes.
- *
- * This functions does not have a return value which is the required behaviour
- * for the VFS super_operations ->dirty_inode function.
- */
-void ntfs_write_inode_vfs(struct inode *vi, int sync)
-{
-       ntfs_write_inode(vi, sync);
-}
-
 #endif /* NTFS_RW */
index b24d0435042ca2d459410ead69398aa586fdd8cb..589e75459bf0c88a9fe0d1a725793a2aec05a655 100644 (file)
@@ -286,7 +286,6 @@ extern void ntfs_truncate(struct inode *vi);
 extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr);
 
 extern int ntfs_write_inode(struct inode *vi, int sync);
-extern void ntfs_write_inode_vfs(struct inode *vi, int sync);
 
 static inline void ntfs_commit_inode(struct inode *vi)
 {
index 69a142e5c1e39b7a4a7ffb16d8f65d842a158730..78d09cc920cbebeb296c0d2b53418ab175643178 100644 (file)
@@ -2157,7 +2157,7 @@ struct super_operations ntfs_sops = {
 #ifdef NTFS_RW
        //.dirty_inode  = NULL,                 /* VFS: Called from
        //                                         __mark_inode_dirty(). */
-       .write_inode    = ntfs_write_inode_vfs, /* VFS: Write dirty inode to
+       .write_inode    = ntfs_write_inode,     /* VFS: Write dirty inode to
                                                   disk. */
        //.drop_inode   = NULL,                 /* VFS: Called just after the
        //                                         inode reference count has
index ed36a8bb72cd92aa1398f47b84ceab3bec35844c..664bb14649aeb4d98b386d0ae8144b22d8fa8558 100644 (file)
@@ -78,7 +78,7 @@ static void qnx4_write_super(struct super_block *sb)
        unlock_kernel();
 }
 
-static void qnx4_write_inode(struct inode *inode, int unused)
+static int qnx4_write_inode(struct inode *inode, int unused)
 {
        struct qnx4_inode_entry *raw_inode;
        int block, ino;
@@ -87,12 +87,12 @@ static void qnx4_write_inode(struct inode *inode, int unused)
 
        QNX4DEBUG(("qnx4: write inode 1.\n"));
        if (inode->i_nlink == 0) {
-               return;
+               return 0;
        }
        if (!ino) {
                printk("qnx4: bad inode number on dev %s: %d is out of range\n",
                       inode->i_sb->s_id, ino);
-               return;
+               return -EIO;
        }
        QNX4DEBUG(("qnx4: write inode 2.\n"));
        block = ino / QNX4_INODES_PER_BLOCK;
@@ -101,7 +101,7 @@ static void qnx4_write_inode(struct inode *inode, int unused)
                printk("qnx4: major problem: unable to read inode from dev "
                       "%s\n", inode->i_sb->s_id);
                unlock_kernel();
-               return;
+               return -EIO;
        }
        raw_inode = ((struct qnx4_inode_entry *) bh->b_data) +
            (ino % QNX4_INODES_PER_BLOCK);
@@ -117,6 +117,7 @@ static void qnx4_write_inode(struct inode *inode, int unused)
        mark_buffer_dirty(bh);
        brelse(bh);
        unlock_kernel();
+       return 0;
 }
 
 #endif
index 335e006236ff979fea0012f17d4810491c5e12ca..98ad240a52a4402d17b0b2d8c37b77006f8b45ec 100644 (file)
@@ -1504,7 +1504,7 @@ int reiserfs_encode_fh(struct dentry *dentry, __u32 *data, int *lenp, int need_p
 ** to properly mark inodes for datasync and such, but only actually
 ** does something when called for a synchronous update.
 */
-void reiserfs_write_inode (struct inode * inode, int do_sync) {
+int reiserfs_write_inode (struct inode * inode, int do_sync) {
     struct reiserfs_transaction_handle th ;
     int jbegin_count = 1 ;
 
@@ -1512,7 +1512,7 @@ void reiserfs_write_inode (struct inode * inode, int do_sync) {
         reiserfs_warning (inode->i_sb,
                          "clm-6005: writing inode %lu on readonly FS",
                          inode->i_ino) ;
-        return ;
+        return -EROFS;
     }
     /* memory pressure can sometimes initiate write_inode calls with sync == 1,
     ** these cases are just when the system needs ram, not when the 
@@ -1526,6 +1526,7 @@ void reiserfs_write_inode (struct inode * inode, int do_sync) {
        journal_end_sync(&th, inode->i_sb, jbegin_count) ;
        reiserfs_write_unlock(inode->i_sb);
     }
+    return 0;
 }
 
 /* FIXME: no need any more. right? */
index 45e077653a1d856965665daa6f4f918928ad9f59..0530077d9dd800b8e1fd897bae95edb524e1336e 100644 (file)
@@ -260,13 +260,14 @@ static struct buffer_head * sysv_update_inode(struct inode * inode)
        return bh;
 }
 
-void sysv_write_inode(struct inode * inode, int wait)
+int sysv_write_inode(struct inode * inode, int wait)
 {
        struct buffer_head *bh;
        lock_kernel();
        bh = sysv_update_inode(inode);
        brelse(bh);
        unlock_kernel();
+       return 0;
 }
 
 int sysv_sync_inode(struct inode * inode)
index 493b0a6a4f0e3765370f91130bd66c72e89b0b94..8620add65312195a97fd179baf8a13d3af68f523 100644 (file)
@@ -134,7 +134,7 @@ extern unsigned long sysv_count_free_blocks(struct super_block *);
 extern void sysv_truncate(struct inode *);
 
 /* inode.c */
-extern void sysv_write_inode(struct inode *, int);
+extern int sysv_write_inode(struct inode *, int);
 extern int sysv_sync_inode(struct inode *);
 extern int sysv_sync_file(struct file *, struct dentry *, int);
 extern void sysv_set_inode(struct inode *, dev_t);
index 769ad982298756dd04d5d401e3e992983bab4577..68245ca6ee555f6bdbf22c9676bd268372f1b4eb 100644 (file)
@@ -1316,11 +1316,13 @@ udf_convert_permissions(struct fileEntry *fe)
  *     Written, tested, and released.
  */
 
-void udf_write_inode(struct inode * inode, int sync)
+int udf_write_inode(struct inode * inode, int sync)
 {
+       int ret;
        lock_kernel();
-       udf_update_inode(inode, sync);
+       ret = udf_update_inode(inode, sync);
        unlock_kernel();
+       return ret;
 }
 
 int udf_sync_inode(struct inode * inode)
index c1eca9d055cfb076f66a474aa316f1d041de29e9..87a9331bafbf8fda939fb49d851caf9915e4e24c 100644 (file)
@@ -99,7 +99,7 @@ extern void udf_read_inode(struct inode *);
 extern void udf_put_inode(struct inode *);
 extern void udf_delete_inode(struct inode *);
 extern void udf_clear_inode(struct inode *);
-extern void udf_write_inode(struct inode *, int);
+extern int udf_write_inode(struct inode *, int);
 extern long udf_block_map(struct inode *, long);
 extern int8_t inode_bmap(struct inode *, int, kernel_lb_addr *, uint32_t *, kernel_lb_addr *, uint32_t *, uint32_t *, struct buffer_head **);
 extern int8_t udf_add_aext(struct inode *, kernel_lb_addr *, int *, kernel_lb_addr, uint32_t, struct buffer_head **, int);
index 06415ae89a85a271d9768bc17b61a472e7518fff..1923f8d102e79506d2eeddccfd321656a34bad3d 100644 (file)
@@ -788,11 +788,13 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
        return 0;
 }
 
-void ufs_write_inode (struct inode * inode, int wait)
+int ufs_write_inode (struct inode * inode, int wait)
 {
+       int ret;
        lock_kernel();
-       ufs_update_inode (inode, wait);
+       ret = ufs_update_inode (inode, wait);
        unlock_kernel();
+       return ret;
 }
 
 int ufs_sync_inode (struct inode *inode)
index 061c9bc36c7b713f522348f3ff8350dbb5b53e47..778feedf46425a0ba29ec53c76bdeb518ac5017f 100644 (file)
@@ -312,11 +312,12 @@ out:
 /*
  * Update the disk with the inode content
  */
-void UMSDOS_write_inode (struct inode *inode, int wait)
+int UMSDOS_write_inode (struct inode *inode, int wait)
 {
        struct iattr newattrs;
+       int ret;
 
-       fat_write_inode (inode, wait);
+       ret = fat_write_inode (inode, wait);
        newattrs.ia_mtime = inode->i_mtime;
        newattrs.ia_atime = inode->i_atime;
        newattrs.ia_ctime = inode->i_ctime;
@@ -330,6 +331,7 @@ void UMSDOS_write_inode (struct inode *inode, int wait)
  * UMSDOS_notify_change (inode, &newattrs);
 
  * inode->i_state &= ~I_DIRTY; / * FIXME: this doesn't work.  We need to remove ourselves from list on dirty inodes. /mn/ */
+       return ret;
 }
 
 
index 3737a1cf66386fddabb5ee0ad2db4fd6d0c5bbea..605eed2714e5e48f0bea4159a2f7db75ac95d14d 100644 (file)
@@ -356,7 +356,7 @@ destroy_inodecache( void )
  * at the point when it is unpinned after a log write,
  * since this is when the inode itself becomes flushable. 
  */
-STATIC void
+STATIC int
 linvfs_write_inode(
        struct inode            *inode,
        int                     sync)
@@ -364,12 +364,14 @@ linvfs_write_inode(
        vnode_t                 *vp = LINVFS_GET_VP(inode);
        int                     error, flags = FLUSH_INODE;
 
+       error = 0;
        if (vp) {
                vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
                if (sync)
                        flags |= FLUSH_SYNC;
                VOP_IFLUSH(vp, flags, error);
        }
+       return error;
 }
 
 STATIC void
index 894094a40c5f9ecc288f72abcb58e38975478d4b..b52f1320f87473ffe07a4a31a641fbe7e90b3b3f 100644 (file)
@@ -62,7 +62,7 @@ extern void                    affs_put_inode(struct inode *inode);
 extern void                     affs_delete_inode(struct inode *inode);
 extern void                     affs_clear_inode(struct inode *inode);
 extern void                     affs_read_inode(struct inode *inode);
-extern void                     affs_write_inode(struct inode *inode, int);
+extern int                      affs_write_inode(struct inode *inode, int);
 extern int                      affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s32 type);
 
 /* super.c */
index 115d49ebc733fe05e7374abc47f452ff5abf7fb8..c95c5802852ae1c6374b491438faed81a76d8e46 100644 (file)
@@ -724,7 +724,7 @@ extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int,
 extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
 
 extern void ext3_read_inode (struct inode *);
-extern void ext3_write_inode (struct inode *, int);
+extern int  ext3_write_inode (struct inode *, int);
 extern int  ext3_setattr (struct dentry *, struct iattr *);
 extern void ext3_put_inode (struct inode *);
 extern void ext3_delete_inode (struct inode *);
index 5f89bfe9c2deb2f1002433c57f27e806315ed7f7..76f96659507a3f2a22d23d2f8d03ee87c870720c 100644 (file)
@@ -960,7 +960,7 @@ struct super_operations {
        void (*read_inode) (struct inode *);
   
        void (*dirty_inode) (struct inode *);
-       void (*write_inode) (struct inode *, int);
+       int (*write_inode) (struct inode *, int);
        void (*put_inode) (struct inode *);
        void (*drop_inode) (struct inode *);
        void (*delete_inode) (struct inode *);
index 6d141394ff3e3a2f1ff2e6d8d6018e3d225626fc..951fe570b923b852fdbd7681e9b5aa62cc1d08d2 100644 (file)
@@ -276,7 +276,7 @@ extern void fat_put_super(struct super_block *sb);
 int fat_fill_super(struct super_block *sb, void *data, int silent,
                   struct inode_operations *fs_dir_inode_ops, int isvfat);
 extern int fat_statfs(struct super_block *sb, struct kstatfs *buf);
-extern void fat_write_inode(struct inode *inode, int wait);
+extern int fat_write_inode(struct inode *inode, int wait);
 extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
 
 /* fat/misc.c */
index a538e5487c956ac93a04a6340cde04bd050b3918..2bcb5bb73ebb308c05986691c0862d0d5af93491 100644 (file)
@@ -1945,7 +1945,7 @@ void reiserfs_read_locked_inode(struct inode * inode, struct reiserfs_iget_args
 int reiserfs_find_actor(struct inode * inode, void *p) ;
 int reiserfs_init_locked_inode(struct inode * inode, void *p) ;
 void reiserfs_delete_inode (struct inode * inode);
-void reiserfs_write_inode (struct inode * inode, int) ;
+int reiserfs_write_inode (struct inode * inode, int) ;
 struct dentry *reiserfs_get_dentry(struct super_block *, void *) ;
 struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 *data,
                                      int len, int fhtype,
index 0a800dee389f150cbc4d45312282a35d560fef60..2b71418e18d9fc6f07b915e74be70c8e61d80c5e 100644 (file)
@@ -898,7 +898,7 @@ extern struct inode * ufs_new_inode (struct inode *, int);
 extern u64  ufs_frag_map (struct inode *, sector_t);
 extern void ufs_read_inode (struct inode *);
 extern void ufs_put_inode (struct inode *);
-extern void ufs_write_inode (struct inode *, int);
+extern int ufs_write_inode (struct inode *, int);
 extern int ufs_sync_inode (struct inode *);
 extern void ufs_delete_inode (struct inode *);
 extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);