summaryrefslogtreecommitdiffstats
path: root/net/rds
diff options
context:
space:
mode:
authorYewon Choi <woni9911@gmail.com>2024-03-15 18:28:38 +0900
committerPaolo Abeni <pabeni@redhat.com>2024-03-19 12:15:35 +0100
commit1422f28826d2a0c11e5240b3e951c9e214d8656e (patch)
tree6b208c1d97cc3cb3976ed22ece2bc54ffda596cd /net/rds
parent9966e329d6756ea80832376991eb5b0d5ff2cf6b (diff)
downloadlinux-stable-1422f28826d2a0c11e5240b3e951c9e214d8656e.tar.gz
linux-stable-1422f28826d2a0c11e5240b3e951c9e214d8656e.tar.bz2
linux-stable-1422f28826d2a0c11e5240b3e951c9e214d8656e.zip
rds: introduce acquire/release ordering in acquire/release_in_xmit()
acquire/release_in_xmit() work as bit lock in rds_send_xmit(), so they are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on top of this, following smp_mb__after_atomic() does not guarantee release ordering (memory barrier actually should be placed before clear_bit()). Instead, we use clear_bit_unlock/test_and_set_bit_lock() here. Fixes: 0f4b1c7e89e6 ("rds: fix rds_send_xmit() serialization") Fixes: 1f9ecd7eacfd ("RDS: Pass rds_conn_path to rds_send_xmit()") Signed-off-by: Yewon Choi <woni9911@gmail.com> Reviewed-by: Michal Kubiak <michal.kubiak@intel.com> Link: https://lore.kernel.org/r/ZfQUxnNTO9AJmzwc@libra05 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/send.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/rds/send.c b/net/rds/send.c
index 2899def23865..09a280110654 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -103,13 +103,12 @@ EXPORT_SYMBOL_GPL(rds_send_path_reset);
static int acquire_in_xmit(struct rds_conn_path *cp)
{
- return test_and_set_bit(RDS_IN_XMIT, &cp->cp_flags) == 0;
+ return test_and_set_bit_lock(RDS_IN_XMIT, &cp->cp_flags) == 0;
}
static void release_in_xmit(struct rds_conn_path *cp)
{
- clear_bit(RDS_IN_XMIT, &cp->cp_flags);
- smp_mb__after_atomic();
+ clear_bit_unlock(RDS_IN_XMIT, &cp->cp_flags);
/*
* We don't use wait_on_bit()/wake_up_bit() because our waking is in a
* hot path and finding waiters is very rare. We don't want to walk