Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349173
b: refs/heads/master
c: 25122d1
h: refs/heads/master
i:
  349171: 76f598e
v: v3
  • Loading branch information
Ilya Dryomov committed Jan 20, 2013
1 parent 2faf89e commit 87c6421
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 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: 4ac20c70b0734b65662ded735e5f6ba0415bdb71
refs/heads/master: 25122d15e21cf252e91e4cad7cea760f97df29f1
17 changes: 9 additions & 8 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2186,19 +2186,20 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
struct btrfs_ioctl_defrag_range_args *range;
int ret;

if (btrfs_root_readonly(root))
return -EROFS;
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");
mnt_drop_write_file(file);
return -EINVAL;
}
ret = mnt_want_write_file(file);
if (ret) {
atomic_set(&root->fs_info->mutually_exclusive_operation_running,
0);
return ret;

if (btrfs_root_readonly(root)) {
ret = -EROFS;
goto out;
}

switch (inode->i_mode & S_IFMT) {
Expand Down Expand Up @@ -2250,8 +2251,8 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
ret = -EINVAL;
}
out:
mnt_drop_write_file(file);
atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
mnt_drop_write_file(file);
return ret;
}

Expand Down

0 comments on commit 87c6421

Please sign in to comment.