<p>Jaco Kroon has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15944">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">func_lock: Fix requesters counter in error paths.<br><br>In two places we bail out with failure after we've already incremented<br>the requesters counter, if this occured then it would effectively result<br>in unload to wait indefinitely, thus preventing clean shutdown.<br><br>Change-Id: I362a6c0dc424f736d4a9c733d818e72d19675283<br>Signed-off-by: Jaco Kroon <jaco@uls.co.za><br>---<br>M funcs/func_lock.c<br>1 file changed, 9 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/44/15944/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/funcs/func_lock.c b/funcs/func_lock.c</span><br><span>index 0726407..ad4d58e 100644</span><br><span>--- a/funcs/func_lock.c</span><br><span>+++ b/funcs/func_lock.c</span><br><span>@@ -268,7 +268,13 @@</span><br><span> </span><br><span>  if (!clframe) {</span><br><span>              if (unloading) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_log(LOG_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+                            "Busy unloading.  %sLOCK will fail.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                             trylock ? "TRY" : "");</span><br><span>                   /* Don't bother */</span><br><span style="color: hsl(120, 100%, 40%);">+                        ast_mutex_lock(&current->mutex);</span><br><span style="color: hsl(120, 100%, 40%);">+                       current->requesters--;</span><br><span style="color: hsl(120, 100%, 40%);">+                     ast_mutex_unlock(&current->mutex);</span><br><span>                    AST_LIST_UNLOCK(list);</span><br><span>                       return -1;</span><br><span>           }</span><br><span>@@ -277,6 +283,9 @@</span><br><span>                      ast_log(LOG_ERROR,</span><br><span>                           "Unable to allocate channel lock frame.  %sLOCK will fail.\n",</span><br><span>                             trylock ? "TRY" : "");</span><br><span style="color: hsl(120, 100%, 40%);">+                    ast_mutex_lock(&current->mutex);</span><br><span style="color: hsl(120, 100%, 40%);">+                       current->requesters--;</span><br><span style="color: hsl(120, 100%, 40%);">+                     ast_mutex_unlock(&current->mutex);</span><br><span>                    AST_LIST_UNLOCK(list);</span><br><span>                       return -1;</span><br><span>           }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15944">change 15944</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15944"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I362a6c0dc424f736d4a9c733d818e72d19675283 </div>
<div style="display:none"> Gerrit-Change-Number: 15944 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Jaco Kroon <jaco@uls.co.za> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>