Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=e7820f91c1b... Commit: e7820f91c1b5bf5dbe5966dcf0b982df0d3e4ba7 Parent: b180bc7302d47319674be977d1d621405eca406f Author: Bob Peterson rpeterso@redhat.com AuthorDate: Mon Dec 17 15:01:02 2012 -0600 Committer: Bob Peterson rpeterso@redhat.com CommitterDate: Thu Dec 20 14:30:58 2012 -0600
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 61d1504..36ca1a3 100644 --- a/gfs2/convert/gfs2_convert.c +++ b/gfs2/convert/gfs2_convert.c @@ -356,7 +356,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;
cluster-commits@lists.fedorahosted.org