Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
pacemaker.13252
pacemaker-fencing-free-dynamic-memory-at-stonit...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-fencing-free-dynamic-memory-at-stonithd-shutdown.patch of Package pacemaker.13252
commit b8745b20b966076f1218d9a3c476ec7537330122 Author: Ken Gaillot <kgaillot@redhat.com> Date: Tue Apr 10 12:25:25 2018 -0500 Low: fencing: free dynamic memory at stonithd shutdown No serious effect since it's shutting down anyway, but clean up for the sake of completeness, and making memory analysis happy Index: pacemaker-1.1.19+20180912.aa12429a4/fencing/commands.c =================================================================== --- pacemaker-1.1.19+20180912.aa12429a4.orig/fencing/commands.c +++ pacemaker-1.1.19+20180912.aa12429a4/fencing/commands.c @@ -485,7 +485,7 @@ schedule_stonith_command(async_command_t } } -void +static void free_device(gpointer data) { GListPtr gIter = NULL; @@ -514,6 +514,23 @@ free_device(gpointer data) free(device); } +void free_device_list() +{ + if (device_list != NULL) { + g_hash_table_destroy(device_list); + device_list = NULL; + } +} + +void +init_device_list() +{ + if (device_list == NULL) { + device_list = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, + free_device); + } +} + static GHashTable * build_port_aliases(const char *hostmap, GListPtr * targets) { @@ -674,16 +691,28 @@ parse_host_list(const char *hosts) GHashTable *metadata_cache = NULL; +void +free_metadata_cache() { + if (metadata_cache != NULL) { + g_hash_table_destroy(metadata_cache); + metadata_cache = NULL; + } +} + +static void +init_metadata_cache() { + if (metadata_cache == NULL) { + metadata_cache = crm_str_table_new(); + } +} + static xmlNode * get_agent_metadata(const char *agent) { xmlNode *xml = NULL; char *buffer = NULL; - if(metadata_cache == NULL) { - metadata_cache = crm_str_table_new(); - } - + init_metadata_cache(); buffer = g_hash_table_lookup(metadata_cache, agent); if(safe_str_eq(agent, STONITH_WATCHDOG_AGENT)) { return NULL; @@ -1233,7 +1262,7 @@ count_active_levels(stonith_topology_t * return count; } -void +static void free_topology_entry(gpointer data) { stonith_topology_t *tp = data; @@ -1252,6 +1281,24 @@ free_topology_entry(gpointer data) free(tp); } +void +free_topology_list() +{ + if (topology != NULL) { + g_hash_table_destroy(topology); + topology = NULL; + } +} + +void +init_topology_list() +{ + if (topology == NULL) { + topology = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, + free_topology_entry); + } +} + char *stonith_level_key(xmlNode *level, int mode) { if(mode == -1) { Index: pacemaker-1.1.19+20180912.aa12429a4/fencing/internal.h =================================================================== --- pacemaker-1.1.19+20180912.aa12429a4.orig/fencing/internal.h +++ pacemaker-1.1.19+20180912.aa12429a4/fencing/internal.h @@ -181,6 +181,12 @@ typedef struct stonith_topology_s { void free_stonith_remote_op_list(void); void init_stonith_remote_op_hash_table(GHashTable **table); +void init_device_list(void); +void free_device_list(void); +void init_topology_list(void); +void free_topology_list(void); +void free_metadata_cache(void); + long long get_stonith_flag(const char *name); void stonith_command(crm_client_t * client, uint32_t id, uint32_t flags, @@ -223,10 +229,6 @@ void *create_remote_stonith_op(const cha int stonith_fence_history(xmlNode *msg, xmlNode **output, const char *remote_peer, int options); -void free_device(gpointer data); - -void free_topology_entry(gpointer data); - void stonith_fence_history_trim(void); bool fencing_peer_active(crm_node_t *peer); Index: pacemaker-1.1.19+20180912.aa12429a4/fencing/main.c =================================================================== --- pacemaker-1.1.19+20180912.aa12429a4.orig/fencing/main.c +++ pacemaker-1.1.19+20180912.aa12429a4/fencing/main.c @@ -1,19 +1,8 @@ /* - * Copyright (C) 2009 Andrew Beekhof <andrew@beekhof.net> + * Copyright 2009-2018 Andrew Beekhof <andrew@beekhof.net> * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This source code is licensed under the GNU General Public License version 2 + * or later (GPLv2+) WITHOUT ANY WARRANTY. */ #include <crm_internal.h> @@ -560,11 +549,8 @@ fencing_topology_init() const char *xpath = "//" XML_TAG_FENCING_LEVEL; crm_trace("Full topology refresh"); - - if(topology) { - g_hash_table_destroy(topology); - topology = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, free_topology_entry); - } + free_topology_list(); + init_topology_list(); /* Grab everything */ xpathObj = xpath_search(local_cib, xpath); @@ -1186,6 +1172,9 @@ stonith_cleanup(void) crm_peer_destroy(); crm_client_cleanup(); free_stonith_remote_op_list(); + free_topology_list(); + free_device_list(); + free_metadata_cache(); free(stonith_our_uname); free_xml(local_cib); } @@ -1519,10 +1508,8 @@ main(int argc, char **argv) stonith_our_uname = strdup("localhost"); } - - device_list = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, free_device); - - topology = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, free_topology_entry); + init_device_list(); + init_topology_list(); if(stonith_watchdog_timeout_ms > 0) { xmlNode *xml; Index: pacemaker-1.1.19+20180912.aa12429a4/fencing/remote.c =================================================================== --- pacemaker-1.1.19+20180912.aa12429a4.orig/fencing/remote.c +++ pacemaker-1.1.19+20180912.aa12429a4/fencing/remote.c @@ -1,19 +1,8 @@ /* - * Copyright (C) 2009 Andrew Beekhof <andrew@beekhof.net> + * Copyright 2009-2018 Andrew Beekhof <andrew@beekhof.net> * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * This source code is licensed under the GNU General Public License version 2 + * or later (GPLv2+) WITHOUT ANY WARRANTY. */ #include <crm_internal.h>
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor