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

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


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=2f6e55c83367548fe9e384ae8a01bb1dcdec94cb
Commit:        2f6e55c83367548fe9e384ae8a01bb1dcdec94cb
Parent:        3f4c4df5a03a58f2075a3084b2d10834a158746b
Author:        Abhi Das <adas at redhat.com>
AuthorDate:    Fri Mar 27 13:58:05 2015 -0500
Committer:     Abhi Das <adas at redhat.com>
CommitterDate: Wed Apr 1 09:45:13 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 6daaf9f..f05fb51 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1995,6 +1995,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