Skip to content

Commit 1422f28

Browse files
healwonPaolo Abeni
authored andcommitted
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: 0f4b1c7 ("rds: fix rds_send_xmit() serialization") Fixes: 1f9ecd7 ("RDS: Pass rds_conn_path to rds_send_xmit()") Signed-off-by: Yewon Choi <[email protected]> Reviewed-by: Michal Kubiak <[email protected]> Link: https://lore.kernel.org/r/ZfQUxnNTO9AJmzwc@libra05 Signed-off-by: Paolo Abeni <[email protected]>
1 parent 9966e32 commit 1422f28

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

net/rds/send.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,12 @@ EXPORT_SYMBOL_GPL(rds_send_path_reset);
103103

104104
static int acquire_in_xmit(struct rds_conn_path *cp)
105105
{
106-
return test_and_set_bit(RDS_IN_XMIT, &cp->cp_flags) == 0;
106+
return test_and_set_bit_lock(RDS_IN_XMIT, &cp->cp_flags) == 0;
107107
}
108108

109109
static void release_in_xmit(struct rds_conn_path *cp)
110110
{
111-
clear_bit(RDS_IN_XMIT, &cp->cp_flags);
112-
smp_mb__after_atomic();
111+
clear_bit_unlock(RDS_IN_XMIT, &cp->cp_flags);
113112
/*
114113
* We don't use wait_on_bit()/wake_up_bit() because our waking is in a
115114
* hot path and finding waiters is very rare. We don't want to walk

0 commit comments

Comments
 (0)