summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ordered-data.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-03-26 15:29:11 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-03-28 09:51:28 -0400
commitdb1d607d3ca5cbb283cbb17d648cd7e8dc67cc7b (patch)
tree6bab8a86eeb652e18e6d3207ea4d8e26727e3f4b /fs/btrfs/ordered-data.c
parent6e137ed3f30574f314733d4b7a86ea6523232b14 (diff)
downloadlinux-stable-db1d607d3ca5cbb283cbb17d648cd7e8dc67cc7b.tar.gz
linux-stable-db1d607d3ca5cbb283cbb17d648cd7e8dc67cc7b.tar.bz2
linux-stable-db1d607d3ca5cbb283cbb17d648cd7e8dc67cc7b.zip
Btrfs: hold the ordered operations mutex when waiting on ordered extents
We need to hold the ordered_operations mutex while waiting on ordered extents since we splice and run the ordered extents list. We need to make sure anybody else who wants to wait on ordered extents does actually wait for them to be completed. This will keep us from bailing out of flushing in case somebody is already waiting on ordered extents to complete. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
-rw-r--r--fs/btrfs/ordered-data.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index dc08d77b717e..005c45db699e 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -557,6 +557,7 @@ void btrfs_wait_ordered_extents(struct btrfs_root *root, int delay_iput)
INIT_LIST_HEAD(&splice);
INIT_LIST_HEAD(&works);
+ mutex_lock(&root->fs_info->ordered_operations_mutex);
spin_lock(&root->fs_info->ordered_extent_lock);
list_splice_init(&root->fs_info->ordered_extents, &splice);
while (!list_empty(&splice)) {
@@ -600,6 +601,7 @@ void btrfs_wait_ordered_extents(struct btrfs_root *root, int delay_iput)
cond_resched();
}
+ mutex_unlock(&root->fs_info->ordered_operations_mutex);
}
/*