From 7505f46be2b5cd2db2cd82d42c1ef04e645efaad Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 28 Jun 2010 09:13:17 +1000 Subject: [PATCH] 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 --- index.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } } -- 2.39.5