Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346707
b: refs/heads/master
c: 198605a
h: refs/heads/master
i:
  346705: 4ac8c24
  346703: a8bdc95
v: v3
  • Loading branch information
Miao Xie authored and Chris Mason committed Dec 17, 2012
1 parent 641e7eb commit 67cb771
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3c04ce01053413007b9df88313b8b8e17272b57b
refs/heads/master: 198605a8e2077f174c9834c97b836f535e4e56dd
10 changes: 8 additions & 2 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,12 +1298,13 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
return ret;
}

static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
static noinline int btrfs_ioctl_resize(struct file *file,
void __user *arg)
{
u64 new_size;
u64 old_size;
u64 devid = 1;
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
struct btrfs_ioctl_vol_args *vol_args;
struct btrfs_trans_handle *trans;
struct btrfs_device *device = NULL;
Expand All @@ -1318,6 +1319,10 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
if (!capable(CAP_SYS_ADMIN))
return -EPERM;

ret = mnt_want_write_file(file);
if (ret)
return ret;

if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
1)) {
pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
Expand Down Expand Up @@ -1425,6 +1430,7 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
kfree(vol_args);
out:
mutex_unlock(&root->fs_info->volume_mutex);
mnt_drop_write_file(file);
atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
return ret;
}
Expand Down Expand Up @@ -3832,7 +3838,7 @@ long btrfs_ioctl(struct file *file, unsigned int
case BTRFS_IOC_DEFRAG_RANGE:
return btrfs_ioctl_defrag(file, argp);
case BTRFS_IOC_RESIZE:
return btrfs_ioctl_resize(root, argp);
return btrfs_ioctl_resize(file, argp);
case BTRFS_IOC_ADD_DEV:
return btrfs_ioctl_add_dev(root, argp);
case BTRFS_IOC_RM_DEV:
Expand Down

0 comments on commit 67cb771

Please sign in to comment.