aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorChris Mason <clm@fb.com>2015-10-12 19:24:40 -0400
committerChris Mason <clm@fb.com>2015-10-12 19:24:40 -0400
commit6db4a7335dd701a0e20275440ee057d3db2a7ae3 (patch)
treec0734d7411806ef91bfeb615bf528ffb349938fe /fs/btrfs/tree-log.c
parent62fb50ab7c903357c92cef2f7677235b92ac575f (diff)
parentee86395458072760d62e66aad10a5e9e8902b8cf (diff)
Merge branch 'fix/waitqueue-barriers' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux into for-linus-4.4
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index c3f9a9c71f28..1fffe8845c09 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -229,7 +229,9 @@ int btrfs_pin_log_trans(struct btrfs_root *root)
229void btrfs_end_log_trans(struct btrfs_root *root) 229void btrfs_end_log_trans(struct btrfs_root *root)
230{ 230{
231 if (atomic_dec_and_test(&root->log_writers)) { 231 if (atomic_dec_and_test(&root->log_writers)) {
232 smp_mb(); 232 /*
233 * Implicit memory barrier after atomic_dec_and_test
234 */
233 if (waitqueue_active(&root->log_writer_wait)) 235 if (waitqueue_active(&root->log_writer_wait))
234 wake_up(&root->log_writer_wait); 236 wake_up(&root->log_writer_wait);
235 } 237 }
@@ -2820,7 +2822,9 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2820 2822
2821 mutex_lock(&log_root_tree->log_mutex); 2823 mutex_lock(&log_root_tree->log_mutex);
2822 if (atomic_dec_and_test(&log_root_tree->log_writers)) { 2824 if (atomic_dec_and_test(&log_root_tree->log_writers)) {
2823 smp_mb(); 2825 /*
2826 * Implicit memory barrier after atomic_dec_and_test
2827 */
2824 if (waitqueue_active(&log_root_tree->log_writer_wait)) 2828 if (waitqueue_active(&log_root_tree->log_writer_wait))
2825 wake_up(&log_root_tree->log_writer_wait); 2829 wake_up(&log_root_tree->log_writer_wait);
2826 } 2830 }
@@ -2950,6 +2954,9 @@ out_wake_log_root:
2950 atomic_set(&log_root_tree->log_commit[index2], 0); 2954 atomic_set(&log_root_tree->log_commit[index2], 0);
2951 mutex_unlock(&log_root_tree->log_mutex); 2955 mutex_unlock(&log_root_tree->log_mutex);
2952 2956
2957 /*
2958 * The barrier before waitqueue_active is implied by mutex_unlock
2959 */
2953 if (waitqueue_active(&log_root_tree->log_commit_wait[index2])) 2960 if (waitqueue_active(&log_root_tree->log_commit_wait[index2]))
2954 wake_up(&log_root_tree->log_commit_wait[index2]); 2961 wake_up(&log_root_tree->log_commit_wait[index2]);
2955out: 2962out:
@@ -2961,6 +2968,9 @@ out:
2961 atomic_set(&root->log_commit[index1], 0); 2968 atomic_set(&root->log_commit[index1], 0);
2962 mutex_unlock(&root->log_mutex); 2969 mutex_unlock(&root->log_mutex);
2963 2970
2971 /*
2972 * The barrier before waitqueue_active is implied by mutex_unlock
2973 */
2964 if (waitqueue_active(&root->log_commit_wait[index1])) 2974 if (waitqueue_active(&root->log_commit_wait[index1]))
2965 wake_up(&root->log_commit_wait[index1]); 2975 wake_up(&root->log_commit_wait[index1]);
2966 return ret; 2976 return ret;