]> git.neil.brown.name Git - LaFS.git/commitdiff
Be sure to alway unlock new inodes.
authorNeilBrown <neilb@suse.de>
Thu, 3 Sep 2009 05:28:19 +0000 (15:28 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 3 Sep 2009 05:28:19 +0000 (15:28 +1000)
All error paths must unlock the new inode.
And make sure nlink is 0 so that it will not be cached.

inode.c

diff --git a/inode.c b/inode.c
index 68777803b95ce76b4176c3eeadd56bf1199dcdf1..50dffc79f9f6ed464634f966dabd71e4f5f0fbae 100644 (file)
--- a/inode.c
+++ b/inode.c
@@ -65,13 +65,14 @@ lafs_iget(struct super_block *sb, ino_t inum, int async)
        if (err) {
                if (err != -ENOENT)
                        printk("lafs_import_inode failed %d\n", err);
-               unlock_new_inode(ino);
                goto err;
        }
        putdref(b, MKREF(iget));
        unlock_new_inode(ino);
        return ino;
  err:
+       ino->i_nlink = 0;
+       unlock_new_inode(ino);
        putdref(b, MKREF(iget));
        iput(ino);
        return ERR_PTR(err);