Btrfs: put our inode if orphan cleanup fails
authorJosef Bacik <jbacik@fusionio.com>
Tue, 4 Jun 2013 01:39:49 +0000 (21:39 -0400)
committerJosef Bacik <jbacik@fusionio.com>
Fri, 14 Jun 2013 15:30:16 +0000 (11:30 -0400)
When we cross into a different subvol when doing a lookup we will run the orhpan
cleanup.  If this fails however we do not drop the ref to the inode we were
looking up before we return an error, which leads to busy inodes on umount.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/inode.c

index c52ceb8c24e0f65feb80deb6de3c7ce3783beb9b..a2df4690b000d852efdb680d6f75510f36d407dd 100644 (file)
@@ -4941,8 +4941,10 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
                if (!(inode->i_sb->s_flags & MS_RDONLY))
                        ret = btrfs_orphan_cleanup(sub_root);
                up_read(&root->fs_info->cleanup_work_sem);
-               if (ret)
+               if (ret) {
+                       iput(inode);
                        inode = ERR_PTR(ret);
+               }
        }
 
        return inode;