Sophie

Sophie

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

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

commit 9bfaeaebb9a359d1edbe7bc411e1393a7806117f
Author: Abhijith Das <adas@redhat.com>
Date:   Mon Dec 21 11:44:41 2009 -0600

    gfs2_convert: Conversion of inodes that are of different metatree heights in gfs and gfs2 is incorrect
    
    Resolves bz 548588 - The first hunk of the patch fixes a possible typo
    where the gfs1 height was being used instead of gfs2 height to compute
     the fan-out factors. When both heights at gfs1 and gfs2 are the same,
    this really doesn't matter, but at different heights, I get a floating
    point exception and gfs2_convert crashes.
    
    The second part of the fix has to do with updating the height
    information of a given block after it's revised metapath is computed
    according to gfs2 parameters. Without this line, gfs2_convert was using
    the same height as that of gfs1 for the converted file and weird blocks
    were included in the file's data and metadata, thereby corrupting it.

    Resolves: rhbz#548588

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index e624ace..cea8496 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -289,7 +289,7 @@ void mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 
 	/* figure out multiplication factors for each height - gfs2 */
 	memset(&gfs2factor, 0, sizeof(gfs2factor));
-	gfs2factor[gfs1_h - 1] = 1ull;
+	gfs2factor[gfs2_h - 1] = 1ull;
 	for (h = gfs2_h - 1; h > 0; h--)
 		gfs2factor[h - 1] = gfs2factor[h] * gfs2_inptrs;
 
@@ -577,6 +577,7 @@ int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_buffer_head *dibh,
 		blk->mp.mp_list[di_height - 1] = ptrnum;
 		mp_gfs1_to_gfs2(sbp, di_height, gfs2_hgt, &blk->mp, &gfs2mp);
 		memcpy(&blk->mp, &gfs2mp, sizeof(struct metapath));
+		blk->height -= di_height - gfs2_hgt;
 		if (len)
 			fix_metatree(sbp, ip, blk, ptr1, len);
 		osi_list_del(tmp);