linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hfsplus: rework processing of hfs_btree_write() returned error
@ 2012-11-30 10:49 Vyacheslav Dubeyko
  2012-11-30 21:56 ` Andrew Morton
  2012-12-01 12:28 ` Hin-Tak Leung
  0 siblings, 2 replies; 5+ messages in thread
From: Vyacheslav Dubeyko @ 2012-11-30 10:49 UTC (permalink / raw)
  To: linux-fsdevel, Andrew Morton, Christoph Hellwig, Al Viro; +Cc: Hin-Tak Leung

Hi,

The patch adds in hfs_btree_write() returning of -EIO in the case of failing of b-tree's node searching.

With the best regards,
Vyacheslav Dubeyko.
--
From: Vyacheslav Dubeyko <slava@dubeyko.com>
Subject: [PATCH] hfsplus: rework processing of hfs_btree_write() returned error

The patch adds in hfs_btree_write() returning of -EIO in the case of failing of b-tree's node searching. It is added also logic of processing errors of hfs_btree_write() in hfsplus_system_write_inode() with message about b-tree writing failure.

Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
---
 fs/hfsplus/btree.c      |    5 +++--
 fs/hfsplus/hfsplus_fs.h |    2 +-
 fs/hfsplus/super.c      |   12 ++++++++++--
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c
index 21023d9..685d07d 100644
--- a/fs/hfsplus/btree.c
+++ b/fs/hfsplus/btree.c
@@ -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)
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index c571de2..a6da86b 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);
 /* 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 *);
 
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 811a84d..3033b73 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -99,6 +99,7 @@ static int hfsplus_system_write_inode(struct inode *inode)
 	struct hfsplus_vh *vhdr = sbi->s_vhdr;
 	struct hfsplus_fork_raw *fork;
 	struct hfs_btree *tree = NULL;
+	int err;
 
 	switch (inode->i_ino) {
 	case HFSPLUS_EXT_CNID:
@@ -127,8 +128,15 @@ 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) {
+		err = hfs_btree_write(tree);
+		if (err) {
+			printk(KERN_ERR "hfs: unable to write b-tree\n");
+			dprint(DBG_INODE, "hfsplus_system_write_inode: %lu\n",
+				inode->i_ino);
+			return err;
+		}
+	}
 	return 0;
 }
 
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-03  6:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-30 10:49 [PATCH] hfsplus: rework processing of hfs_btree_write() returned error Vyacheslav Dubeyko
2012-11-30 21:56 ` Andrew Morton
2012-12-01 13:16   ` Vyacheslav Dubeyko
2012-12-01 12:28 ` Hin-Tak Leung
2012-12-03  6:02   ` Vyacheslav Dubeyko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).