cluster: RHEL57 - fsck.gfs2: reports master/root dinodes as unused and fixes the bitmap

Bob Peterson rpeterso at fedoraproject.org
Thu Jan 20 21:10:00 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=99345341cc709bbb794ac1f2711b93dda349fc37
Commit:        99345341cc709bbb794ac1f2711b93dda349fc37
Parent:        be158e9bd1c3c99475ff4f213c19b1732ab0f14d
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Thu Jan 20 15:09:14 2011 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Thu Jan 20 15:09:14 2011 -0600

fsck.gfs2: reports master/root dinodes as unused and fixes the bitmap

The problem is that the block map is not set at the point of
time when the master and root dinodes are checked.  So fsck
sees the discrepancy between the on-disk bitmap (which is
correct) and the in-core blockmap (which hasn't been set
yet for these two system dinodes).  So it complains improperly.

This is a simple fix.  Long ago, I wrote a function called
resuscitate_metalist whose purpose was to make sure dinodes
get marked "in use" for each system dinode.  It's called by
function check_system_inode, and by way of check_metalist.

The function is called for root and master, and therefore
all the system dinodes _within_ those directories are
marked properly in the block map, but nothing ever bothers
to mark the directories themselves.  (Side note: the root
directory doesn't have system dinodes like master, so that's
moot).

The solution (this patch) is to set the block map
accordingly, prior to the other checks.  Since those two
dinodes have no parent, nothing else is going to do it for
them.

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

diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 3bdcf60..bced051 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1305,11 +1305,21 @@ static int check_system_inodes(struct gfs2_sbd *sdp)
 	/*******************************************************************
 	 *******  Check the system inode integrity             *************
 	 *******************************************************************/
+	/* Mark the master system dinode as a "dinode" in the block map.
+	   All other system dinodes in master will be taken care of by function
+	   resuscitate_metalist.  But master won't since it has no parent.*/
+	fsck_blockmap_set(sdp->master_dir,
+			  sdp->master_dir->i_di.di_num.no_addr,
+			  "master", gfs2_inode_dir);
 	if (check_system_inode(sdp, &sdp->master_dir, "master", build_master,
 			       gfs2_inode_dir)) {
 		stack;
 		return -1;
 	}
+	/* Mark the root dinode as a "dinode" in the block map as we did
+	   for master, since it has no parent. */
+	fsck_blockmap_set(sdp->md.rooti, sdp->md.rooti->i_di.di_num.no_addr,
+			  "root", gfs2_inode_dir);
 	if (check_system_inode(sdp, &sdp->md.rooti, "root", build_root,
 			       gfs2_inode_dir)) {
 		stack;


More information about the cluster-commits mailing list