]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
core: Disable astobj2 locking for some common objects.
authorCorey Farrell <git@cfware.com>
Tue, 2 Oct 2018 03:12:14 +0000 (23:12 -0400)
committerCorey Farrell <git@cfware.com>
Wed, 3 Oct 2018 08:24:10 +0000 (04:24 -0400)
* ACO options
* Indications
* Module loader ref_debug object
* Media index info and variants
* xmldoc items

These allocation locations were identified using reflocks.py on the
master branch.

Change-Id: Ie999b9941760be3d1946cdb6e30cb85fd97504d8

main/config_options.c
main/indications.c
main/loader.c
main/media_index.c
main/xmldoc.c

index c78f95dafe3702c1f93aec12986c848e4b739de6..f8b2be829007d6d1bc26f1486e53e6f4140befd8 100644 (file)
@@ -224,7 +224,8 @@ int aco_option_register_deprecated(struct aco_info *info, const char *name, stru
                return -1;
        }
 
-       if (!(opt = ao2_alloc(sizeof(*opt), config_option_destroy))) {
+       opt = ao2_alloc_options(sizeof(*opt), config_option_destroy, AO2_ALLOC_OPT_LOCK_NOLOCK);
+       if (!opt) {
                return -1;
        }
 
@@ -315,7 +316,9 @@ int __aco_option_register(struct aco_info *info, const char *name, enum aco_matc
                return -1;
        }
 
-       if (!(opt = ao2_alloc(sizeof(*opt) + argc * sizeof(opt->args[0]), config_option_destroy))) {
+       opt = ao2_alloc_options(sizeof(*opt) + argc * sizeof(opt->args[0]),
+               config_option_destroy, AO2_ALLOC_OPT_LOCK_NOLOCK);
+       if (!opt) {
                return -1;
        }
 
index 13e968f03c379b2381b47508509f955ba3fc0dc0..e0ba59b727bf03b660c954cd7c0f8d6e373442b9 100644 (file)
@@ -604,7 +604,9 @@ static int ast_register_indication(struct ast_tone_zone *zone, const char *indic
        }
        AST_LIST_TRAVERSE_SAFE_END;
 
-       if (!(ts = ao2_alloc(sizeof(*ts), ast_tone_zone_sound_destructor))) {
+       ts = ao2_alloc_options(sizeof(*ts), ast_tone_zone_sound_destructor,
+               AO2_ALLOC_OPT_LOCK_NOLOCK);
+       if (!ts) {
                return -1;
        }
 
index 30a983222988fa7862677fb4985149d1dc21b636..3ac0ad583008988b261a43dc63bcd9ef25534df8 100644 (file)
@@ -235,7 +235,7 @@ void ast_module_register(const struct ast_module_info *info)
 
        mod->info = info;
 #ifdef REF_DEBUG
-       mod->ref_debug = ao2_t_alloc(0, NULL, info->name);
+       mod->ref_debug = ao2_t_alloc_options(0, NULL, AO2_ALLOC_OPT_LOCK_NOLOCK, info->name);
 #endif
        AST_LIST_HEAD_INIT(&mod->users);
 
index 72bc1ccbed60fa1caedf584eee813fad4a46c577..bfaa58003cc496709ff67ea43ac18a5ecd787d34 100644 (file)
@@ -64,7 +64,8 @@ static struct media_variant *media_variant_alloc(const char *variant_str)
        size_t str_sz = strlen(variant_str) + 1;
        struct media_variant *variant;
 
-       variant = ao2_alloc(sizeof(*variant) + str_sz, media_variant_destroy);
+       variant = ao2_alloc_options(sizeof(*variant) + str_sz, media_variant_destroy,
+               AO2_ALLOC_OPT_LOCK_NOLOCK);
        if (!variant) {
                return NULL;
        }
@@ -110,8 +111,10 @@ static void media_info_destroy(void *obj)
 static struct media_info *media_info_alloc(const char *name)
 {
        size_t name_sz = strlen(name) + 1;
-       struct media_info *info = ao2_alloc(sizeof(*info) + name_sz, media_info_destroy);
+       struct media_info *info;
 
+       info = ao2_alloc_options(sizeof(*info) + name_sz, media_info_destroy,
+               AO2_ALLOC_OPT_LOCK_NOLOCK);
        if (!info) {
                return NULL;
        }
index d24245334a7c445e233b809be0600478150c1635..37b28615231c24af86274bc66e9187c3ab857285 100644 (file)
@@ -2292,7 +2292,9 @@ static struct ast_xml_doc_item *ast_xml_doc_item_alloc(const char *name, const c
 {
        struct ast_xml_doc_item *item;
 
-       if (!(item = ao2_alloc(sizeof(*item), ast_xml_doc_item_destructor))) {
+       item = ao2_alloc_options(sizeof(*item), ast_xml_doc_item_destructor,
+               AO2_ALLOC_OPT_LOCK_NOLOCK);
+       if (!item) {
                ast_log(AST_LOG_ERROR, "Failed to allocate memory for ast_xml_doc_item instance\n");
                return NULL;
        }