Commit efefb1438be269897585934fc6c05deb4dfa01ce

Authored by Yan, Zheng
Committed by Chris Mason
1 parent ff782e0a13

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>

Showing 2 changed files with 8 additions and 5 deletions Side-by-side Diff

... ... @@ -3629,12 +3629,14 @@
3629 3629 {
3630 3630 struct btrfs_root *root;
3631 3631  
3632   - if (!dentry->d_inode)
3633   - return 0;
  3632 + if (!dentry->d_inode && !IS_ROOT(dentry))
  3633 + dentry = dentry->d_parent;
3634 3634  
3635   - root = BTRFS_I(dentry->d_inode)->root;
3636   - if (btrfs_root_refs(&root->root_item) == 0)
3637   - return 1;
  3635 + if (dentry->d_inode) {
  3636 + root = BTRFS_I(dentry->d_inode)->root;
  3637 + if (btrfs_root_refs(&root->root_item) == 0)
  3638 + return 1;
  3639 + }
3638 3640 return 0;
3639 3641 }
3640 3642  
... ... @@ -830,6 +830,7 @@
830 830 out_unlock:
831 831 mutex_unlock(&inode->i_mutex);
832 832 if (!err) {
  833 + shrink_dcache_sb(root->fs_info->sb);
833 834 btrfs_invalidate_inodes(dest);
834 835 d_delete(dentry);
835 836 }