From: Dave Chinner Date: Wed, 13 Nov 2013 06:40:37 +0000 (+0000) Subject: xfs: fix node forward in xfs_node_toosmall X-Git-Tag: v3.2.0-alpha2~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9522f4d8790ecd61c4e74746b607787485f2027;p=thirdparty%2Fxfsprogs-dev.git xfs: fix node forward in xfs_node_toosmall When a node is considered for a merge with a sibling, it overwrites the sibling pointers of the original incore nodehdr with the sibling's pointers. This leads to loop considering the original node as a merge candidate with itself in the second pass, and so it incorrectly determines a merge should occur.) Ported from equivalent kernel commit 997def25. Signed-off-by: Dave Chinner Reviewed-by: Christoph Hellwig Signed-off-by: Rich Johnston --- diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index f106e0665..53414f556 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -1201,6 +1201,7 @@ xfs_da3_node_toosmall( /* start with smaller blk num */ forward = nodehdr.forw < nodehdr.back; for (i = 0; i < 2; forward = !forward, i++) { + struct xfs_da3_icnode_hdr thdr; if (forward) blkno = nodehdr.forw; else @@ -1213,10 +1214,10 @@ xfs_da3_node_toosmall( return(error); node = bp->b_addr; - xfs_da3_node_hdr_from_disk(&nodehdr, node); + xfs_da3_node_hdr_from_disk(&thdr, node); xfs_trans_brelse(state->args->trans, bp); - if (count - nodehdr.count >= 0) + if (count - thdr.count >= 0) break; /* fits with at least 25% to spare */ } if (i >= 2) {