History

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,

Josef Bacik committed 13 years ago

Commit db1d6071 parent 6e137ed1 file · +2 −0Browse files

Unified · Split

fs/btrfs/ordered-data.c+2−0
@@ -557,6 +557,7 @@ void btrfs_wait_ordered_extents(struct btrfs_root *root, int delay_iput) · 556 unmodified lines
557557 INIT_LIST_HEAD(&splice);
558558 INIT_LIST_HEAD(&works);
559559
560+ mutex_lock(&root->fs_info->ordered_operations_mutex);
560561 spin_lock(&root->fs_info->ordered_extent_lock);
561562 list_splice_init(&root->fs_info->ordered_extents, &splice);
562563 while (!list_empty(&splice)) {
@@ -600,6 +601,7 @@ void btrfs_wait_ordered_extents(struct btrfs_root *root, int delay_iput) · 37 unmodified lines
600601
601602 cond_resched();
602603 }
604+ mutex_unlock(&root->fs_info->ordered_operations_mutex);
603605 }
604606
605607 /*