From: NeilBrown Date: Sun, 27 Jun 2010 23:13:17 +0000 (+1000) Subject: Get block ref in lafs_add_block_address X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=7505f46be2b5cd2db2cd82d42c1ef04e645efaad;p=LaFS.git Get block ref in lafs_add_block_address It is possible to lose the ref on the parent that we have before the final use to unlock, so make sure to hold our own reference. Signed-off-by: NeilBrown --- diff --git a/index.c b/index.c index 0607988..07ff762 100644 --- a/index.c +++ b/index.c @@ -1993,10 +1993,14 @@ int lafs_add_block_address(struct fs *fs, struct block *blk) return 1; } else { spin_unlock(&blk->inode->i_data.private_lock); - + /* We own a ref through blk->parent now, but + * after lafs_incorporate, we might not + */ + getiref(p,MKREF("addblock")); lafs_iolock_written(&p->b); lafs_incorporate(fs, p); lafs_iounlock_block(&p->b); + putiref(p,MKREF("addblock")); return 0; } }