From: Vyacheslav Dubeyko <slava@dubeyko.com>
To: linux-fsdevel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Christoph Hellwig <hch@infradead.org>,
Al Viro <viro@zeniv.linux.org.uk>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Subject: [PATCH] hfsplus: rework processing of hfs_btree_write() returned error
Date: Fri, 30 Nov 2012 14:49:26 +0400 [thread overview]
Message-ID: <1354272566.2069.6.camel@slavad-ubuntu> (raw)
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
next reply other threads:[~2012-11-30 10:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-30 10:49 Vyacheslav Dubeyko [this message]
2012-11-30 21:56 ` [PATCH] hfsplus: rework processing of hfs_btree_write() returned error Andrew Morton
2012-12-01 13:16 ` Vyacheslav Dubeyko
2012-12-01 12:28 ` Hin-Tak Leung
2012-12-03 6:02 ` Vyacheslav Dubeyko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1354272566.2069.6.camel@slavad-ubuntu \
--to=slava@dubeyko.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=htl10@users.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).