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

Bob Peterson rpeterso at fedoraproject.org
Mon Jun 3 18:32:39 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=1b9e718d34f4ff29b41606d26e37e3a6e1fd59b6
Commit:        1b9e718d34f4ff29b41606d26e37e3a6e1fd59b6
Parent:        2d7737fad8a178153d0b8495ac4ebe995a6d5a32
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Mon Dec 17 15:01:02 2012 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Mon Jun 3 12:51:36 2013 -0500

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 b0d7af0..fa0d230 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -350,7 +350,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