cluster: RHEL510 - gfs2_convert: Use proper header size when reordering meta pointers

Bob Peterson rpeterso at fedoraproject.org
Fri Apr 5 15:24:12 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=11795482c88f4866654c583466e336fd5fffdece
Commit:        11795482c88f4866654c583466e336fd5fffdece
Parent:        183e3d6a5ea335db7f2c176a2fca009ab18e9f07
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Mon Dec 17 15:01:02 2012 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Fri Apr 5 07:02:05 2013 -0700

gfs2_convert: Use proper header size when reordering meta pointers

This patch changes function fix_metatree to use a proper metadata
header size. Before, it was using sizeof(struct gfs2_meta_header).
That's correct in almost all cases. But if you make a big file,
such that it goes into height==2 (two levels of indirection), then
truncate the file back to where it only would normally only need
height==1, then run gfs2_convert, it gets into trouble. That's
because you have a small file size, which calculates a much smaller
number of GFS2 pointers needed, due to the truncation. Function
fix_metatree will ensure at least one level of indirection by
unstuffing the converted dinode, but we need to start pushing out
the pointers onto the dinode's buffer, and for that, we need to
calculate the right header size.

rhbz#887374
---
 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 597eb8c..b3e9538 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -352,7 +352,8 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 			gfs2_meta_header_out(&mh, bh);
 		}
 
-		hdrsize = sizeof(struct gfs2_meta_header);
+		hdrsize = blk->height ? sizeof(struct gfs2_meta_header) :
+			sizeof(struct gfs2_dinode);
 
 		if (amount > sbp->bsize - hdrsize - ptramt)
 			amount = sbp->bsize - hdrsize - ptramt;


More information about the cluster-commits mailing list