[Asterisk-code-review] func_lock: fix multiple-channel-grant problems. (asterisk[master])

Jaco Kroon asteriskteam at digium.com
Fri Dec 18 13:13:34 CST 2020


Attention is currently required from: Jaco Kroon.
Hello Friendly Automation, 

I'd like you to reexamine a change. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/15227

to look at the new patch set (#2).

Change subject: func_lock: fix multiple-channel-grant problems.
......................................................................

func_lock: fix multiple-channel-grant problems.

Under contention it becomes possible that multiple channels will be told
they successfully obtained the lock, which is a bug.  Please refer

ASTERISK-29217

This introduces a couple of changes.

1.  Replaces requesters ao2 container with simple counter (we don't
    really care who is waiting for the lock, only how many).  This is
    updated undex ->mutex to prevent memory access races.
2.  Correct semantics for ast_cond_timedwait() as described in
    pthread_cond_broadcast(3P) is used (multiple threads can be released
    on a single _signal()).
3.  Module unload races are taken care of and memory properly cleaned
    up.

Change-Id: I6f68b5ec82ff25b2909daf6e4d19ca864a463e29
Signed-off-by: Jaco Kroon <jaco at uls.co.za>
---
M funcs/func_lock.c
1 file changed, 59 insertions(+), 110 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/27/15227/2
-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15227
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I6f68b5ec82ff25b2909daf6e4d19ca864a463e29
Gerrit-Change-Number: 15227
Gerrit-PatchSet: 2
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-Reviewer: Friendly Automation
Gerrit-Attention: Jaco Kroon <jaco at uls.co.za>
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201218/55162650/attachment.html>


More information about the asterisk-code-review mailing list