cluster: RHEL510 - fsck.gfs2: Recognize partially gfs2-converted dinodes
Bob Peterson
rpeterso at fedoraproject.org
Fri Apr 5 13:46:14 UTC 2013
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=088b93612bafef494994e2dc116e4ae64f442585
Commit: 088b93612bafef494994e2dc116e4ae64f442585
Parent: f1918c89c393ac3ba79704d9cdb3948993d05c2a
Author: Bob Peterson <rpeterso at redhat.com>
AuthorDate: Fri Jan 6 14:16:59 2012 -0600
Committer: Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri Apr 5 06:25:00 2013 -0700
fsck.gfs2: Recognize partially gfs2-converted dinodes
In testing fsck.gfs2 I noticed that if a file system had some
leftover gfs2 dinodes (due to an interrupted gfs2_convert or
in my case, because I had previously loaded gfs2 metadata that
left gfs2 blocks laying around the gfs1 file system) those gfs2
dinodes were not properly processed. In particular, it would not
recognize gfs2-style directories as directories because of the
difference in where dinode mode information is kept. This patch
gives fsck.gfs2 the ability to correctly identify gfs2 dinodes
when checking a gfs1 file system.
rhbz#877150
---
gfs2/fsck/lost_n_found.c | 7 +++++--
gfs2/fsck/util.h | 10 +++++-----
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index b762f09..f02fb5a 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -106,6 +106,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
uint64_t lf_blocks;
struct gfs2_sbd *sdp = ip->i_sbd;
struct dir_info *di;
+ uint32_t mode;
if (!lf_dip) {
uint8_t q;
@@ -160,7 +161,9 @@ int add_inode_to_lf(struct gfs2_inode *ip){
}
lf_blocks = lf_dip->i_di.di_blocks;
- switch(ip->i_di.di_mode & S_IFMT){
+ mode = ip->i_di.di_mode & S_IFMT;
+
+ switch (mode) {
case S_IFDIR:
add_dotdot(ip);
sprintf(tmp_name, "lost_dir_%llu",
@@ -208,7 +211,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
incr_link_count(ip->i_di.di_num.no_addr, lf_dip->i_di.di_num.no_addr,
_("from lost+found"));
/* If it's a directory, lost+found is back-linked to it via .. */
- if (S_ISDIR(ip->i_di.di_mode))
+ if (mode == S_IFDIR)
incr_link_count(lf_dip->i_di.di_num.no_addr,
ip->i_di.di_num.no_addr, _("to lost+found"));
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index 4a7f83f..86bda82 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -104,24 +104,24 @@ static inline int blockmap_to_bitmap(enum gfs2_mark_block m)
static int bitmap_states[16] = {
GFS2_BLKST_FREE, /* free */
GFS2_BLKST_USED, /* data */
- GFS2_BLKST_USED, /* indirect data or rgrp meta*/
+ GFS2_BLKST_USED, /* indirect data or rgrp meta */
GFS2_BLKST_DINODE, /* directory */
GFS2_BLKST_DINODE, /* file */
GFS2_BLKST_DINODE, /* symlink */
GFS2_BLKST_DINODE, /* block or char device */
- GFS2_BLKST_USED, /* reserved */
+ GFS2_BLKST_USED, /* journaled data */
GFS2_BLKST_DINODE, /* fifo */
GFS2_BLKST_DINODE, /* socket */
GFS2_BLKST_FREE, /* invalid inode */
GFS2_BLKST_FREE, /* invalid meta */
GFS2_BLKST_USED, /* dir leaf */
- GFS2_BLKST_UNLINKED, /* unused */
+ GFS2_BLKST_UNLINKED, /* GFS unlinked metadata */
GFS2_BLKST_USED, /* eattribute */
- GFS2_BLKST_USED, /* bad */
- };
+ GFS2_BLKST_DINODE}; /* bad */
+
return bitmap_states[m];
}
More information about the cluster-commits
mailing list