summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2018-03-20 12:28:05 -0400
committerDavid Sterba <dsterba@suse.com>2018-05-28 12:07:24 -0400
commita17c95df4cc8ade4e0e7276a04c0cc89505c74d7 (patch)
tree8176d351a07df707917f417278ab23cda83dd711
parent72b81abf95ae8d2c78c5f38197f47597cf192d2b (diff)
btrfs: move clearing of EXCL_OP out of __cancel_balance
Make the clearning visible in the callers so we can pair it with the test_and_set part. Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/ioctl.c2
-rw-r--r--fs/btrfs/volumes.c13
2 files changed, 8 insertions, 7 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 937afa8e1613..f0d0aef3826a 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4462,7 +4462,7 @@ do_balance:
4462 * Ownership of bctl and filesystem flag BTRFS_FS_EXCL_OP 4462 * Ownership of bctl and filesystem flag BTRFS_FS_EXCL_OP
4463 * goes to to btrfs_balance. bctl is freed in __cancel_balance, 4463 * goes to to btrfs_balance. bctl is freed in __cancel_balance,
4464 * or, if restriper was paused all the way until unmount, in 4464 * or, if restriper was paused all the way until unmount, in
4465 * free_fs_info. The flag is cleared in __cancel_balance. 4465 * free_fs_info. The flag should be cleared after __cancel_balance.
4466 */ 4466 */
4467 need_unlock = false; 4467 need_unlock = false;
4468 4468
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 1da46365657b..7e3656c9798b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3780,8 +3780,6 @@ static void __cancel_balance(struct btrfs_fs_info *fs_info)
3780 ret = del_balance_item(fs_info); 3780 ret = del_balance_item(fs_info);
3781 if (ret) 3781 if (ret)
3782 btrfs_handle_fs_error(fs_info, ret, NULL); 3782 btrfs_handle_fs_error(fs_info, ret, NULL);
3783
3784 clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags);
3785} 3783}
3786 3784
3787/* Non-zero return value signifies invalidity */ 3785/* Non-zero return value signifies invalidity */
@@ -3939,6 +3937,7 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3939 if ((ret && ret != -ECANCELED && ret != -ENOSPC) || 3937 if ((ret && ret != -ECANCELED && ret != -ENOSPC) ||
3940 balance_need_close(fs_info)) { 3938 balance_need_close(fs_info)) {
3941 __cancel_balance(fs_info); 3939 __cancel_balance(fs_info);
3940 clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags);
3942 } 3941 }
3943 3942
3944 wake_up(&fs_info->balance_wait_q); 3943 wake_up(&fs_info->balance_wait_q);
@@ -3947,10 +3946,10 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3947out: 3946out:
3948 if (bctl->flags & BTRFS_BALANCE_RESUME) 3947 if (bctl->flags & BTRFS_BALANCE_RESUME)
3949 __cancel_balance(fs_info); 3948 __cancel_balance(fs_info);
3950 else { 3949 else
3951 kfree(bctl); 3950 kfree(bctl);
3952 clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags); 3951 clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags);
3953 } 3952
3954 return ret; 3953 return ret;
3955} 3954}
3956 3955
@@ -4118,8 +4117,10 @@ int btrfs_cancel_balance(struct btrfs_fs_info *fs_info)
4118 mutex_lock(&fs_info->volume_mutex); 4117 mutex_lock(&fs_info->volume_mutex);
4119 mutex_lock(&fs_info->balance_mutex); 4118 mutex_lock(&fs_info->balance_mutex);
4120 4119
4121 if (fs_info->balance_ctl) 4120 if (fs_info->balance_ctl) {
4122 __cancel_balance(fs_info); 4121 __cancel_balance(fs_info);
4122 clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags);
4123 }
4123 4124
4124 mutex_unlock(&fs_info->volume_mutex); 4125 mutex_unlock(&fs_info->volume_mutex);
4125 } 4126 }