summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/compression.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2012-08-01 21:36:24 +0200
committerChris Mason <chris.mason@oracle.com>2012-08-28 22:53:33 +0200
commit66657b318e0e443ada229fccd40c8be86cfebdbf (patch)
treebf1334fff93556fbc8d82b26a6d5431fd9e74b5c /fs/btrfs/compression.c
parentBtrfs: fix deadlock in wait_for_more_refs (diff)
downloadlinux-66657b318e0e443ada229fccd40c8be86cfebdbf.tar.xz
linux-66657b318e0e443ada229fccd40c8be86cfebdbf.zip
Btrfs: barrier before waitqueue_active
We need a barrir before calling waitqueue_active otherwise we will miss wakeups. So in places that do atomic_dec(); then atomic_read() use atomic_dec_return() which imply a memory barrier (see memory-barriers.txt) and then add an explicit memory barrier everywhere else that need them. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r--fs/btrfs/compression.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 86eff48dab78..43d1c5a3a030 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -818,6 +818,7 @@ static void free_workspace(int type, struct list_head *workspace)
btrfs_compress_op[idx]->free_workspace(workspace);
atomic_dec(alloc_workspace);
wake:
+ smp_mb();
if (waitqueue_active(workspace_wait))
wake_up(workspace_wait);
}