gfs2-utils: master - gfs2_convert: Fix conversion of inodes with different heights on gfs1 and gfs2
Abhijith Das
adas at fedoraproject.org
Fri Dec 4 16:50:20 UTC 2009
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=5cf2fa2572c340a0d109cb927f70527a4bf55619
Commit: 5cf2fa2572c340a0d109cb927f70527a4bf55619
Parent: 0b662eff166a3c1ddb34bd72cc8367ca25be8c3e
Author: Abhijith Das <adas at redhat.com>
AuthorDate: Tue Dec 1 08:36:41 2009 -0600
Committer: Abhijith Das <adas at redhat.com>
CommitterDate: Fri Dec 4 10:49:32 2009 -0600
gfs2_convert: Fix conversion of inodes with different heights on gfs1 and gfs2
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.
Signed-off-by: Abhi Das <adas at redhat.com>
---
gfs2/convert/gfs2_convert.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 906e336..8f5d846 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -281,7 +281,7 @@ static 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;
@@ -569,6 +569,7 @@ static int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_buffer_head
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);
More information about the cluster-commits
mailing list