From: David Sterba Date: Fri, 16 Mar 2018 01:39:40 +0000 (+0100) Subject: btrfs: update barrier in should_cow_block X-Git-Tag: v5.15~9135^2~6 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=d1980131ca7f0776542f776ceb777cd01eb983e2;p=mirror_ubuntu-kernels.git btrfs: update barrier in should_cow_block Once there was a simple int force_cow that was used with the plain barriers, and then converted to a bit, so we should use the appropriate barrier helper. Other variables in the complex if condition do not depend on a barrier, so we should be fine in case the atomic barrier becomes a no-op. Signed-off-by: David Sterba --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 7c8faeb868f4..a2c9d21176e2 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1441,8 +1441,8 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans, if (btrfs_is_testing(root->fs_info)) return 0; - /* ensure we can see the force_cow */ - smp_rmb(); + /* Ensure we can see the FORCE_COW bit */ + smp_mb__before_atomic(); /* * We do not need to cow a block if