diff options
-rw-r--r-- | fs/btrfs/disk-io.c | 2 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/btrfs/qgroup.c | 12 | ||||
-rw-r--r-- | fs/btrfs/qgroup.h | 3 |
4 files changed, 13 insertions, 6 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f5b2a7fb4575..7857f64e1cae 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -3864,7 +3864,7 @@ void close_ctree(struct btrfs_root *root) | |||
3864 | smp_mb(); | 3864 | smp_mb(); |
3865 | 3865 | ||
3866 | /* wait for the qgroup rescan worker to stop */ | 3866 | /* wait for the qgroup rescan worker to stop */ |
3867 | btrfs_qgroup_wait_for_completion(fs_info); | 3867 | btrfs_qgroup_wait_for_completion(fs_info, false); |
3868 | 3868 | ||
3869 | /* wait for the uuid_scan task to finish */ | 3869 | /* wait for the uuid_scan task to finish */ |
3870 | down(&fs_info->uuid_tree_rescan_sem); | 3870 | down(&fs_info->uuid_tree_rescan_sem); |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 14ed1e9e6bc8..b2a2da5893af 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -5084,7 +5084,7 @@ static long btrfs_ioctl_quota_rescan_wait(struct file *file, void __user *arg) | |||
5084 | if (!capable(CAP_SYS_ADMIN)) | 5084 | if (!capable(CAP_SYS_ADMIN)) |
5085 | return -EPERM; | 5085 | return -EPERM; |
5086 | 5086 | ||
5087 | return btrfs_qgroup_wait_for_completion(root->fs_info); | 5087 | return btrfs_qgroup_wait_for_completion(root->fs_info, true); |
5088 | } | 5088 | } |
5089 | 5089 | ||
5090 | static long _btrfs_ioctl_set_received_subvol(struct file *file, | 5090 | static long _btrfs_ioctl_set_received_subvol(struct file *file, |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 3fe295e2c84a..13eb6a7a4db1 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -995,7 +995,7 @@ int btrfs_quota_disable(struct btrfs_trans_handle *trans, | |||
995 | goto out; | 995 | goto out; |
996 | fs_info->quota_enabled = 0; | 996 | fs_info->quota_enabled = 0; |
997 | fs_info->pending_quota_state = 0; | 997 | fs_info->pending_quota_state = 0; |
998 | btrfs_qgroup_wait_for_completion(fs_info); | 998 | btrfs_qgroup_wait_for_completion(fs_info, false); |
999 | spin_lock(&fs_info->qgroup_lock); | 999 | spin_lock(&fs_info->qgroup_lock); |
1000 | quota_root = fs_info->quota_root; | 1000 | quota_root = fs_info->quota_root; |
1001 | fs_info->quota_root = NULL; | 1001 | fs_info->quota_root = NULL; |
@@ -2494,7 +2494,8 @@ btrfs_qgroup_rescan(struct btrfs_fs_info *fs_info) | |||
2494 | return 0; | 2494 | return 0; |
2495 | } | 2495 | } |
2496 | 2496 | ||
2497 | int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info) | 2497 | int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info, |
2498 | bool interruptible) | ||
2498 | { | 2499 | { |
2499 | int running; | 2500 | int running; |
2500 | int ret = 0; | 2501 | int ret = 0; |
@@ -2505,9 +2506,14 @@ int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info) | |||
2505 | spin_unlock(&fs_info->qgroup_lock); | 2506 | spin_unlock(&fs_info->qgroup_lock); |
2506 | mutex_unlock(&fs_info->qgroup_rescan_lock); | 2507 | mutex_unlock(&fs_info->qgroup_rescan_lock); |
2507 | 2508 | ||
2508 | if (running) | 2509 | if (!running) |
2510 | return 0; | ||
2511 | |||
2512 | if (interruptible) | ||
2509 | ret = wait_for_completion_interruptible( | 2513 | ret = wait_for_completion_interruptible( |
2510 | &fs_info->qgroup_rescan_completion); | 2514 | &fs_info->qgroup_rescan_completion); |
2515 | else | ||
2516 | wait_for_completion(&fs_info->qgroup_rescan_completion); | ||
2511 | 2517 | ||
2512 | return ret; | 2518 | return ret; |
2513 | } | 2519 | } |
diff --git a/fs/btrfs/qgroup.h b/fs/btrfs/qgroup.h index 710887c06aaf..af3e5578cad7 100644 --- a/fs/btrfs/qgroup.h +++ b/fs/btrfs/qgroup.h | |||
@@ -46,7 +46,8 @@ int btrfs_quota_disable(struct btrfs_trans_handle *trans, | |||
46 | struct btrfs_fs_info *fs_info); | 46 | struct btrfs_fs_info *fs_info); |
47 | int btrfs_qgroup_rescan(struct btrfs_fs_info *fs_info); | 47 | int btrfs_qgroup_rescan(struct btrfs_fs_info *fs_info); |
48 | void btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info); | 48 | void btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info); |
49 | int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info); | 49 | int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info, |
50 | bool interruptible); | ||
50 | int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans, | 51 | int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans, |
51 | struct btrfs_fs_info *fs_info, u64 src, u64 dst); | 52 | struct btrfs_fs_info *fs_info, u64 src, u64 dst); |
52 | int btrfs_del_qgroup_relation(struct btrfs_trans_handle *trans, | 53 | int btrfs_del_qgroup_relation(struct btrfs_trans_handle *trans, |