diff options
author | Stefan Behrens <sbehrens@giantdisaster.de> | 2012-11-05 12:29:28 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2012-12-12 17:15:39 -0500 |
commit | 63a212abc2315972b245f93cb11ae3acf3c0b513 (patch) | |
tree | 65d9f4020795b6a3521bf0a94922a082ae4ede6f /fs/btrfs/ioctl.c | |
parent | 5ac00addc7ac09110995fe967071d191b5981cc1 (diff) |
Btrfs: disallow some operations on the device replace target device
This patch adds some code to disallow operations on the device that
is used as the target for the device replace operation.
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 26f46dad3b0e..e54b5e50c927 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1375,6 +1375,11 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root, | |||
1375 | } | 1375 | } |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | if (device->is_tgtdev_for_dev_replace) { | ||
1379 | ret = -EINVAL; | ||
1380 | goto out_free; | ||
1381 | } | ||
1382 | |||
1378 | old_size = device->total_bytes; | 1383 | old_size = device->total_bytes; |
1379 | 1384 | ||
1380 | if (mod < 0) { | 1385 | if (mod < 0) { |
@@ -3102,7 +3107,8 @@ static long btrfs_ioctl_scrub(struct btrfs_root *root, void __user *arg) | |||
3102 | return PTR_ERR(sa); | 3107 | return PTR_ERR(sa); |
3103 | 3108 | ||
3104 | ret = btrfs_scrub_dev(root->fs_info, sa->devid, sa->start, sa->end, | 3109 | ret = btrfs_scrub_dev(root->fs_info, sa->devid, sa->start, sa->end, |
3105 | &sa->progress, sa->flags & BTRFS_SCRUB_READONLY); | 3110 | &sa->progress, sa->flags & BTRFS_SCRUB_READONLY, |
3111 | 0); | ||
3106 | 3112 | ||
3107 | if (copy_to_user(arg, sa, sizeof(*sa))) | 3113 | if (copy_to_user(arg, sa, sizeof(*sa))) |
3108 | ret = -EFAULT; | 3114 | ret = -EFAULT; |