[sr-dev] git:5.2:b5264c56: tm: removed async mutex define option

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 7 10:48:38 CEST 2019


Module: kamailio
Branch: 5.2
Commit: b5264c56d0fe55622e7f2451d5fbdec1eb05865f
URL: https://github.com/kamailio/kamailio/commit/b5264c56d0fe55622e7f2451d5fbdec1eb05865f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-10-07T10:40:37+02:00

tm: removed async mutex define option

- it was disbaled due to conflict with reply processing, the reply mutex
being used, t_continue() has same processing like a failure handling

(cherry picked from commit de11e2850314b12320cf8fed29f709a38a986709)

---

Modified: src/modules/tm/h_table.c
Modified: src/modules/tm/h_table.h
Modified: src/modules/tm/lock.c
Modified: src/modules/tm/lock.h
Modified: src/modules/tm/t_suspend.c

---

Diff:  https://github.com/kamailio/kamailio/commit/b5264c56d0fe55622e7f2451d5fbdec1eb05865f.diff
Patch: https://github.com/kamailio/kamailio/commit/b5264c56d0fe55622e7f2451d5fbdec1eb05865f.patch

---

diff --git a/src/modules/tm/h_table.c b/src/modules/tm/h_table.c
index baebd82914..88cadb386f 100644
--- a/src/modules/tm/h_table.c
+++ b/src/modules/tm/h_table.c
@@ -407,7 +407,6 @@ struct cell *build_cell(struct sip_msg *p_msg)
 
 	init_synonym_id(p_msg, new_cell->md5);
 	init_cell_lock(new_cell);
-	init_async_lock(new_cell);
 	t_stats_created();
 	return new_cell;
 
diff --git a/src/modules/tm/h_table.h b/src/modules/tm/h_table.h
index 2a1e76160e..ba3c7b702e 100644
--- a/src/modules/tm/h_table.h
+++ b/src/modules/tm/h_table.h
@@ -446,11 +446,6 @@ typedef struct cell
 	/* recursive reply lock count */
 	int reply_rec_lock_level;
 
-#ifdef ENABLE_ASYNC_MUTEX
-	/* protect against concurrent async continues */
-	ser_lock_t async_mutex;
-#endif
-
 	ticks_t fr_timeout;		/* final response interval for retr_bufs */
 	ticks_t fr_inv_timeout; /* final inv. response interval for retr_bufs */
 #ifdef TM_DIFF_RT_TIMEOUT
diff --git a/src/modules/tm/lock.c b/src/modules/tm/lock.c
index eb2e1a5bf0..8ea3e844a4 100644
--- a/src/modules/tm/lock.c
+++ b/src/modules/tm/lock.c
@@ -53,9 +53,6 @@
 static int sem_nr;
 gen_lock_set_t *entry_semaphore = 0;
 gen_lock_set_t *reply_semaphore = 0;
-#ifdef ENABLE_ASYNC_MUTEX
-gen_lock_set_t *async_semaphore = 0;
-#endif
 #endif
 
 
@@ -85,12 +82,6 @@ int lock_initialize()
 			lock_set_destroy(reply_semaphore);
 			lock_set_dealloc(reply_semaphore);
 		}
-#ifdef ENABLE_ASYNC_MUTEX
-		if(async_semaphore != 0) {
-			lock_set_destroy(async_semaphore);
-			lock_set_dealloc(async_semaphore);
-		}
-#endif
 		if(i == 0) {
 			LOG(L_CRIT, "lock_initialize: could not allocate semaphore"
 						" sets\n");
@@ -142,20 +133,6 @@ int lock_initialize()
 		i--;
 		goto again;
 	}
-#ifdef ENABLE_ASYNC_MUTEX
-	i++;
-	if(((async_semaphore = lock_set_alloc(i)) == 0)
-			|| (lock_set_init(async_semaphore) == 0)) {
-		if(async_semaphore) {
-			lock_set_dealloc(async_semaphore);
-			async_semaphore = 0;
-		}
-		LM_DBG("async semaphore initialization failure: %s\n", strerror(errno));
-		probe_run = 1;
-		i--;
-		goto again;
-	}
-#endif
 
 	/* return success */
 	LM_INFO("semaphore arrays of size %d allocated\n", sem_nr);
@@ -195,13 +172,6 @@ void lock_cleanup()
 		lock_set_destroy(reply_semaphore);
 		lock_set_dealloc(reply_semaphore);
 	};
-#ifdef ENABLE_ASYNC_MUTEX
-	if(async_semaphore != 0) {
-		lock_set_destroy(async_semaphore);
-		lock_set_dealloc(async_semaphore);
-	}
-	async_semaphore = 0;
-#endif
 	entry_semaphore = reply_semaphore = 0;
 }
 #endif /*GEN_LOCK_T_PREFERED*/
@@ -235,22 +205,6 @@ int init_entry_lock(struct s_table *ht, struct entry *entry)
 	return 0;
 }
 
-int init_async_lock(struct cell *cell)
-{
-#ifdef ENABLE_ASYNC_MUTEX
-
-#ifdef GEN_LOCK_T_PREFERED
-	lock_init(&cell->async_mutex);
-#else
-	cell->async_mutex.semaphore_set = async_semaphore;
-	cell->async_mutex.semaphore_index = cell->hash_index % sem_nr;
-#endif /* GEN_LOCK_T_PREFERED */
-
-#endif /* ENABLE_ASYNC_MUTEX */
-
-	return 0;
-}
-
 int release_cell_lock(struct cell *cell)
 {
 #ifndef GEN_LOCK_T_PREFERED
diff --git a/src/modules/tm/lock.h b/src/modules/tm/lock.h
index d2c17b712f..e115c03fe4 100644
--- a/src/modules/tm/lock.h
+++ b/src/modules/tm/lock.h
@@ -58,7 +58,6 @@ void lock_cleanup(void);
 
 int init_cell_lock(struct cell *cell);
 int init_entry_lock(struct s_table *ht, struct entry *entry);
-int init_async_lock(struct cell *cell);
 
 
 int release_cell_lock(struct cell *cell);
diff --git a/src/modules/tm/t_suspend.c b/src/modules/tm/t_suspend.c
index c37957daba..c2c0773b3f 100644
--- a/src/modules/tm/t_suspend.c
+++ b/src/modules/tm/t_suspend.c
@@ -41,13 +41,8 @@
 #include "../../core/data_lump_rpl.h"
 
 
-#ifdef ENABLE_ASYNC_MUTEX
-#define LOCK_ASYNC_CONTINUE(_t) lock(&(_t)->async_mutex )
-#define UNLOCK_ASYNC_CONTINUE(_t) unlock(&(_t)->async_mutex )
-#else
 #define LOCK_ASYNC_CONTINUE(_t) LOCK_REPLIES(_t)
 #define UNLOCK_ASYNC_CONTINUE(_t) UNLOCK_REPLIES(_t)
-#endif
 
 /* Suspends the transaction for later use.
  * Save the returned hash_index and label to get




More information about the sr-dev mailing list