summaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorNaohiro Aota <naota@elisp.net>2013-06-06 09:56:34 +0000
committerChris Mason <chris.mason@fusionio.com>2013-06-08 15:07:53 -0400
commit6379ef9fb2482a92b5fe09f927d6ce1f989c0c6d (patch)
treef4bd8f1479d092f47d93570c4a8e50503d86a05a /fs/btrfs
parent7b5ff90ed081787ec0765ceb4fe5ccf5677493a6 (diff)
downloadlinux-3.10-6379ef9fb2482a92b5fe09f927d6ce1f989c0c6d.tar.gz
linux-3.10-6379ef9fb2482a92b5fe09f927d6ce1f989c0c6d.tar.bz2
linux-3.10-6379ef9fb2482a92b5fe09f927d6ce1f989c0c6d.zip
btrfs: Drop inode if inode root is NULL
There is a path where btrfs_drop_inode() is called with its inode's root is NULL: In btrfs_new_inode(), when btrfs_set_inode_index() fails, iput() is called. We should handle this case before taking look at the root->root_item. Signed-off-by: Naohiro Aota <naota@elisp.net> Reviewed-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/inode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 23c596cd1b9..c931a4dbd03 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8011,6 +8011,9 @@ int btrfs_drop_inode(struct inode *inode)
{
struct btrfs_root *root = BTRFS_I(inode)->root;
+ if (root == NULL)
+ return 1;
+
/* the snap/subvol tree is on deleting */
if (btrfs_root_refs(&root->root_item) == 0 &&
root != root->fs_info->tree_root)