From: Bob Peterson <rpete...@redhat.com> Now that fsck.gfs2 can validate the hash table is relatively sane without actually reading the leaf blocks, when it does need to read in those leaf blocks, we need to check the leaf depth is appropriate for the (now sane) number of pointers we encountered in the hash table. This patch adds a call to check the leaf depth from pass2.
rhbz#902920 --- gfs2/fsck/metawalk.c | 3 +++ gfs2/fsck/metawalk.h | 2 ++ gfs2/fsck/pass2.c | 1 + 3 files changed, 6 insertions(+) diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c index 4cd712e..fd4ec93 100644 --- a/gfs2/fsck/metawalk.c +++ b/gfs2/fsck/metawalk.c @@ -514,6 +514,9 @@ static int check_leaf(struct gfs2_inode *ip, int lindex, msg = _("that is not really a leaf"); goto bad_leaf; } + if (pass->check_leaf_depth) + error = pass->check_leaf_depth(ip, *leaf_no, *ref_count, lbh); + if (pass->check_leaf) { error = pass->check_leaf(ip, *leaf_no, pass->private); if (error) { diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h index e11b5e0..486c6eb 100644 --- a/gfs2/fsck/metawalk.h +++ b/gfs2/fsck/metawalk.h @@ -69,6 +69,8 @@ extern int free_block_if_notdup(struct gfs2_inode *ip, uint64_t block, */ struct metawalk_fxns { void *private; + int (*check_leaf_depth) (struct gfs2_inode *ip, uint64_t leaf_no, + int ref_count, struct gfs2_buffer_head *lbh); int (*check_leaf) (struct gfs2_inode *ip, uint64_t block, void *private); int (*check_metalist) (struct gfs2_inode *ip, uint64_t block, diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c index e0b1350..48b20f5 100644 --- a/gfs2/fsck/pass2.c +++ b/gfs2/fsck/pass2.c @@ -1431,6 +1431,7 @@ static int pass2_repair_leaf(struct gfs2_inode *ip, uint64_t *leaf_no, struct metawalk_fxns pass2_fxns = { .private = NULL, + .check_leaf_depth = check_leaf_depth, .check_leaf = NULL, .check_metalist = NULL, .check_data = NULL, -- 1.7.11.7