From: David Vossel Date: Wed, 10 Feb 2010 17:44:20 +0000 (+0000) Subject: fixes random deadlock in app_queue with use_weight during reload X-Git-Tag: 1.4.30-rc3~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47de4d52115d66dd7e28c822f468c2a875902a56;p=thirdparty%2Fasterisk.git fixes random deadlock in app_queue with use_weight during reload (closes issue #16677) Reported by: tim_ringenbach Patches: app_queue_use_weight_deadlock.diff uploaded by tim ringenbach (license 540) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@246115 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index 763f88f3a5..46fddf6150 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -2822,6 +2822,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce int callcompletedinsl; struct ao2_iterator memi; struct ast_datastore *datastore, *transfer_ds; + const int need_weight = use_weight; ast_channel_lock(qe->chan); datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL); @@ -2875,7 +2876,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce } /* Hold the lock while we setup the outgoing calls */ - if (use_weight) + + if (need_weight) AST_LIST_LOCK(&queues); ao2_lock(qe->parent); if (option_debug) @@ -2896,7 +2898,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ao2_iterator_destroy(&memi); ao2_ref(cur, -1); ao2_unlock(qe->parent); - if (use_weight) + if (need_weight) AST_LIST_UNLOCK(&queues); goto out; } @@ -2905,7 +2907,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ao2_iterator_destroy(&memi); ao2_ref(cur, -1); ao2_unlock(qe->parent); - if (use_weight) + if (need_weight) AST_LIST_UNLOCK(&queues); free(tmp); goto out; @@ -2915,7 +2917,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ao2_iterator_destroy(&memi); ao2_ref(cur, -1); ao2_unlock(qe->parent); - if (use_weight) + if (need_weight) AST_LIST_UNLOCK(&queues); free(tmp); goto out; @@ -2953,7 +2955,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ao2_iterator_destroy(&memi); ao2_ref(cur, -1); ao2_unlock(qe->parent); - if (use_weight) + if (need_weight) AST_LIST_UNLOCK(&queues); free(tmp); goto out; @@ -2994,7 +2996,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ++qe->pending; ao2_unlock(qe->parent); ring_one(qe, outgoing, &numbusies); - if (use_weight) + if (need_weight) AST_LIST_UNLOCK(&queues); lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed); /* The ast_channel_datastore_remove() function could fail here if the