[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r325484 - in /team/irroot/dist...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 29 01:46:56 CDT 2011


Author: irroot
Date: Wed Jun 29 01:46:52 2011
New Revision: 325484

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=325484
Log:
Remove Deadlock avoidance added to chan_sip.c these measures are resolved upstream

Modified:
    team/irroot/distrotech-customers-1.8/channels/chan_sip.c
    team/irroot/distrotech-customers-1.8/res/res_timing_timerfd.c

Modified: team/irroot/distrotech-customers-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/channels/chan_sip.c?view=diff&rev=325484&r1=325483&r2=325484
==============================================================================
--- team/irroot/distrotech-customers-1.8/channels/chan_sip.c (original)
+++ team/irroot/distrotech-customers-1.8/channels/chan_sip.c Wed Jun 29 01:46:52 2011
@@ -6105,10 +6105,7 @@
 	} else
 		ast_debug(1, "Hangup call %s, SIP callid %s\n", ast->name, p->callid);
 
-	while (sip_pvt_trylock(p)) {
-		CHANNEL_DEADLOCK_AVOIDANCE(ast);
-	}
-
+	sip_pvt_lock(p);
 	if (ast_test_flag(&p->flags[0], SIP_INC_COUNT) || ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD)) {
 		if (sipdebug)
 			ast_debug(1, "update_call_counter(%s) - decrement call limit counter on hangup\n", p->username);
@@ -6334,9 +6331,7 @@
 			return 0;
 		}
 		if (p) {
-			while (sip_pvt_trylock(p)) {
-				CHANNEL_DEADLOCK_AVOIDANCE(ast);
-			}
+			sip_pvt_lock(p);
 			if (p->t38.state == T38_ENABLED) {
 				/* drop frame, can't sent VOICE frames while in T.38 mode */
 				sip_pvt_unlock(p);
@@ -6635,9 +6630,7 @@
 	struct sip_pvt *p = ast->tech_pvt;
 	int res = 0;
 
-	while (sip_pvt_trylock(p)) {
-		CHANNEL_DEADLOCK_AVOIDANCE(ast);
-	}
+	sip_pvt_lock(p);
 	switch(condition) {
 	case AST_CONTROL_RINGING:
 		if (ast->_state == AST_STATE_RING) {
@@ -7247,10 +7240,7 @@
 	struct sip_pvt *p = ast->tech_pvt;
 	int faxdetected = FALSE;
 
-	while (sip_pvt_trylock(p)) {
-		CHANNEL_DEADLOCK_AVOIDANCE(ast);
-	}
-
+	sip_pvt_lock(p);
 	fr = sip_rtp_read(ast, p, &faxdetected);
 	p->lastrtprx = time(NULL);
 
@@ -28209,10 +28199,7 @@
 		return AST_RTP_GLUE_RESULT_FORBID;
 	}
 
-	while (sip_pvt_trylock(p)) {
-		CHANNEL_DEADLOCK_AVOIDANCE(chan);
-	}
-
+	sip_pvt_lock(p);
 	if (!(p->rtp)) {
 		sip_pvt_unlock(p);
 		return AST_RTP_GLUE_RESULT_FORBID;

Modified: team/irroot/distrotech-customers-1.8/res/res_timing_timerfd.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/res/res_timing_timerfd.c?view=diff&rev=325484&r1=325483&r2=325484
==============================================================================
--- team/irroot/distrotech-customers-1.8/res/res_timing_timerfd.c (original)
+++ team/irroot/distrotech-customers-1.8/res/res_timing_timerfd.c Wed Jun 29 01:46:52 2011
@@ -162,7 +162,35 @@
 	uint64_t expirations;
 	int read_result = 0;
 
+	struct timerfd_timer *our_timer, find_helper = {
+		.handle = handle,
+	};
+
+	if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
+//		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
+		return;
+	}
+
+	if (our_timer->saved_timer.it_value.tv_nsec == 0L) {
+//		ast_log(LOG_WARNING, "Reading attempt on idle timerfd. This would have caused a deadlock.\n");
+		return;
+	}
+
 	do {
+		struct itimerspec timer_status;
+
+		if (timerfd_gettime(handle, &timer_status)) {
+//			ast_log(LOG_ERROR, "Call to timerfd_gettime() error: %s\n", strerror(errno));
+			expirations = 0;
+			break;
+		}
+
+		if ((timer_status.it_value.tv_sec == 0) && (timer_status.it_value.tv_nsec == 0)) {
+//			ast_log(LOG_ERROR, "Call to timerfd_timer_ack() with disarmed timer - break now to avoiding deadlock!\n");
+			expirations = 0;
+			break;
+		}
+
 		read_result = read(handle, &expirations, sizeof(expirations));
 		if (read_result == -1) {
 			if (errno == EINTR || errno == EAGAIN) {




More information about the asterisk-commits mailing list