From 018224e07a74ca98b912fe26d9d711666439db3d Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 19 May 2008 19:49:08 +0000 Subject: [PATCH] Patch to properly handle "scontrol reconfig" while job's are running and not corrupt memory. --- src/plugins/sched/gang/gang.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/sched/gang/gang.c b/src/plugins/sched/gang/gang.c index 967fb035daa..86ab638b195 100644 --- a/src/plugins/sched/gang/gang.c +++ b/src/plugins/sched/gang/gang.c @@ -348,6 +348,10 @@ _build_parts() { if (gs_part_list) _destroy_parts(); + /* reset the sorted list, since it's currently + * pointing to partitions we just destroyed */ + num_sorted_part = 0; + num_parts = list_count(part_list); if (!num_parts) return; @@ -646,7 +650,12 @@ _sort_partitions() for (p_ptr = gs_part_list; p_ptr; p_ptr = p_ptr->next) gs_part_sorted[i++] = p_ptr; } - + + if (size <= 1) { + gs_part_sorted[0] = gs_part_list; + return; + } + /* sort array (new array or priorities may have changed) */ for (j = 0; j < size; j++) { for (i = j+1; i < size; i++) { -- GitLab