summaryrefslogtreecommitdiffstats
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 ca5d968f4c37..b05653f182c2 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -724,7 +724,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
724 if (ret) 724 if (ret)
725 goto fail; 725 goto fail;
726 726
727 inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry); 727 inode = btrfs_lookup_dentry(d_inode(dentry->d_parent), dentry);
728 if (IS_ERR(inode)) { 728 if (IS_ERR(inode)) {
729 ret = PTR_ERR(inode); 729 ret = PTR_ERR(inode);
730 goto fail; 730 goto fail;
@@ -768,10 +768,10 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
768{ 768{
769 int error; 769 int error;
770 770
771 if (!victim->d_inode) 771 if (d_really_is_negative(victim))
772 return -ENOENT; 772 return -ENOENT;
773 773
774 BUG_ON(victim->d_parent->d_inode != dir); 774 BUG_ON(d_inode(victim->d_parent) != dir);
775 audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE); 775 audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
776 776
777 error = inode_permission(dir, MAY_WRITE | MAY_EXEC); 777 error = inode_permission(dir, MAY_WRITE | MAY_EXEC);
@@ -779,8 +779,8 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
779 return error; 779 return error;
780 if (IS_APPEND(dir)) 780 if (IS_APPEND(dir))
781 return -EPERM; 781 return -EPERM;
782 if (check_sticky(dir, victim->d_inode) || IS_APPEND(victim->d_inode) || 782 if (check_sticky(dir, d_inode(victim)) || IS_APPEND(d_inode(victim)) ||
783 IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode)) 783 IS_IMMUTABLE(d_inode(victim)) || IS_SWAPFILE(d_inode(victim)))
784 return -EPERM; 784 return -EPERM;
785 if (isdir) { 785 if (isdir) {
786 if (!d_is_dir(victim)) 786 if (!d_is_dir(victim))
@@ -799,7 +799,7 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir)
799/* copy of may_create in fs/namei.c() */ 799/* copy of may_create in fs/namei.c() */
800static inline int btrfs_may_create(struct inode *dir, struct dentry *child) 800static inline int btrfs_may_create(struct inode *dir, struct dentry *child)
801{ 801{
802 if (child->d_inode) 802 if (d_really_is_positive(child))
803 return -EEXIST; 803 return -EEXIST;
804 if (IS_DEADDIR(dir)) 804 if (IS_DEADDIR(dir))
805 return -ENOENT; 805 return -ENOENT;
@@ -817,7 +817,7 @@ static noinline int btrfs_mksubvol(struct path *parent,
817 u64 *async_transid, bool readonly, 817 u64 *async_transid, bool readonly,
818 struct btrfs_qgroup_inherit *inherit) 818 struct btrfs_qgroup_inherit *inherit)
819{ 819{
820 struct inode *dir = parent->dentry->d_inode; 820 struct inode *dir = d_inode(parent->dentry);
821 struct dentry *dentry; 821 struct dentry *dentry;
822 int error; 822 int error;
823 823
@@ -831,7 +831,7 @@ static noinline int btrfs_mksubvol(struct path *parent,
831 goto out_unlock; 831 goto out_unlock;
832 832
833 error = -EEXIST; 833 error = -EEXIST;
834 if (dentry->d_inode) 834 if (d_really_is_positive(dentry))
835 goto out_dput; 835 goto out_dput;
836 836
837 error = btrfs_may_create(dir, dentry); 837 error = btrfs_may_create(dir, dentry);
@@ -2301,7 +2301,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2301{ 2301{
2302 struct dentry *parent = file->f_path.dentry; 2302 struct dentry *parent = file->f_path.dentry;
2303 struct dentry *dentry; 2303 struct dentry *dentry;
2304 struct inode *dir = parent->d_inode; 2304 struct inode *dir = d_inode(parent);
2305 struct inode *inode; 2305 struct inode *inode;
2306 struct btrfs_root *root = BTRFS_I(dir)->root; 2306 struct btrfs_root *root = BTRFS_I(dir)->root;
2307 struct btrfs_root *dest = NULL; 2307 struct btrfs_root *dest = NULL;
@@ -2340,12 +2340,12 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2340 goto out_unlock_dir; 2340 goto out_unlock_dir;
2341 } 2341 }
2342 2342
2343 if (!dentry->d_inode) { 2343 if (d_really_is_negative(dentry)) {
2344 err = -ENOENT; 2344 err = -ENOENT;
2345 goto out_dput; 2345 goto out_dput;
2346 } 2346 }
2347 2347
2348 inode = dentry->d_inode; 2348 inode = d_inode(dentry);
2349 dest = BTRFS_I(inode)->root; 2349 dest = BTRFS_I(inode)->root;
2350 if (!capable(CAP_SYS_ADMIN)) { 2350 if (!capable(CAP_SYS_ADMIN)) {
2351 /* 2351 /*