From 01750c9eb06398905665ceec6b2bbbf83216eb7f Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 23 Jun 2010 11:48:28 +1000 Subject: [PATCH] Ensure InoIdx block is really empty before erasing it. We we missing the test for non-empty children. So move the block of code to after that test. Signed-off-by: NeilBrown --- modify.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/modify.c b/modify.c index 932d042..8521291 100644 --- a/modify.c +++ b/modify.c @@ -1820,21 +1820,6 @@ void lafs_incorporate(struct fs *fs, struct indexblock *ib) * children which are not EmptyIndex, we flag it * as EmptyIndex so index lookups know to avoid it. */ - if (test_bit(B_InoIdx, &ib->b.flags)) { - /* Empty InoIdx blocks are allowed. However depth must - * be 1. This is where we suddenly collapse a now-empty - * indexing tree. - */ - if ((ib->depth > 1 && lafs_index_empty(ib))) { - ib->depth = 1; - LAFSI(ib->b.inode)->depth = 1; - lafs_clear_index(ib); - } - /* Don't need to dirty the inode - the fact that we just - * did incorporation should ensure it is already dirty - */ - goto out2; - } if (ib->depth > 1 && ! lafs_index_empty(ib)) goto out2; if (ib->depth > 1) { @@ -1850,6 +1835,21 @@ void lafs_incorporate(struct fs *fs, struct indexblock *ib) if (non_empty) goto out2; } + if (test_bit(B_InoIdx, &ib->b.flags)) { + /* Empty InoIdx blocks are allowed. However depth must + * be 1. This is where we suddenly collapse a now-empty + * indexing tree. + */ + if (ib->depth > 1) { + ib->depth = 1; + LAFSI(ib->b.inode)->depth = 1; + lafs_clear_index(ib); + } + /* Don't need to dirty the inode - the fact that we just + * did incorporation should ensure it is already dirty + */ + goto out2; + } if (ib->depth == 1 && (lafs_leaf_next(ib, 0) != 0xFFFFFFFF || !list_empty(&ib->children))) -- 2.39.5