]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Btrfs: disallow 'btrfs {balance,replace} cancel' on ro mounts
authorIlya Dryomov <idryomov@gmail.com>
Thu, 10 Oct 2013 17:40:21 +0000 (20:40 +0300)
committerChris Mason <chris.mason@fusionio.com>
Tue, 12 Nov 2013 03:00:50 +0000 (22:00 -0500)
For both balance and replace, cancelling involves changing the on-disk
state and committing a transaction, which is not a good thing to do on
read-only filesystems.

Cc: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/dev-replace.c
fs/btrfs/volumes.c

index 9efb94e95858e8c53cb84f587b74a064e8701dc4..98df261813495e55ae48bae787240049fbdd2ff0 100644 (file)
@@ -650,6 +650,9 @@ static u64 __btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info)
        u64 result;
        int ret;
 
+       if (fs_info->sb->s_flags & MS_RDONLY)
+               return -EROFS;
+
        mutex_lock(&dev_replace->lock_finishing_cancel_unmount);
        btrfs_dev_replace_lock(dev_replace);
        switch (dev_replace->replace_state) {
index 9dfe038015f7530bf74f1a960fd060f2afd94043..5d7ea267d8ff69df2f3faf12850f752962651c56 100644 (file)
@@ -3424,6 +3424,9 @@ int btrfs_pause_balance(struct btrfs_fs_info *fs_info)
 
 int btrfs_cancel_balance(struct btrfs_fs_info *fs_info)
 {
+       if (fs_info->sb->s_flags & MS_RDONLY)
+               return -EROFS;
+
        mutex_lock(&fs_info->balance_mutex);
        if (!fs_info->balance_ctl) {
                mutex_unlock(&fs_info->balance_mutex);