]> 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:21:56 +0000 (03:21 -0500)
* 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 41c8b222c91a10cb81c1050cfa1e6cabad70daea..2d5e09c8d000ac7f8ca3ab317c961755888f2abb 100644 (file)
@@ -222,7 +222,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;
        }
 
@@ -313,7 +314,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 55fac71a2e29d9a09bca3ca0de9dce44e67921c6..93da21c95daed9d974df22a2db2008a5e8065d94 100644 (file)
@@ -588,7 +588,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 c495d761548c69cfad2e88b70fed07a569a0d90c..eef5697575ed484cd865127db61855b8d4155a32 100644 (file)
@@ -231,7 +231,7 @@ void ast_module_register(const struct ast_module_info *info)
 
        mod->info = info;
        if (ast_opt_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);
        }
        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 b4649ac7745ac4bcda1c5adfdd64533179ae6421..43ae074d06e6942f08006b1c4c62448307705871 100644 (file)
@@ -2290,7 +2290,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;
        }