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.
/* Get the local pointer to the peer. */
local = HA_ATOMIC_XCHG(&xref->peer, XREF_BUSY);
+ __ha_barrier_store();
/* If the local pointer is NULL, the peer no longer exists. */
if (local == NULL) {
/* The remote lock is BUSY, We retry the process. */
if (remote == XREF_BUSY) {
xref->peer = local;
+ __ha_barrier_store();
continue;
}
/* Release the peer. */
peer->peer = xref;
+ __ha_barrier_store();
+
/* Release myself. */
xref->peer = peer;
}
static inline void xref_disconnect(struct xref *xref, struct xref *peer)
{
peer->peer = NULL;
+ __ha_barrier_store();
xref->peer = NULL;
}