summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/gcinode.c
diff options
context:
space:
mode:
authorRyusuke Konishi2010-07-16 16:52:40 +0200
committerRyusuke Konishi2010-07-23 03:02:13 +0200
commit1d5385b9f30ae43209459db424416a3e1d8f2bde (patch)
tree202a19586853da9ec598645b5d289d4a0164b232 /fs/nilfs2/gcinode.c
parentnilfs2: add sanity check in nilfs_btree_add_dirty_buffer (diff)
downloadkernel-qcow2-linux-1d5385b9f30ae43209459db424416a3e1d8f2bde.tar.gz
kernel-qcow2-linux-1d5385b9f30ae43209459db424416a3e1d8f2bde.tar.xz
kernel-qcow2-linux-1d5385b9f30ae43209459db424416a3e1d8f2bde.zip
nilfs2: verify btree node after reading
This inserts sanity checks soon after read btree node from disk. This allows early detection of broken btree nodes, and helps to narrow down problems due to file system corruption. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/gcinode.c')
-rw-r--r--fs/nilfs2/gcinode.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index 145f03cd7d3e..edb53fcb7f83 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -164,10 +164,15 @@ int nilfs_gccache_wait_and_mark_dirty(struct buffer_head *bh)
if (buffer_dirty(bh))
return -EEXIST;
- if (buffer_nilfs_node(bh))
+ if (buffer_nilfs_node(bh)) {
+ if (nilfs_btree_broken_node_block(bh)) {
+ clear_buffer_uptodate(bh);
+ return -EIO;
+ }
nilfs_btnode_mark_dirty(bh);
- else
+ } else {
nilfs_mdt_mark_buffer_dirty(bh);
+ }
return 0;
}