[sr-dev] git:master: tm: AS added needed membar

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Jul 20 10:28:00 CEST 2009


Module: sip-router
Branch: master
Commit: f0ab0db3b66fcc7912065ee960aff71615e9ce3e
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f0ab0db3b66fcc7912065ee960aff71615e9ce3e

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Mon Jul 20 10:16:10 2009 +0200

tm: AS added needed membar

When compiled with -DWITH_AS_SUPPORT build_local_ack() needed
a membar_write_atomic_op() before setting the new local ack retr.
buf pointer (this will force the local_ack content to be fully
written before replacing the pointer and it's need on some non-x86
archs.).

---

 modules/tm/t_reply.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index ba06cd1..ea5db73 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -414,6 +414,10 @@ static char *build_local_ack(struct sip_msg* rpl, struct cell *trans,
 	}
 
 	/* set the new buffer, but only if not already set (concurrent 2xx) */
+	/* a memory write barrier is needed to make sure the local_ack
+	   content is fully written, before we try to add it to the transaction
+	   -- andrei */
+	membar_write_atomic_op();
 	if ((old_lack = (struct retr_buf *)atomic_cmpxchg_long(
 			(void *)&trans->uac[0].local_ack, 0, (long)local_ack))) {
 		/* buffer already set: trash current and use the winning one */




More information about the sr-dev mailing list