]> git.neil.brown.name Git - LaFS.git/commitdiff
lafs_leaf_find: Remove a refcnt leak on an eror page
authorNeil Brown <neilb@suse.de>
Wed, 25 Feb 2009 04:40:21 +0000 (15:40 +1100)
committerNeil Brown <neilb@suse.de>
Wed, 25 Feb 2009 04:40:21 +0000 (15:40 +1100)
Also add comment for future consideration.

index.c

diff --git a/index.c b/index.c
index e4851e42a816042e216348f957cb7fcb752d3fa9..06cd05b23ab8a365abedaf3f313a65e14f6adeaf 100644 (file)
--- a/index.c
+++ b/index.c
@@ -841,6 +841,12 @@ void lafs_refile(struct block *b, int dec)
                        }
                }
 
+               /* FIXME I think I want to hold the lock
+                * until I no longer reference b.
+                * but I need to drop it before calling
+                * lafs_destroy_inode, so I might need to get
+                * a counted ref to 'in'
+                */
                spin_unlock(&lafs_hash_lock);
                /* Free a delayed-release inode */
                if (atomic_read(&b->refcnt) == 0 &&
@@ -1175,13 +1181,13 @@ lafs_leaf_find(struct inode *inode, u32 addr, int adopt, u32 *next, int async)
 #endif
                err = lafs_load_block(&ib2->b, 0);
                if (err)
-                       goto err;
+                       goto err_ib2;
                if (async)
                        err = lafs_wait_block_async(&ib2->b);
                else
                        err = lafs_wait_block(&ib2->b);
                if (err)
-                       goto err;
+                       goto err_ib2;
 
                /* This block might have been split, in which case
                 * we need to consider adjacent siblings
@@ -1210,6 +1216,8 @@ lafs_leaf_find(struct inode *inode, u32 addr, int adopt, u32 *next, int async)
 
        return ib;
 
+ err_ib2:
+       putiref(ib2);
  err:
        putiref(ib);
        return ERR_PTR(err);