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

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Jun 27 10:52:50 CDT 2008


On Friday 27 June 2008 09:00:28 Russell Bryant wrote:
> 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?vi
> >ew=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.

The problem is that there is a second channel that is locked when dahdi_read
is called that is not available to be unlocked without some fairly arcane
gymnastics.  Avoiding the deadlock solved the problem.

-- 
Tilghman



More information about the asterisk-dev mailing list