cluster: RHEL6 - fsck.gfs2: fsck.gfs2: Duplicate ref processing for leaf blocks

Bob Peterson rpeterso at fedoraproject.org
Tue Jan 24 20:45:43 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4857f0866b3f5f641300f022fa9d4624ebe3f32a
Commit:        4857f0866b3f5f641300f022fa9d4624ebe3f32a
Parent:        2b9c1cfac56cef5bde3d9941bc5f21027c22b1c8
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Tue Aug 9 09:33:08 2011 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri Jan 20 08:26:26 2012 -0600

fsck.gfs2: fsck.gfs2: Duplicate ref processing for leaf blocks

This patch adds checks for duplicate block references to the leaf block
processing.

rhbz#675723
---
 gfs2/fsck/pass1.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 26883d3..a1f4232 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -334,7 +334,27 @@ static int check_num_ptrs(struct gfs2_inode *ip, uint64_t leafno,
 static int check_leaf(struct gfs2_inode *ip, uint64_t block, void *private)
 {
 	struct block_count *bc = (struct block_count *) private;
+	uint8_t q;
 
+	/* Note if we've gotten this far, the block has already passed the
+	   check in metawalk: gfs2_check_meta(lbh, GFS2_METATYPE_LF).
+	   So we know it's a leaf block. */
+	q = block_type(block);
+	if (q != gfs2_block_free) {
+		log_err( _("Found duplicate block %llu (0x%llx) referenced "
+			   "as a directory leaf in dinode "
+			   "%llu (0x%llx) - was marked %d (%s)\n"),
+			 (unsigned long long)block,
+			 (unsigned long long)block,
+			 (unsigned long long)ip->i_di.di_num.no_addr,
+			 (unsigned long long)ip->i_di.di_num.no_addr, q,
+			 block_type_string(q));
+		add_duplicate_ref(ip, block, ref_as_meta, 0, INODE_VALID);
+		if (q == gfs2_leaf_blk) /* If the previous reference also saw
+					   this as a leaf, it was already
+					   checked, so don't check again. */
+			return -EEXIST;
+	}
 	fsck_blockmap_set(ip, block, _("directory leaf"), gfs2_leaf_blk);
 	bc->indir_count++;
 	return 0;


More information about the cluster-commits mailing list