mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 09:07:02 +02:00
MINOR: xref: Add missing barriers.
Add a few missing barriers in the xref code, it's unlikely to be a problem for x86, but may be on architectures with weak memory ordering.
This commit is contained in:
parent
8694978892
commit
ff5dd74e25
@ -32,6 +32,7 @@ static inline struct xref *xref_get_peer_and_lock(struct xref *xref)
|
|||||||
|
|
||||||
/* Get the local pointer to the peer. */
|
/* Get the local pointer to the peer. */
|
||||||
local = HA_ATOMIC_XCHG(&xref->peer, XREF_BUSY);
|
local = HA_ATOMIC_XCHG(&xref->peer, XREF_BUSY);
|
||||||
|
__ha_barrier_store();
|
||||||
|
|
||||||
/* If the local pointer is NULL, the peer no longer exists. */
|
/* If the local pointer is NULL, the peer no longer exists. */
|
||||||
if (local == NULL) {
|
if (local == NULL) {
|
||||||
@ -53,6 +54,7 @@ static inline struct xref *xref_get_peer_and_lock(struct xref *xref)
|
|||||||
/* The remote lock is BUSY, We retry the process. */
|
/* The remote lock is BUSY, We retry the process. */
|
||||||
if (remote == XREF_BUSY) {
|
if (remote == XREF_BUSY) {
|
||||||
xref->peer = local;
|
xref->peer = local;
|
||||||
|
__ha_barrier_store();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +68,8 @@ static inline void xref_unlock(struct xref *xref, struct xref *peer)
|
|||||||
/* Release the peer. */
|
/* Release the peer. */
|
||||||
peer->peer = xref;
|
peer->peer = xref;
|
||||||
|
|
||||||
|
__ha_barrier_store();
|
||||||
|
|
||||||
/* Release myself. */
|
/* Release myself. */
|
||||||
xref->peer = peer;
|
xref->peer = peer;
|
||||||
}
|
}
|
||||||
@ -73,6 +77,7 @@ static inline void xref_unlock(struct xref *xref, struct xref *peer)
|
|||||||
static inline void xref_disconnect(struct xref *xref, struct xref *peer)
|
static inline void xref_disconnect(struct xref *xref, struct xref *peer)
|
||||||
{
|
{
|
||||||
peer->peer = NULL;
|
peer->peer = NULL;
|
||||||
|
__ha_barrier_store();
|
||||||
xref->peer = NULL;
|
xref->peer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user