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

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


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=fdc45edc17d329f966acac1b0832a437ba8c6a3e
Commit:        fdc45edc17d329f966acac1b0832a437ba8c6a3e
Parent:        a93b053d08c2173ad3c834c8b73c9831aa8f514a
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:33:03 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 96c2310..0134941 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1296,11 +1296,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