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

Bob Peterson rpeterso at fedoraproject.org
Thu Jan 20 20:44:30 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=5710603c4af1d832f21a7583da5bd834606c4995
Commit:        5710603c4af1d832f21a7583da5bd834606c4995
Parent:        679d1f0a1e95bae746d22889fd731fee979676ee
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Thu Jan 20 14:25:55 2011 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Thu Jan 20 14:29:46 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#663037
---
 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 6613bd1..a7eb96d 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1293,11 +1293,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