[svn-commits] dlee: branch dlee/ASTERISK-22455-deadlock r398420 - /team/dlee/ASTERISK-22455...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 5 12:32:45 CDT 2013


Author: dlee
Date: Thu Sep  5 12:32:43 2013
New Revision: 398420

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398420
Log:
Address review feedback.
* Error if waiting on an unlocked mutex
* Fill in backtrace when coming out of a wait

Modified:
    team/dlee/ASTERISK-22455-deadlock/main/lock.c

Modified: team/dlee/ASTERISK-22455-deadlock/main/lock.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22455-deadlock/main/lock.c?view=diff&rev=398420&r1=398419&r2=398420
==============================================================================
--- team/dlee/ASTERISK-22455-deadlock/main/lock.c (original)
+++ team/dlee/ASTERISK-22455-deadlock/main/lock.c Thu Sep  5 12:32:43 2013
@@ -548,6 +548,10 @@
 			__dump_backtrace(&lt->backtrace[ROFFSET], canlog);
 #endif
 			DO_THREAD_CRASH;
+		} else if (lt->reentrancy <= 0) {
+			__ast_mutex_logger("%s line %d (%s): attempted to wait on an unlocked mutex '%s'\n",
+					   filename, lineno, func, mutex_name);
+			DO_THREAD_CRASH;
 		}
 
 		/* Waiting on a condition completely suspends a recursive mutex,
@@ -583,6 +587,7 @@
 		ast_reentrancy_unlock(lt);
 
 #ifdef HAVE_BKTR
+		bt = &lt->backtrace[ROFFSET];
 		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
 #else
 		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);
@@ -636,6 +641,10 @@
 			__dump_backtrace(&lt->backtrace[ROFFSET], canlog);
 #endif
 			DO_THREAD_CRASH;
+		} else if (lt->reentrancy <= 0) {
+			__ast_mutex_logger("%s line %d (%s): attempted to wait on an unlocked mutex '%s'\n",
+					   filename, lineno, func, mutex_name);
+			DO_THREAD_CRASH;
 		}
 
 		/* Waiting on a condition completely suspends a recursive mutex,
@@ -671,6 +680,7 @@
 		ast_reentrancy_unlock(lt);
 
 #ifdef HAVE_BKTR
+		bt = &lt->backtrace[ROFFSET];
 		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
 #else
 		ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t);




More information about the svn-commits mailing list