aboutsummaryrefslogtreecommitdiffstats
path: root/fs/logfs/segment.c
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2010-05-03 20:54:34 +0200
committerJoern Engel <joern@logfs.org>2010-05-04 19:37:04 +0200
commit20503664b008e17976bff1fdbc693c77ebd6f6c9 (patch)
tree7cff886995e42d0b90dd3ebe86993f0277e9345c /fs/logfs/segment.c
parentccc0197b02178f7e1707e659cbc5242fc94b499a (diff)
downloadkernel_samsung_smdk4412-20503664b008e17976bff1fdbc693c77ebd6f6c9.zip
kernel_samsung_smdk4412-20503664b008e17976bff1fdbc693c77ebd6f6c9.tar.gz
kernel_samsung_smdk4412-20503664b008e17976bff1fdbc693c77ebd6f6c9.tar.bz2
logfs: survive logfs_buf_recover read errors
Refusing to mount beats a kernel crash. Signed-off-by: Joern Engel <joern@logfs.org>
Diffstat (limited to 'fs/logfs/segment.c')
-rw-r--r--fs/logfs/segment.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/logfs/segment.c b/fs/logfs/segment.c
index f77ce2b..a9657af 100644
--- a/fs/logfs/segment.c
+++ b/fs/logfs/segment.c
@@ -67,7 +67,7 @@ static struct page *get_mapping_page(struct super_block *sb, pgoff_t index,
return page;
}
-void __logfs_buf_write(struct logfs_area *area, u64 ofs, void *buf, size_t len,
+int __logfs_buf_write(struct logfs_area *area, u64 ofs, void *buf, size_t len,
int use_filler)
{
pgoff_t index = ofs >> PAGE_SHIFT;
@@ -81,8 +81,10 @@ void __logfs_buf_write(struct logfs_area *area, u64 ofs, void *buf, size_t len,
copylen = min((ulong)len, PAGE_SIZE - offset);
page = get_mapping_page(area->a_sb, index, use_filler);
- SetPageUptodate(page);
+ if (IS_ERR(page))
+ return PTR_ERR(page);
BUG_ON(!page); /* FIXME: reserve a pool */
+ SetPageUptodate(page);
memcpy(page_address(page) + offset, buf, copylen);
SetPagePrivate(page);
page_cache_release(page);
@@ -92,6 +94,7 @@ void __logfs_buf_write(struct logfs_area *area, u64 ofs, void *buf, size_t len,
offset = 0;
index++;
} while (len);
+ return 0;
}
static void pad_partial_page(struct logfs_area *area)