Check for errors during reading of bnode pages and report them. Also
improve error checks in case bnode validity checks failed.
Signed-off-by: Roman Zippel <[EMAIL PROTECTED]>
---
hfs/bnode.c | 12 ++++++++++++
hfsplus/bnode.c | 12 ++++++++++++
2 files changed, 24 insertions(+)
Index: linux-2.6.11/fs/hfsplus/bnode.c
===================================================================
--- linux-2.6.11.orig/fs/hfsplus/bnode.c 2005-03-19 02:45:40.262059172
+0100
+++ linux-2.6.11/fs/hfsplus/bnode.c 2005-03-19 02:45:51.217180504 +0100
@@ -446,6 +446,10 @@ static struct hfs_bnode *__hfs_bnode_cre
page = read_cache_page(mapping, block, (filler_t
*)mapping->a_ops->readpage, NULL);
if (IS_ERR(page))
goto fail;
+ if (PageError(page)) {
+ page_cache_release(page);
+ goto fail;
+ }
#if !REF_PAGES
page_cache_release(page);
#endif
@@ -487,12 +491,16 @@ struct hfs_bnode *hfs_bnode_find(struct
hfs_bnode_get(node);
spin_unlock(&tree->hash_lock);
wait_event(node->lock_wq, !test_bit(HFS_BNODE_NEW,
&node->flags));
+ if (test_bit(HFS_BNODE_ERROR, &node->flags))
+ goto node_error;
return node;
}
spin_unlock(&tree->hash_lock);
node = __hfs_bnode_create(tree, num);
if (!node)
return ERR_PTR(-ENOMEM);
+ if (test_bit(HFS_BNODE_ERROR, &node->flags))
+ goto node_error;
if (!test_bit(HFS_BNODE_NEW, &node->flags))
return node;
@@ -579,6 +587,10 @@ struct hfs_bnode *hfs_bnode_create(struc
node = __hfs_bnode_create(tree, num);
if (!node)
return ERR_PTR(-ENOMEM);
+ if (test_bit(HFS_BNODE_ERROR, &node->flags)) {
+ hfs_bnode_put(node);
+ return ERR_PTR(-EIO);
+ }
pagep = node->page;
memset(kmap(*pagep) + node->page_offset, 0,
Index: linux-2.6.11/fs/hfs/bnode.c
===================================================================
--- linux-2.6.11.orig/fs/hfs/bnode.c 2005-03-19 02:45:40.262059172 +0100
+++ linux-2.6.11/fs/hfs/bnode.c 2005-03-19 02:45:51.217180504 +0100
@@ -285,6 +285,10 @@ static struct hfs_bnode *__hfs_bnode_cre
page = read_cache_page(mapping, block++, (filler_t
*)mapping->a_ops->readpage, NULL);
if (IS_ERR(page))
goto fail;
+ if (PageError(page)) {
+ page_cache_release(page);
+ goto fail;
+ }
#if !REF_PAGES
page_cache_release(page);
#endif
@@ -326,12 +330,16 @@ struct hfs_bnode *hfs_bnode_find(struct
hfs_bnode_get(node);
spin_unlock(&tree->hash_lock);
wait_event(node->lock_wq, !test_bit(HFS_BNODE_NEW,
&node->flags));
+ if (test_bit(HFS_BNODE_ERROR, &node->flags))
+ goto node_error;
return node;
}
spin_unlock(&tree->hash_lock);
node = __hfs_bnode_create(tree, num);
if (!node)
return ERR_PTR(-ENOMEM);
+ if (test_bit(HFS_BNODE_ERROR, &node->flags))
+ goto node_error;
if (!test_bit(HFS_BNODE_NEW, &node->flags))
return node;
@@ -416,6 +424,10 @@ struct hfs_bnode *hfs_bnode_create(struc
node = __hfs_bnode_create(tree, num);
if (!node)
return ERR_PTR(-ENOMEM);
+ if (test_bit(HFS_BNODE_ERROR, &node->flags)) {
+ hfs_bnode_put(node);
+ return ERR_PTR(-EIO);
+ }
pagep = node->page;
memset(kmap(*pagep) + node->page_offset, 0,
-
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