gfs2-utils: master - fsck.gfs2: check leaf depth when validating leaf blocks

Bob Peterson rpeterso at fedoraproject.org
Mon May 20 16:18:04 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=829f490e5f8fd9a1a708667783514bca5fd95b05
Commit:        829f490e5f8fd9a1a708667783514bca5fd95b05
Parent:        4d4cf4c98159b6059f435fa465defbde6a4dd221
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Fri Mar 8 09:34:32 2013 -0700
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Mon May 20 11:12:46 2013 -0500

fsck.gfs2: check leaf depth when validating leaf blocks

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.
---
 gfs2/fsck/metawalk.c |    3 +++
 gfs2/fsck/metawalk.h |    2 ++
 gfs2/fsck/pass2.c    |    1 +
 3 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index fac91a5..5373bd4 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 1810040..91bc398 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,


More information about the cluster-commits mailing list