aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorYan, Zheng <zheng.yan@oracle.com>2009-10-09 09:25:16 -0400
committerChris Mason <chris.mason@oracle.com>2009-10-09 09:25:16 -0400
commitefefb1438be269897585934fc6c05deb4dfa01ce (patch)
tree41d3bf63789bc656421dfbd651bf38caf580ec03 /fs
parentff782e0a131c7f669445c07fe5c7ba91e043b7ed (diff)
Btrfs: remove negative dentry when deleting subvolumne
The use of btrfs_dentry_delete is removing dentries from the dcache when deleting subvolumne. btrfs_dentry_delete ignores negative dentries. This is incorrect since if we don't remove the negative dentry, its parent dentry can't be removed. Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c12
-rw-r--r--fs/btrfs/ioctl.c1
2 files changed, 8 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ccc4f1121210..d3585cb6483c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3629,12 +3629,14 @@ static int btrfs_dentry_delete(struct dentry *dentry)
3629{ 3629{
3630 struct btrfs_root *root; 3630 struct btrfs_root *root;
3631 3631
3632 if (!dentry->d_inode) 3632 if (!dentry->d_inode && !IS_ROOT(dentry))
3633 return 0; 3633 dentry = dentry->d_parent;
3634 3634
3635 root = BTRFS_I(dentry->d_inode)->root; 3635 if (dentry->d_inode) {
3636 if (btrfs_root_refs(&root->root_item) == 0) 3636 root = BTRFS_I(dentry->d_inode)->root;
3637 return 1; 3637 if (btrfs_root_refs(&root->root_item) == 0)
3638 return 1;
3639 }
3638 return 0; 3640 return 0;
3639} 3641}
3640 3642
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 9a780c8d0ac8..e8795becad4c 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -830,6 +830,7 @@ out_up_write:
830out_unlock: 830out_unlock:
831 mutex_unlock(&inode->i_mutex); 831 mutex_unlock(&inode->i_mutex);
832 if (!err) { 832 if (!err) {
833 shrink_dcache_sb(root->fs_info->sb);
833 btrfs_invalidate_inodes(dest); 834 btrfs_invalidate_inodes(dest);
834 d_delete(dentry); 835 d_delete(dentry);
835 } 836 }