LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gfs2_fsck_reports_master_root_dinodes_as_unused_and_fixes_bitmap.patch of Package cluster (Project home:sschapiro:openstack:upstream)

commit 5710603c4af1d832f21a7583da5bd834606c4995
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Thu Jan 20 14:25:55 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

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;