diff options
author | Vyacheslav Dubeyko <slava@dubeyko.com> | 2012-12-20 18:05:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 20:40:19 -0500 |
commit | 81cc7fad552bc9e4fa8c1f25becbecaaa1d41b67 (patch) | |
tree | fc82e6cae25518901a794ad7a2dd7cb6e7252c1e /fs/hfsplus | |
parent | 1b243fd39bd605cdfc482bba4e56b0cb34b28f27 (diff) |
hfsplus: rework processing of hfs_btree_write() returned error
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>
Diffstat (limited to 'fs/hfsplus')
-rw-r--r-- | fs/hfsplus/btree.c | 5 | ||||
-rw-r--r-- | fs/hfsplus/hfsplus_fs.h | 2 | ||||
-rw-r--r-- | fs/hfsplus/super.c | 10 |
3 files changed, 12 insertions, 5 deletions
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c index 21023d9f8ff3..685d07d0ed18 100644 --- a/fs/hfsplus/btree.c +++ b/fs/hfsplus/btree.c | |||
@@ -159,7 +159,7 @@ void hfs_btree_close(struct hfs_btree *tree) | |||
159 | kfree(tree); | 159 | kfree(tree); |
160 | } | 160 | } |
161 | 161 | ||
162 | void hfs_btree_write(struct hfs_btree *tree) | 162 | int hfs_btree_write(struct hfs_btree *tree) |
163 | { | 163 | { |
164 | struct hfs_btree_header_rec *head; | 164 | struct hfs_btree_header_rec *head; |
165 | struct hfs_bnode *node; | 165 | struct hfs_bnode *node; |
@@ -168,7 +168,7 @@ void hfs_btree_write(struct hfs_btree *tree) | |||
168 | node = hfs_bnode_find(tree, 0); | 168 | node = hfs_bnode_find(tree, 0); |
169 | if (IS_ERR(node)) | 169 | if (IS_ERR(node)) |
170 | /* panic? */ | 170 | /* panic? */ |
171 | return; | 171 | return -EIO; |
172 | /* Load the header */ | 172 | /* Load the header */ |
173 | page = node->page[0]; | 173 | page = node->page[0]; |
174 | head = (struct hfs_btree_header_rec *)(kmap(page) + | 174 | head = (struct hfs_btree_header_rec *)(kmap(page) + |
@@ -186,6 +186,7 @@ void hfs_btree_write(struct hfs_btree *tree) | |||
186 | kunmap(page); | 186 | kunmap(page); |
187 | set_page_dirty(page); | 187 | set_page_dirty(page); |
188 | hfs_bnode_put(node); | 188 | hfs_bnode_put(node); |
189 | return 0; | ||
189 | } | 190 | } |
190 | 191 | ||
191 | static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx) | 192 | static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx) |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index c571de224b15..a6da86b1b4c1 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -335,7 +335,7 @@ int hfsplus_block_free(struct super_block *, u32, u32); | |||
335 | /* btree.c */ | 335 | /* btree.c */ |
336 | struct hfs_btree *hfs_btree_open(struct super_block *, u32); | 336 | struct hfs_btree *hfs_btree_open(struct super_block *, u32); |
337 | void hfs_btree_close(struct hfs_btree *); | 337 | void hfs_btree_close(struct hfs_btree *); |
338 | void hfs_btree_write(struct hfs_btree *); | 338 | int hfs_btree_write(struct hfs_btree *); |
339 | struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *); | 339 | struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *); |
340 | void hfs_bmap_free(struct hfs_bnode *); | 340 | void hfs_bmap_free(struct hfs_bnode *); |
341 | 341 | ||
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 811a84d2d964..2036f585b094 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -127,8 +127,14 @@ static int hfsplus_system_write_inode(struct inode *inode) | |||
127 | hfsplus_mark_mdb_dirty(inode->i_sb); | 127 | hfsplus_mark_mdb_dirty(inode->i_sb); |
128 | } | 128 | } |
129 | hfsplus_inode_write_fork(inode, fork); | 129 | hfsplus_inode_write_fork(inode, fork); |
130 | if (tree) | 130 | if (tree) { |
131 | hfs_btree_write(tree); | 131 | int err = hfs_btree_write(tree); |
132 | if (err) { | ||
133 | printk(KERN_ERR "hfs: b-tree write err: %d, ino %lu\n", | ||
134 | err, inode->i_ino); | ||
135 | return err; | ||
136 | } | ||
137 | } | ||
132 | return 0; | 138 | return 0; |
133 | } | 139 | } |
134 | 140 | ||