Skip to content
Snippets Groups Projects
Commit 897c4b27 authored by Bill Brophy's avatar Bill Brophy Committed by Tim Wickberg
Browse files

Fix route/topology plugin to prevent segfault in sbcast.

route_p_split_hostlist was not thread-safe, and would cause
one of several segfaults depending on where in the initialization
code each thread was.

Bug 2495.
parent 14c51e65
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ documents those changes that are of interest to users and administrators.
-- Fix issue where steps weren't always getting the gres/tres involved.
-- Fixed double read lock on getting job's gres/tres.
-- Fix display for RoutePlugin parameter to display the correct value.
-- Fix route/topology plugin to prevent segfault in sbcast when in use.
* Changes in Slurm 15.08.8
==========================
......
......@@ -302,7 +302,8 @@ extern int route_init(char *node_name)
debug_flags = slurm_get_debug_flags();
init_run = true;
_set_collectors(node_name);
if (node_name)
_set_collectors(node_name);
done:
slurm_mutex_unlock(&g_context_lock);
......
......@@ -96,6 +96,7 @@ const uint32_t plugin_version = SLURM_VERSION_NUMBER;
/* Global data */
static uint64_t debug_flags = 0;
static pthread_mutex_t route_lock = PTHREAD_MUTEX_INITIALIZER;
/*****************************************************************************\
* Functions required of all plugins
......@@ -152,6 +153,7 @@ extern int route_p_split_hostlist(hostlist_t hl,
bitstr_t *fwd_bitmap = NULL; /* nodes in forward list */
msg_count = hostlist_count(hl);
slurm_mutex_lock(&route_lock);
if (switch_record_cnt == 0) {
/* configs have not already been processed */
slurm_conf_init(NULL);
......@@ -167,6 +169,7 @@ extern int route_p_split_hostlist(hostlist_t hl,
fatal("ROUTE: Failed to build topology config");
}
}
slurm_mutex_unlock(&route_lock);
*sp_hl = (hostlist_t*) xmalloc(switch_record_cnt * sizeof(hostlist_t));
/* create bitmap of nodes to send message too */
if (hostlist2bitmap (hl, false, &nodes_bitmap) != SLURM_SUCCESS) {
......
......@@ -60,6 +60,7 @@
#include "src/common/slurm_cred.h"
#include "src/common/slurm_protocol_api.h"
#include "src/common/slurm_protocol_interface.h"
#include "src/common/slurm_route.h"
#include "src/common/slurm_time.h"
#include "src/common/uid.h"
#include "src/common/xmalloc.h"
......@@ -83,6 +84,7 @@ int main(int argc, char *argv[])
return 1;
#endif
slurm_conf_init(NULL);
route_init(NULL);
parse_command_line(argc, argv);
if (params.verbose) {
opts.stderr_level += params.verbose;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment