aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 74609b931ba5..20957ed47ce2 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -717,7 +717,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
717 if (ret) 717 if (ret)
718 goto fail; 718 goto fail;
719 719
720 inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry); 720 inode = btrfs_lookup_dentry(d_inode(dentry->d_parent), dentry);
721 if (IS_ERR(inode)) { 721 if (IS_ERR(inode)) {
722 ret = PTR_ERR(inode); 722 ret = PTR_ERR(inode);
723 goto fail; 723 goto fail;
@@ -761,10 +761,10 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
761{ 761{
762 int error; 762 int error;
763 763
764 if (!victim->d_inode) 764 if (d_really_is_negative(victim))
765 return -ENOENT; 765 return -ENOENT;
766 766
767 BUG_ON(victim->d_parent->d_inode != dir); 767 BUG_ON(d_inode(victim->d_parent) != dir);
768 audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE); 768 audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
769 769
770 error = inode_permission(dir, MAY_WRITE | MAY_EXEC); 770 error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
@@ -772,8 +772,8 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
772 return error; 772 return error;
773 if (IS_APPEND(dir)) 773 if (IS_APPEND(dir))
774 return -EPERM; 774 return -EPERM;
775 if (check_sticky(dir, victim->d_inode) || IS_APPEND(victim->d_inode) || 775 if (check_sticky(dir, d_inode(victim)) || IS_APPEND(d_inode(victim)) ||
776 IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode)) 776 IS_IMMUTABLE(d_inode(victim)) || IS_SWAPFILE(d_inode(victim)))
777 return -EPERM; 777 return -EPERM;
778 if (isdir) { 778 if (isdir) {
779 if (!d_is_dir(victim)) 779 if (!d_is_dir(victim))
@@ -792,7 +792,7 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
792/* copy of may_create in fs/namei.c() */ 792/* copy of may_create in fs/namei.c() */
793static inline int btrfs_may_create(struct inode *dir, struct dentry *child) 793static inline int btrfs_may_create(struct inode *dir, struct dentry *child)
794{ 794{
795 if (child->d_inode) 795 if (d_really_is_positive(child))
796 return -EEXIST; 796 return -EEXIST;
797 if (IS_DEADDIR(dir)) 797 if (IS_DEADDIR(dir))
798 return -ENOENT; 798 return -ENOENT;
@@ -810,7 +810,7 @@ static noinline int btrfs_mksubvol(struct path *parent,
810 u64 *async_transid, bool readonly, 810 u64 *async_transid, bool readonly,
811 struct btrfs_qgroup_inherit *inherit) 811 struct btrfs_qgroup_inherit *inherit)
812{ 812{
813 struct inode *dir = parent->dentry->d_inode; 813 struct inode *dir = d_inode(parent->dentry);
814 struct dentry *dentry; 814 struct dentry *dentry;
815 int error; 815 int error;
816 816
@@ -824,7 +824,7 @@ static noinline int btrfs_mksubvol(struct path *parent,
824 goto out_unlock; 824 goto out_unlock;
825 825
826 error = -EEXIST; 826 error = -EEXIST;
827 if (dentry->d_inode) 827 if (d_really_is_positive(dentry))
828 goto out_dput; 828 goto out_dput;
829 829
830 error = btrfs_may_create(dir, dentry); 830 error = btrfs_may_create(dir, dentry);
@@ -2294,7 +2294,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2294{ 2294{
2295 struct dentry *parent = file->f_path.dentry; 2295 struct dentry *parent = file->f_path.dentry;
2296 struct dentry *dentry; 2296 struct dentry *dentry;
2297 struct inode *dir = parent->d_inode; 2297 struct inode *dir = d_inode(parent);
2298 struct inode *inode; 2298 struct inode *inode;
2299 struct btrfs_root *root = BTRFS_I(dir)->root; 2299 struct btrfs_root *root = BTRFS_I(dir)->root;
2300 struct btrfs_root *dest = NULL; 2300 struct btrfs_root *dest = NULL;
@@ -2333,12 +2333,12 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2333 goto out_unlock_dir; 2333 goto out_unlock_dir;
2334 } 2334 }
2335 2335
2336 if (!dentry->d_inode) { 2336 if (d_really_is_negative(dentry)) {
2337 err = -ENOENT; 2337 err = -ENOENT;
2338 goto out_dput; 2338 goto out_dput;
2339 } 2339 }
2340 2340
2341 inode = dentry->d_inode; 2341 inode = d_inode(dentry);
2342 dest = BTRFS_I(inode)->root; 2342 dest = BTRFS_I(inode)->root;
2343 if (!capable(CAP_SYS_ADMIN)) { 2343 if (!capable(CAP_SYS_ADMIN)) {
2344 /* 2344 /*