]> git.neil.brown.name Git - LaFS.git/commitdiff
Get block ref in lafs_add_block_address
authorNeilBrown <neilb@suse.de>
Sun, 27 Jun 2010 23:13:17 +0000 (09:13 +1000)
committerNeilBrown <neilb@suse.de>
Sun, 27 Jun 2010 23:15:02 +0000 (09:15 +1000)
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 <neilb@suse.de>
index.c

diff --git a/index.c b/index.c
index 0607988fd996417ae9404b856e2ba8d49cb0ac4e..07ff7620deaf39335f560a077ef98d5825ecf005 100644 (file)
--- 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;
        }
 }