diff --git a/src/plugins/select/bluegene/plugin/bg_job_place.c b/src/plugins/select/bluegene/plugin/bg_job_place.c index 08c5f86775b99da7ab130c097af93bd51bcdd44e..aab2af57a9ec6c0ffa89c735f821952d1071ca51 100644 --- a/src/plugins/select/bluegene/plugin/bg_job_place.c +++ b/src/plugins/select/bluegene/plugin/bg_job_place.c @@ -637,12 +637,23 @@ static int _check_for_booted_overlapping_blocks( * destroy the memory for * bg_record */ - List temp_list = list_create(NULL); list_remove(bg_record_itr); - list_push(temp_list, bg_record); - num_block_to_free++; - free_block_list(temp_list); - list_destroy(temp_list); + found_record = + find_and_remove_org_from_bg_list( + bg_list, bg_record); + if(!found_record) { + error("1 this record wasn't " + "found in the list!"); + rc = SLURM_ERROR; + } else { + List temp_list = + list_create(NULL); + list_push(temp_list, + found_record); + num_block_to_free++; + free_block_list(temp_list); + list_destroy(temp_list); + } } rc = 1; diff --git a/src/plugins/select/bluegene/plugin/bluegene.c b/src/plugins/select/bluegene/plugin/bluegene.c index da96c74c8dbc5aea2a5e625c818a6d1833e7e1aa..b74d9550036b9889feb325f4c2aee5d2dc0128fe 100644 --- a/src/plugins/select/bluegene/plugin/bluegene.c +++ b/src/plugins/select/bluegene/plugin/bluegene.c @@ -470,6 +470,57 @@ extern int remove_from_bg_list(List my_bg_list, bg_record_t *bg_record) return rc; } +/* This is here to remove from the orignal list when dealing with + * copies like above all locks need to be set. This function does not + * free anything you must free it when you are done */ +extern bg_record_t *find_and_remove_org_from_bg_list(List my_list, + bg_record_t *bg_record) +{ + ListIterator itr = list_iterator_create(my_list); + bg_record_t *found_record = NULL; + + while ((found_record = (bg_record_t *) list_next(itr)) != NULL) { + /* check for full node bitmap compare */ + if(bit_equal(bg_record->bitmap, found_record->bitmap) + && bit_equal(bg_record->ionode_bitmap, + found_record->ionode_bitmap)) { + + if(!strcmp(bg_record->bg_block_id, + found_record->bg_block_id)) { + list_remove(itr); + debug2("got the block"); + break; + } + } + } + list_iterator_destroy(itr); + return found_record; +} + +/* This is here to remove from the orignal list when dealing with + * copies like above all locks need to be set */ +extern bg_record_t *find_org_in_bg_list(List my_list, bg_record_t *bg_record) +{ + ListIterator itr = list_iterator_create(my_list); + bg_record_t *found_record = NULL; + + while ((found_record = (bg_record_t *) list_next(itr)) != NULL) { + /* check for full node bitmap compare */ + if(bit_equal(bg_record->bitmap, found_record->bitmap) + && bit_equal(bg_record->ionode_bitmap, + found_record->ionode_bitmap)) { + + if(!strcmp(bg_record->bg_block_id, + found_record->bg_block_id)) { + debug2("got the block"); + break; + } + } + } + list_iterator_destroy(itr); + return found_record; +} + extern int bg_free_block(bg_record_t *bg_record) { #ifdef HAVE_BG_FILES @@ -614,9 +665,6 @@ extern void *mult_destroy_block(void *args) * tool such as smap it will be in a nice order */ sort_bg_record_inc_size(bg_freeing_list); - slurm_mutex_unlock(&block_state_mutex); - - slurm_mutex_lock(&block_state_mutex); if(remove_from_bg_list(bg_job_block_list, bg_record) == SLURM_SUCCESS) { num_unused_cpus += diff --git a/src/plugins/select/bluegene/plugin/bluegene.h b/src/plugins/select/bluegene/plugin/bluegene.h index 7f39fe348e20a707f72c3901397bad235524b803..24edc01fcbacc8b4eb970d5c7feb14c3e19f7007 100644 --- a/src/plugins/select/bluegene/plugin/bluegene.h +++ b/src/plugins/select/bluegene/plugin/bluegene.h @@ -131,6 +131,9 @@ extern void *bluegene_agent(void *args); extern int bg_free_block(bg_record_t *bg_record); extern int remove_from_bg_list(List my_bg_list, bg_record_t *bg_record); +extern bg_record_t *find_and_remove_org_from_bg_list(List my_list, + bg_record_t *bg_record); +extern bg_record_t *find_org_in_bg_list(List my_list, bg_record_t *bg_record); extern void *mult_free_block(void *args); extern void *mult_destroy_block(void *args); extern int free_block_list(List delete_list); diff --git a/src/plugins/select/bluegene/plugin/dynamic_block.c b/src/plugins/select/bluegene/plugin/dynamic_block.c index d6adc1e1c1f31d14129b385d31e5248625a709e1..e2469a1008318c1c6ff883c38fba443ce79ee687 100644 --- a/src/plugins/select/bluegene/plugin/dynamic_block.c +++ b/src/plugins/select/bluegene/plugin/dynamic_block.c @@ -661,6 +661,15 @@ static int _breakup_blocks(List block_list, List new_blocks, } found_one: if(bg_record) { + List temp_list = NULL; + bg_record_t *found_record = + find_org_in_bg_list(bg_list, bg_record); + if(!found_record) { + error("this record wasn't found in the list!"); + rc = SLURM_ERROR; + goto finished; + } + bg_record = found_record; format_node_name(bg_record, tmp_char, sizeof(tmp_char)); debug2("going to split %s, %s", @@ -677,7 +686,14 @@ found_one: rc = SLURM_SUCCESS; goto finished; } - _split_block(block_list, new_blocks, bg_record, request->procs); + _split_block(block_list, new_blocks, + bg_record, request->procs); + + temp_list = list_create(NULL); + list_push(temp_list, bg_record); + num_block_to_free++; + free_block_list(temp_list); + list_destroy(temp_list); rc = SLURM_SUCCESS; goto finished; }