diff options
-rw-r--r-- | fs/btrfs/inode.c | 3 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index fce61991213c..b009fb52bd8a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -7315,8 +7315,9 @@ int btrfs_drop_inode(struct inode *inode) | |||
7315 | { | 7315 | { |
7316 | struct btrfs_root *root = BTRFS_I(inode)->root; | 7316 | struct btrfs_root *root = BTRFS_I(inode)->root; |
7317 | 7317 | ||
7318 | /* the snap/subvol tree is on deleting */ | ||
7318 | if (btrfs_root_refs(&root->root_item) == 0 && | 7319 | if (btrfs_root_refs(&root->root_item) == 0 && |
7319 | !btrfs_is_free_space_inode(inode)) | 7320 | root != root->fs_info->tree_root) |
7320 | return 1; | 7321 | return 1; |
7321 | else | 7322 | else |
7322 | return generic_drop_inode(inode); | 7323 | return generic_drop_inode(inode); |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index e0893036da08..2bbbed506f5b 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2174,6 +2174,12 @@ out_unlock: | |||
2174 | shrink_dcache_sb(root->fs_info->sb); | 2174 | shrink_dcache_sb(root->fs_info->sb); |
2175 | btrfs_invalidate_inodes(dest); | 2175 | btrfs_invalidate_inodes(dest); |
2176 | d_delete(dentry); | 2176 | d_delete(dentry); |
2177 | |||
2178 | /* the last ref */ | ||
2179 | if (dest->cache_inode) { | ||
2180 | iput(dest->cache_inode); | ||
2181 | dest->cache_inode = NULL; | ||
2182 | } | ||
2177 | } | 2183 | } |
2178 | out_dput: | 2184 | out_dput: |
2179 | dput(dentry); | 2185 | dput(dentry); |