hfsplus: rework processing of hfs_btree_write() returned error
Subsystems (2)
Vyacheslav Dubeyko
maintainerPATCH 1/1 hfsplus: rework processing of hfs_btree_write() returned error
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 <[email protected]>
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.
--- fs/hfsplus/btree.c | 5 +++-- fs/hfsplus/hfsplus_fs.h | 2 +- fs/hfsplus/super.c | 12 ++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-)
fs/hfsplus/btree.c +3 -2
@@ -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)
fs/hfsplus/hfsplus_fs.h +1 -1
@@ -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 *);
fs/hfsplus/super.c +10 -2
@@ -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 ; }
Signature · 1 line
1.7.9.5
Quoted 10 lines · On Fri, 30 Nov 2012 14:49:26 +0400 Vyacheslav Dubeyko <[email protected]> wrote:
Hi,
The patch adds in
hfs_btree_write()returning of-EIOin the case of failing of b-tree's node searching.With the best regards,
Vyacheslav Dubeyko.
--
From: Vyacheslav Dubeyko <[email protected]>
Subject: [PATCH] hfsplus: rework processing ofhfs_btree_write()returned error
Quoted 3 lines
The patch adds in
hfs_btree_write()returning of-EIOin the case of failing of b-tree's node searching. It is added also logic of processing errors ofhfs_btree_write()inhfsplus_system_write_inode()with message about b-tree writing failure.Signed-off-by Vyacheslav Dubeyko <[email protected]>
We don't need two changelogs for each patch ;) The patch's formal changelog text should be sufficient.
Quoted 4 lines
fs/hfsplus/btree.c | 5 +++-- fs/hfsplus/hfsplus_fs.h | 2 +- fs/hfsplus/super.c | 12 ++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-)
I modified a couple of things, please review:
From: Andrew Morton <[email protected]>
Subject: hfsplus-rework-processing-of-hfs_btree_write-returned-error-fix
reduce scope of `err', print errno on error
---
fs/hfsplus/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/hfsplus/super.c renamed from fs/hfsplus/super.c~hfsplus-rework-processing-of-hfs_btree_write-returned-error-fix +3 -3
@@ -100,7 +100,6 @@ static int hfsplus_system_write_inode(ststruct 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 :
@@ -131,9 +130,10 @@ static int hfsplus_system_write_inode(st }hfsplus_inode_write_fork (inode, fork);if (tree) { - err =hfs_btree_write (tree); +int err =hfs_btree_write (tree);if (err) { -printk (KERN_ERR "hfs: unable to write b-tree\n" ); +printk (KERN_ERR "hfs: unable to write b-tree: %d\n" , + err);dprint (DBG_INODE ,"hfsplus_system_write_inode: %lu\n" , inode->i_ino);return err;
_
Quoted 13 lines · Andrew Morton
Quoted 10 lines · On Fri, 30 Nov 2012 14:49:26 +0400 Vyacheslav Dubeyko <[email protected]> wrote:
Hi,
The patch adds in
hfs_btree_write()returning of-EIOin the case of failing of b-tree's node searching.With the best regards,
Vyacheslav Dubeyko.
--
From: Vyacheslav Dubeyko <[email protected]>
Subject: [PATCH] hfsplus: rework processing ofhfs_btree_write()returned error
Quoted 7 lines
Quoted 3 lines
The patch adds in
hfs_btree_write()returning of-EIOin the case of failing of b-tree's node searching. It is added also logic of processing errors ofhfs_btree_write()inhfsplus_system_write_inode()with message about b-tree writing failure.Signed-off-by Vyacheslav Dubeyko <[email protected]>We don't need two changelogs for each patch ;) The patch's formal changelog text should be sufficient.
Ok. :-)
Quoted 7 lines
Quoted 4 lines
fs/hfsplus/btree.c | 5 +++-- fs/hfsplus/hfsplus_fs.h | 2 +- fs/hfsplus/super.c | 12 ++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-)I modified a couple of things, please review:
I think that it is a good correction. I agree.
With the best regards,
Vyacheslav Dubeyko.
Quoted 44 lines
From: Andrew Morton <[email protected]>
Subject: hfsplus-rework-processing-of-hfs_btree_write-returned-error-fixreduce scope of `err', print errno on error
Cc Al Viro <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Hin-Tak Leung <[email protected]>Cc Vyacheslav Dubeyko <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
fs/hfsplus/super.c| 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)fs/hfsplus/super.c renamed from fs/hfsplus/super.c~hfsplus-rework-processing-of-hfs_btree_write-returned-error-fix +3
-3@@ -100,7 +100,6 @@ static int hfsplus_system_write_inode(ststruct 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 :@@ -131,9 +130,10 @@ static int hfsplus_system_write_inode(st }hfsplus_inode_write_fork (inode, fork);if (tree) { - err =hfs_btree_write (tree); +int err =hfs_btree_write (tree);if (err) { -printk (KERN_ERR "hfs: unable to write b-tree\n" ); +printk (KERN_ERR "hfs: unable to write b-tree: %d\n" , + err);dprint (DBG_INODE ,"hfsplus_system_write_inode: %lu\n" , inode->i_ino);return err;_
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Acked, and also a comment towards the end (so please keep reading beyond the Ack!).
Quoted 12 lines · Vyacheslav Dubeyko
Hi,
The patch adds in
hfs_btree_write()returning of-EIOin the case of failing of b-tree's node searching.With the best regards,
Vyacheslav Dubeyko.
--
From: Vyacheslav Dubeyko <[email protected]>
Subject: [PATCH] hfsplus: rework processing ofhfs_btree_write()returned error
Quoted 7 lines
The patch adds in
hfs_btree_write()returning of-EIOin the case of failing of b-tree's node searching. It is added also logic of processing errors ofhfs_btree_write()inhfsplus_system_write_inode()with message about b-tree writing failure.Signed-off-by Vyacheslav Dubeyko <[email protected]>
Quoted 90 lines
--- fs/hfsplus/btree.c | 5 +++-- fs/hfsplus/hfsplus_fs.h | 2 +- fs/hfsplus/super.c | 12 ++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-)fs/hfsplus/btree.c +1
-1@@ -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;fs/hfsplus/btree.c +1
-1@@ -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) +fs/hfsplus/btree.c +1
-0@@ -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(structhfs_bnode
*prev, u32 idx)fs/hfsplus/hfsplus_fs.h +1
-1@@ -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 *);fs/hfsplus/super.c +1
-0@@ -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) {
caseHFSPLUS_EXT_CNID:fs/hfsplus/super.c +2
-2@@ -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",
Quoted 9 lines
+
inode->i_ino);
+
return err;
+ }
+ }
return 0;
}
There is a small issue which crossed my mind when I first noticed with:
"hfsplus: rework processing errors in hfsplus_free_extents()"
It is a printk() followed by dprint() with additional information, on error. Because dprint() needs a compile-time change (or at least, echo'ing into debugfs if switched to dynamic-debug). This means the additional information would not be seen the first time the error occurred. I am wondering whether the additional info should be included in the printk - in a short-hand form, maybe?
Hin-Tak
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Vyacheslav Dubeyko
maintainerOn Sat, 2012-12-01 at 12:28 +0000, Hin-Tak Leung wrote:
[snip]
Quoted 15 lines
if (err) {fs/hfsplus/super.c static int hfsplus_system_write_inode(struct inode *inode) · line 141
Quoted 13 lines
+
printk(KERN_ERR "hfs: unable to write b-tree\n"); +
dprint(DBG_INODE, "hfsplus_system_write_inode: %lu\n",(quoted diff) +2
-0+ inode->i_ino); +return err;
fs/hfsplus/super.c +2
-0+ } + }return 0 ; }
Quoted 5 lines
There is a small issue which crossed my mind when I first noticed with:
"hfsplus: rework processing errors inhfsplus_free_extents()"It is a
printk()followed bydprint()with additional information, on error. Becausedprint()needs a compile-time change (or at least, echo'ing into debugfs if switched to dynamic-debug). This means the additional information would not be seen the first time the error occurred. I am wondering whether the additional info should be included in the printk - in a short-hand form, maybe?
I think that your remark is reasonable. I'll prepare the patch.
Thanks,
Vyacheslav Dubeyko.
Quoted 6 lines
Hin-Tak
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html