[asterisk-dev] [svn-commits] tilghman: branch 1.4 r124965 - /branches/1.4/channels/chan_dahdi.c

Russell Bryant russell at digium.com
Fri Jun 27 09:00:28 CDT 2008


On Jun 24, 2008, at 8:46 PM, SVN commits to the Digium repositories  
wrote:

> Author: tilghman
> Date: Tue Jun 24 19:46:24 2008
> New Revision: 124965
>
> URL: http://svn.digium.com/view/asterisk?view=rev&rev=124965
> Log:
> Pvt deadlock causes some channels to get stuck in Reserved status.
> (closes issue #12621)
> Reported by: fabianoheringer
> Patches:
>       20080612__bug12621.diff.txt uploaded by Corydon76 (license 14)
> Tested by: fabianoheringer
>
> Modified:
>    branches/1.4/channels/chan_dahdi.c
>
> Modified: branches/1.4/channels/chan_dahdi.c
> URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_dahdi.c?view=diff&rev=124965&r1=124964&r2=124965
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- branches/1.4/channels/chan_dahdi.c (original)
> +++ branches/1.4/channels/chan_dahdi.c Tue Jun 24 19:46:24 2008
> @@ -4637,10 +4637,11 @@
> 	int index;
> 	void *readbuf;
> 	struct ast_frame *f;
> -	
> -
> -	ast_mutex_lock(&p->lock);
> -	
> +
> +	while (ast_mutex_trylock(&p->lock)) {
> +		DEADLOCK_AVOIDANCE(&ast->lock);
> +	}
> +

This change is incorrect and should be reverted.

One of the fundamental and absolutely critical locking rules in  
Asterisk is "thou must lock the ast_channel before the channel pvt".   
So, directly locking the pvt here is the correct thing to do.

--
Russell Bryant
Senior Software Engineer
Open Source Team Lead
Digium, Inc.







More information about the asterisk-dev mailing list