File gfs2_convert_doesn_t_resume_after_interrupted_conversion.patch of Package cluster

From f82df8cef5ecb8cfdb37214322217232dd877072 Mon Sep 17 00:00:00 2001
From: Abhijith Das <>
Date: Mon, 27 Sep 2010 13:34:43 -0500
Subject: [PATCH] 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

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#637913
Signed-off-by: Abhi Das <>
 gfs2/convert/gfs2_convert.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 6a754b1..f84de84 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -148,6 +148,7 @@ uint64_t gfs2_heightsize[GFS2_MAX_META_HEIGHT];
 uint64_t gfs2_jheightsize[GFS2_MAX_META_HEIGHT];
 uint32_t gfs2_max_height;
 uint32_t gfs2_max_jheight;
+uint64_t jindex_addr = 0, rindex_addr = 0;
 /* ------------------------------------------------------------------------- */
 /* This function is for libgfs's sake.                                       */
@@ -1138,7 +1139,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 */
@@ -1609,6 +1612,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)) /