]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hfsplus: rework processing of hfs_btree_write() returned error
authorVyacheslav Dubeyko <slava@dubeyko.com>
Thu, 20 Dec 2012 23:05:28 +0000 (15:05 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Dec 2012 01:40:19 +0000 (17:40 -0800)
Add to hfs_btree_write() a return of -EIO on failure of b-tree node
searching.  Also add logic ofor processing errors from hfs_btree_write()
in hfsplus_system_write_inode() with a message about b-tree writing
failure.

[akpm@linux-foundation.org: reduce scope of `err', print errno on error]
Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/hfsplus/btree.c
fs/hfsplus/hfsplus_fs.h
fs/hfsplus/super.c

index 21023d9f8ff3d2a9d87b67c6c69efe5606d182ab..685d07d0ed18845cceb092cc564142664580929c 100644 (file)
@@ -159,7 +159,7 @@ void hfs_btree_close(struct hfs_btree *tree)
        kfree(tree);
 }
 
-void hfs_btree_write(struct hfs_btree *tree)
+int hfs_btree_write(struct hfs_btree *tree)
 {
        struct hfs_btree_header_rec *head;
        struct hfs_bnode *node;
@@ -168,7 +168,7 @@ void hfs_btree_write(struct hfs_btree *tree)
        node = hfs_bnode_find(tree, 0);
        if (IS_ERR(node))
                /* panic? */
-               return;
+               return -EIO;
        /* Load the header */
        page = node->page[0];
        head = (struct hfs_btree_header_rec *)(kmap(page) +
@@ -186,6 +186,7 @@ void hfs_btree_write(struct hfs_btree *tree)
        kunmap(page);
        set_page_dirty(page);
        hfs_bnode_put(node);
+       return 0;
 }
 
 static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx)
index c571de224b154638e9925fb4a2588b253ceffe63..a6da86b1b4c1ee22ab68b50128b27956aac2140e 100644 (file)
@@ -335,7 +335,7 @@ int hfsplus_block_free(struct super_block *, u32, u32);
 /* btree.c */
 struct hfs_btree *hfs_btree_open(struct super_block *, u32);
 void hfs_btree_close(struct hfs_btree *);
-void hfs_btree_write(struct hfs_btree *);
+int hfs_btree_write(struct hfs_btree *);
 struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *);
 void hfs_bmap_free(struct hfs_bnode *);
 
index 811a84d2d9643677832219a0b960c6d42109480e..2036f585b094053c170fffb3e46b5e262467e62b 100644 (file)
@@ -127,8 +127,14 @@ static int hfsplus_system_write_inode(struct inode *inode)
                hfsplus_mark_mdb_dirty(inode->i_sb);
        }
        hfsplus_inode_write_fork(inode, fork);
-       if (tree)
-               hfs_btree_write(tree);
+       if (tree) {
+               int err = hfs_btree_write(tree);
+               if (err) {
+                       printk(KERN_ERR "hfs: b-tree write err: %d, ino %lu\n",
+                                       err, inode->i_ino);
+                       return err;
+               }
+       }
        return 0;
 }