[Asterisk-code-review] func_lock: Fix requesters counter in error paths. (asterisk[18])
George Joseph
asteriskteam at digium.com
Fri Jun 11 10:35:07 CDT 2021
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16090 )
Change subject: func_lock: Fix requesters counter in error paths.
......................................................................
func_lock: Fix requesters counter in error paths.
In two places we bail out with failure after we've already incremented
the requesters counter, if this occured then it would effectively result
in unload to wait indefinitely, thus preventing clean shutdown.
Change-Id: I362a6c0dc424f736d4a9c733d818e72d19675283
Signed-off-by: Jaco Kroon <jaco at uls.co.za>
---
M funcs/func_lock.c
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/16090/1
diff --git a/funcs/func_lock.c b/funcs/func_lock.c
index 0726407..ad4d58e 100644
--- a/funcs/func_lock.c
+++ b/funcs/func_lock.c
@@ -268,7 +268,13 @@
if (!clframe) {
if (unloading) {
+ ast_log(LOG_ERROR,
+ "Busy unloading. %sLOCK will fail.\n",
+ trylock ? "TRY" : "");
/* Don't bother */
+ ast_mutex_lock(¤t->mutex);
+ current->requesters--;
+ ast_mutex_unlock(¤t->mutex);
AST_LIST_UNLOCK(list);
return -1;
}
@@ -277,6 +283,9 @@
ast_log(LOG_ERROR,
"Unable to allocate channel lock frame. %sLOCK will fail.\n",
trylock ? "TRY" : "");
+ ast_mutex_lock(¤t->mutex);
+ current->requesters--;
+ ast_mutex_unlock(¤t->mutex);
AST_LIST_UNLOCK(list);
return -1;
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16090
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I362a6c0dc424f736d4a9c733d818e72d19675283
Gerrit-Change-Number: 16090
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: Jaco Kroon <jaco at uls.co.za>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210611/738dba28/attachment.html>
More information about the asterisk-code-review
mailing list