diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
| -rw-r--r-- | fs/btrfs/ioctl.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 43f0012016e3..bc2f6ffff3cf 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -195,6 +195,10 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
| 195 | if (!inode_owner_or_capable(inode)) | 195 | if (!inode_owner_or_capable(inode)) |
| 196 | return -EACCES; | 196 | return -EACCES; |
| 197 | 197 | ||
| 198 | ret = mnt_want_write_file(file); | ||
| 199 | if (ret) | ||
| 200 | return ret; | ||
| 201 | |||
| 198 | mutex_lock(&inode->i_mutex); | 202 | mutex_lock(&inode->i_mutex); |
| 199 | 203 | ||
| 200 | ip_oldflags = ip->flags; | 204 | ip_oldflags = ip->flags; |
| @@ -209,10 +213,6 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
| 209 | } | 213 | } |
| 210 | } | 214 | } |
| 211 | 215 | ||
| 212 | ret = mnt_want_write_file(file); | ||
| 213 | if (ret) | ||
| 214 | goto out_unlock; | ||
| 215 | |||
| 216 | if (flags & FS_SYNC_FL) | 216 | if (flags & FS_SYNC_FL) |
| 217 | ip->flags |= BTRFS_INODE_SYNC; | 217 | ip->flags |= BTRFS_INODE_SYNC; |
| 218 | else | 218 | else |
| @@ -275,9 +275,9 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
| 275 | inode->i_flags = i_oldflags; | 275 | inode->i_flags = i_oldflags; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | mnt_drop_write_file(file); | ||
| 279 | out_unlock: | 278 | out_unlock: |
| 280 | mutex_unlock(&inode->i_mutex); | 279 | mutex_unlock(&inode->i_mutex); |
| 280 | mnt_drop_write_file(file); | ||
| 281 | return ret; | 281 | return ret; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| @@ -664,6 +664,10 @@ static noinline int btrfs_mksubvol(struct path *parent, | |||
| 664 | struct dentry *dentry; | 664 | struct dentry *dentry; |
| 665 | int error; | 665 | int error; |
| 666 | 666 | ||
| 667 | error = mnt_want_write(parent->mnt); | ||
| 668 | if (error) | ||
| 669 | return error; | ||
| 670 | |||
| 667 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 671 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
| 668 | 672 | ||
| 669 | dentry = lookup_one_len(name, parent->dentry, namelen); | 673 | dentry = lookup_one_len(name, parent->dentry, namelen); |
| @@ -699,6 +703,7 @@ out_dput: | |||
| 699 | dput(dentry); | 703 | dput(dentry); |
| 700 | out_unlock: | 704 | out_unlock: |
| 701 | mutex_unlock(&dir->i_mutex); | 705 | mutex_unlock(&dir->i_mutex); |
| 706 | mnt_drop_write(parent->mnt); | ||
| 702 | return error; | 707 | return error; |
| 703 | } | 708 | } |
| 704 | 709 | ||
