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

Jaco Kroon asteriskteam at digium.com
Mon Dec 21 08:47:11 CST 2020


Attention is currently required from: Sean Bright.
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 (#4).

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, 58 insertions(+), 109 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/27/15227/4
-- 
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: 4
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-Reviewer: Friendly Automation
Gerrit-CC: Joshua Colp <jcolp at sangoma.com>
Gerrit-CC: Sean Bright <sean.bright at gmail.com>
Gerrit-Attention: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201221/14888f28/attachment.html>


More information about the asterisk-code-review mailing list