diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 80bd63738c6d..fa49e900216a 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/migrate.h> | 31 | #include <linux/migrate.h> |
32 | #include <linux/ratelimit.h> | 32 | #include <linux/ratelimit.h> |
33 | #include <linux/uuid.h> | 33 | #include <linux/uuid.h> |
34 | #include <linux/semaphore.h> | ||
34 | #include <asm/unaligned.h> | 35 | #include <asm/unaligned.h> |
35 | #include "compat.h" | 36 | #include "compat.h" |
36 | #include "ctree.h" | 37 | #include "ctree.h" |
@@ -2297,6 +2298,7 @@ int open_ctree(struct super_block *sb, | |||
2297 | init_rwsem(&fs_info->extent_commit_sem); | 2298 | init_rwsem(&fs_info->extent_commit_sem); |
2298 | init_rwsem(&fs_info->cleanup_work_sem); | 2299 | init_rwsem(&fs_info->cleanup_work_sem); |
2299 | init_rwsem(&fs_info->subvol_sem); | 2300 | init_rwsem(&fs_info->subvol_sem); |
2301 | sema_init(&fs_info->uuid_tree_rescan_sem, 1); | ||
2300 | fs_info->dev_replace.lock_owner = 0; | 2302 | fs_info->dev_replace.lock_owner = 0; |
2301 | atomic_set(&fs_info->dev_replace.nesting_level, 0); | 2303 | atomic_set(&fs_info->dev_replace.nesting_level, 0); |
2302 | mutex_init(&fs_info->dev_replace.lock_finishing_cancel_unmount); | 2304 | mutex_init(&fs_info->dev_replace.lock_finishing_cancel_unmount); |
@@ -3554,6 +3556,11 @@ int close_ctree(struct btrfs_root *root) | |||
3554 | fs_info->closing = 1; | 3556 | fs_info->closing = 1; |
3555 | smp_mb(); | 3557 | smp_mb(); |
3556 | 3558 | ||
3559 | /* wait for the uuid_scan task to finish */ | ||
3560 | down(&fs_info->uuid_tree_rescan_sem); | ||
3561 | /* avoid complains from lockdep et al., set sem back to initial state */ | ||
3562 | up(&fs_info->uuid_tree_rescan_sem); | ||
3563 | |||
3557 | /* pause restriper - we want to resume on mount */ | 3564 | /* pause restriper - we want to resume on mount */ |
3558 | btrfs_pause_balance(fs_info); | 3565 | btrfs_pause_balance(fs_info); |
3559 | 3566 | ||