diff options
-rw-r--r-- | fs/btrfs/ctree.h | 2 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 5 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 9 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 2 |
4 files changed, 10 insertions, 8 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index c5f40dc1f74f..e9c2f8895eab 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1614,7 +1614,7 @@ struct btrfs_fs_info { | |||
1614 | 1614 | ||
1615 | spinlock_t delayed_iput_lock; | 1615 | spinlock_t delayed_iput_lock; |
1616 | struct list_head delayed_iputs; | 1616 | struct list_head delayed_iputs; |
1617 | struct rw_semaphore delayed_iput_sem; | 1617 | struct mutex cleaner_delayed_iput_mutex; |
1618 | 1618 | ||
1619 | /* this protects tree_mod_seq_list */ | 1619 | /* this protects tree_mod_seq_list */ |
1620 | spinlock_t tree_mod_seq_lock; | 1620 | spinlock_t tree_mod_seq_lock; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 64f02c3d0dd0..be03f93ca257 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1801,7 +1801,10 @@ static int cleaner_kthread(void *arg) | |||
1801 | goto sleep; | 1801 | goto sleep; |
1802 | } | 1802 | } |
1803 | 1803 | ||
1804 | mutex_lock(&root->fs_info->cleaner_delayed_iput_mutex); | ||
1804 | btrfs_run_delayed_iputs(root); | 1805 | btrfs_run_delayed_iputs(root); |
1806 | mutex_unlock(&root->fs_info->cleaner_delayed_iput_mutex); | ||
1807 | |||
1805 | again = btrfs_clean_one_deleted_snapshot(root); | 1808 | again = btrfs_clean_one_deleted_snapshot(root); |
1806 | mutex_unlock(&root->fs_info->cleaner_mutex); | 1809 | mutex_unlock(&root->fs_info->cleaner_mutex); |
1807 | 1810 | ||
@@ -2571,8 +2574,8 @@ int open_ctree(struct super_block *sb, | |||
2571 | mutex_init(&fs_info->delete_unused_bgs_mutex); | 2574 | mutex_init(&fs_info->delete_unused_bgs_mutex); |
2572 | mutex_init(&fs_info->reloc_mutex); | 2575 | mutex_init(&fs_info->reloc_mutex); |
2573 | mutex_init(&fs_info->delalloc_root_mutex); | 2576 | mutex_init(&fs_info->delalloc_root_mutex); |
2577 | mutex_init(&fs_info->cleaner_delayed_iput_mutex); | ||
2574 | seqlock_init(&fs_info->profiles_lock); | 2578 | seqlock_init(&fs_info->profiles_lock); |
2575 | init_rwsem(&fs_info->delayed_iput_sem); | ||
2576 | 2579 | ||
2577 | INIT_LIST_HEAD(&fs_info->dirty_cowonly_roots); | 2580 | INIT_LIST_HEAD(&fs_info->dirty_cowonly_roots); |
2578 | INIT_LIST_HEAD(&fs_info->space_info); | 2581 | INIT_LIST_HEAD(&fs_info->space_info); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 92843ab772a5..abcffa4b8231 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -4153,11 +4153,12 @@ commit_trans: | |||
4153 | if (ret) | 4153 | if (ret) |
4154 | return ret; | 4154 | return ret; |
4155 | /* | 4155 | /* |
4156 | * make sure that all running delayed iput are | 4156 | * The cleaner kthread might still be doing iput |
4157 | * done | 4157 | * operations. Wait for it to finish so that |
4158 | * more space is released. | ||
4158 | */ | 4159 | */ |
4159 | down_write(&root->fs_info->delayed_iput_sem); | 4160 | mutex_lock(&root->fs_info->cleaner_delayed_iput_mutex); |
4160 | up_write(&root->fs_info->delayed_iput_sem); | 4161 | mutex_unlock(&root->fs_info->cleaner_delayed_iput_mutex); |
4161 | goto again; | 4162 | goto again; |
4162 | } else { | 4163 | } else { |
4163 | btrfs_end_transaction(trans, root); | 4164 | btrfs_end_transaction(trans, root); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 85afe66955cf..8ad9e2200442 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -3134,7 +3134,6 @@ void btrfs_run_delayed_iputs(struct btrfs_root *root) | |||
3134 | { | 3134 | { |
3135 | struct btrfs_fs_info *fs_info = root->fs_info; | 3135 | struct btrfs_fs_info *fs_info = root->fs_info; |
3136 | 3136 | ||
3137 | down_read(&fs_info->delayed_iput_sem); | ||
3138 | spin_lock(&fs_info->delayed_iput_lock); | 3137 | spin_lock(&fs_info->delayed_iput_lock); |
3139 | while (!list_empty(&fs_info->delayed_iputs)) { | 3138 | while (!list_empty(&fs_info->delayed_iputs)) { |
3140 | struct btrfs_inode *inode; | 3139 | struct btrfs_inode *inode; |
@@ -3153,7 +3152,6 @@ void btrfs_run_delayed_iputs(struct btrfs_root *root) | |||
3153 | spin_lock(&fs_info->delayed_iput_lock); | 3152 | spin_lock(&fs_info->delayed_iput_lock); |
3154 | } | 3153 | } |
3155 | spin_unlock(&fs_info->delayed_iput_lock); | 3154 | spin_unlock(&fs_info->delayed_iput_lock); |
3156 | up_read(&root->fs_info->delayed_iput_sem); | ||
3157 | } | 3155 | } |
3158 | 3156 | ||
3159 | /* | 3157 | /* |