[asterisk-commits] tilghman: branch 1.8 r280984 - in /branches/1.8: ./ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 5 02:46:41 CDT 2010


Author: tilghman
Date: Thu Aug  5 02:46:36 2010
New Revision: 280984

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=280984
Log:
Merged revisions 280983 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
  r280983 | tilghman | 2010-08-05 02:40:47 -0500 (Thu, 05 Aug 2010) | 15 lines
  
  Merged revisions 280982 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r280982 | tilghman | 2010-08-05 02:28:33 -0500 (Thu, 05 Aug 2010) | 8 lines
    
    Change context lock back to a mutex, because functionality depends upon the lock being recursive.
    
    (closes issue #17643)
     Reported by: zerohalo
     Patches: 
           20100726__issue17643.diff.txt uploaded by tilghman (license 14)
     Tested by: zerohalo
  ........
................

Modified:
    branches/1.8/   (props changed)
    branches/1.8/include/asterisk/pbx.h
    branches/1.8/main/pbx.c

Propchange: branches/1.8/
------------------------------------------------------------------------------
--- branch-1.6.2-merged (original)
+++ branch-1.6.2-merged Thu Aug  5 02:46:36 2010
@@ -1,1 +1,1 @@
-/branches/1.6.2:1-279056,279207,279501,279561,279597,279609,279657,279784,279849,279946,280089,280160,280193,280229,280231,280306,280345,280449,280551,280671,280739
+/branches/1.6.2:1-279056,279207,279501,279561,279597,279609,279657,279784,279849,279946,280089,280160,280193,280229,280231,280306,280345,280449,280551,280671,280739,280983

Modified: branches/1.8/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/include/asterisk/pbx.h?view=diff&rev=280984&r1=280983&r2=280984
==============================================================================
--- branches/1.8/include/asterisk/pbx.h (original)
+++ branches/1.8/include/asterisk/pbx.h Thu Aug  5 02:46:36 2010
@@ -1220,14 +1220,6 @@
 									 const char *context, const char *exten, int priority,
 									 const char *label, const char *callerid, enum ext_match_t action);
 
-
-/* every time a write lock is obtained for contexts,
-   a counter is incremented. You can check this via the
-   following func */
-
-int ast_wrlock_contexts_version(void);
-
-
 /*! \brief hashtable functions for contexts */
 /*! @{ */
 int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b);

Modified: branches/1.8/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/pbx.c?view=diff&rev=280984&r1=280983&r2=280984
==============================================================================
--- branches/1.8/main/pbx.c (original)
+++ branches/1.8/main/pbx.c Thu Aug  5 02:46:36 2010
@@ -1164,7 +1164,11 @@
 static struct ast_context *contexts;
 static struct ast_hashtab *contexts_table = NULL;
 
-AST_RWLOCK_DEFINE_STATIC(conlock);		/*!< Lock for the ast_context list */
+/*!\brief Lock for the ast_context list
+ * This lock MUST be recursive, or a deadlock on reload may result.  See
+ * https://issues.asterisk.org/view.php?id=17643
+ */
+AST_MUTEX_DEFINE_STATIC(conlock);
 
 static AST_RWLIST_HEAD_STATIC(apps, ast_app);
 
@@ -7016,7 +7020,6 @@
 	*/
 
 	struct timeval begintime, writelocktime, endlocktime, enddeltime;
-	int wrlock_ver;
 
 	begintime = ast_tvnow();
 	ast_rdlock_contexts();
@@ -7025,15 +7028,6 @@
 		context_merge(extcontexts, exttable, tmp, registrar);
 	}
 	ast_hashtab_end_traversal(iter);
-	wrlock_ver = ast_wrlock_contexts_version();
-
-	ast_unlock_contexts(); /* this feels real retarded, but you must do
-							  what you must do If this isn't done, the following 
-						      wrlock is a guraranteed deadlock */
-	ast_wrlock_contexts();
-	if (ast_wrlock_contexts_version() > wrlock_ver+1) {
-		ast_log(LOG_WARNING,"==================!!!!!!!!!!!!!!!Something changed the contexts in the middle of merging contexts!\n");
-	}
 
 	AST_RWLIST_WRLOCK(&hints);
 	writelocktime = ast_tvnow();
@@ -9836,32 +9830,23 @@
 
 	return 0;
 }
-static int conlock_wrlock_version = 0;
-
-int ast_wrlock_contexts_version(void)
-{
-	return conlock_wrlock_version;
-}
 
 /*
  * Lock context list functions ...
  */
 int ast_wrlock_contexts()
 {
-	int res = ast_rwlock_wrlock(&conlock);
-	if (!res)
-		ast_atomic_fetchadd_int(&conlock_wrlock_version, 1);
-	return res;
+	return ast_mutex_lock(&conlock);
 }
 
 int ast_rdlock_contexts()
 {
-	return ast_rwlock_rdlock(&conlock);
+	return ast_mutex_lock(&conlock);
 }
 
 int ast_unlock_contexts()
 {
-	return ast_rwlock_unlock(&conlock);
+	return ast_mutex_unlock(&conlock);
 }
 
 /*




More information about the asterisk-commits mailing list