From mboxrd@z Thu Jan 1 00:00:00 1970 From: Abhi Das Date: Wed, 1 Apr 2015 09:55:01 -0500 Subject: [Cluster-devel] gfs2-utils: more fsck.gfs2 i_goal fixes Message-ID: <1427900102-58542-1-git-send-email-adas@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- gfs2/fsck/metawalk.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- 1.8.1.4