Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: cc35bcd38a317291dc0a4c0f4a732074478dd00e
Parent: 25a4785a06376ff410cd5d35b08c6c5c7411e33e
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Tue Dec 1 08:36:41 2009 -0600
Committer: Abhijith Das <adas(a)redhat.com>
CommitterDate: Tue Dec 1 08:36:41 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(a)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 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);