Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 9383e745e23602bc45f9c92184feea59 > files > 123

gfs2-utils-0.1.62-28.el5.src.rpm

commit de617fdd1aecc78fcadaaaf5866a28aa7f7dd3b4
Author: Abhijith Das <adas@redhat.com>
Date:   Mon Sep 27 13:07:18 2010 -0500

    gfs2_convert: gfs2_convert doesn't resume after interrupted conversion
    
    This patch causes the inode conversion routine to skip over the jindex and
    rindex inodes. Without this patch, the jindex and rindex inodes are converted
    to gfs2 format and once converted, there's no way to go back to gfs1 for these
    two inodes were the convert to be interrupted somehow. In the eyes of the
    subsequent gfs2_convert run, these two inodes would be corrupt and gfs2_convert
    would bail out of the conversion.
    Skipping conversion of these two inodes doesn't affect gfs2_convert as these
    two inodes are freed from disk towards the end of the conversion process. New
    jindex and rindex inodes are created for gfs2 separately in the master
    directory.
    
    Note: This issue with reconversion failing occurs only when the jindex/rindex
    inodes are unstuffed. When stuffed, gfs1 and gfs2 inodes have a similar
    structure, so it doesn't matter if these inodes are converted or not, however
    with inode height > 0 the structures of gfs1 and gfs2 differ.
    
    Resolves: rhbz#636157
    Signed-off-by: Abhi Das <adas@redhat.com>

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 899982d..e00fbe7 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -158,6 +158,8 @@ uint64_t gfs2_jheightsize[GFS2_MAX_META_HEIGHT];
 int gfs2_max_height;
 int gfs2_max_jheight;
 
+uint64_t jindex_addr = 0, rindex_addr = 0;
+
 /* ------------------------------------------------------------------------- */
 /* This function is for libgfs's sake.                                       */
 /* ------------------------------------------------------------------------- */
@@ -1149,7 +1151,9 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
 			}
 			bh = bread(sbp, block);
 			if (!gfs2_check_meta(bh, GFS_METATYPE_DI)) {/* if it is an dinode */
-				error = adjust_inode(sbp, bh);
+				/* Skip the rindex and jindex inodes for now. */
+				if (block != rindex_addr && block != jindex_addr)
+					error = adjust_inode(sbp, bh);
 			} else { /* It's metadata, but not an inode, so fix the bitmap. */
 				int blk, buf_offset;
 				int bitmap_byte; /* byte within the bitmap to fix */
@@ -1617,6 +1621,10 @@ static int init(struct gfs2_sbd *sbp)
 	memcpy(&raw_gfs1_ondisk_sb, (struct gfs1_sb *)bh->b_data,
 		   sizeof(struct gfs1_sb));
 	gfs2_sb_in(&sbp->sd_sb, bh);
+
+	jindex_addr = be64_to_cpu(raw_gfs1_ondisk_sb.sb_jindex_di.no_addr);
+	rindex_addr = be64_to_cpu(raw_gfs1_ondisk_sb.sb_rindex_di.no_addr);
+
 	sbp->bsize = sbp->sd_sb.sb_bsize;
 	sbp->sd_inptrs = (sbp->bsize - sizeof(struct gfs_indirect)) /
 		sizeof(uint64_t);