gfs2-utils: RHEL7 - gfs2-utils: more fsck.gfs2 i_goal fixes

Abhijith Das adas at fedoraproject.org
Wed Apr 1 14:56:53 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=0ae4bfefaaa4915f267ef0533ebc53d44ea4369e
Commit:        0ae4bfefaaa4915f267ef0533ebc53d44ea4369e
Parent:        8818b681e941282a52ee53514a39735a2b891235
Author:        Abhi Das <adas at redhat.com>
AuthorDate:    Fri Mar 27 13:58:05 2015 -0500
Committer:     Abhi Das <adas at redhat.com>
CommitterDate: Fri Mar 27 13:58:05 2015 -0500

gfs2-utils: more fsck.gfs2 i_goal fixes

fsck.gfs2 doesn't traverse the metadata tree for dirs in pass1 to
be able to get at the last allocated block for it and attempts to
set it to the inode block itself when it finds the i_goal value to
be outside of the current rgrp. This is not desirable and fsck.gfs2
should probably leave directories alone.

This patch simply skips over directories whose goal blocks fall
within the boundaries of the fs, assuming they are valid.

Resolves: rhbz#1186515
Signed-off-by: Abhi Das <adas at redhat.com>
---
 gfs2/fsck/metawalk.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 3460141..2dc8a32 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1931,6 +1931,14 @@ int check_i_goal(struct gfs2_inode *ip, uint64_t goal_blk,
 	if (sdp->gfs1 || ip->i_di.di_flags & GFS2_DIF_SYSTEM ||
 		ip->i_di.di_goal_meta == i_block)
 		return 0;
+	/* Don't fix directory goal blocks unless we know they're wrong.
+	 * i.e. out of bounds of the fs. Directories can easily have blocks
+	 * outside of the dinode's rgrp and thus we have no way of knowing
+	 * if the goal block is bogus or not. */
+	if (is_dir(&ip->i_di, ip->i_sbd->gfs1) &&
+	    (ip->i_di.di_goal_meta > sdp->sb_addr &&
+	     ip->i_di.di_goal_meta <= sdp->fssize))
+		return 0;
 	/* We default to the inode block */
 	if (!goal_blk)
 		goal_blk = i_block;


More information about the cluster-commits mailing list