diff --git a/src/common/macros.h b/src/common/macros.h index 988272604cde4935d0fbcb8a5d70cc87a94be4aa..c079120cb292e2e19aef68fcb8ac2f2477fa1fe1 100644 --- a/src/common/macros.h +++ b/src/common/macros.h @@ -151,6 +151,22 @@ typedef enum {false, true} bool; # endif #endif +#ifdef HAVE_BGL_FILES +/* We can't free the data on single base partition system without wires, + * It could also be a problem with old drivers (fails with driver 410). + * Once this is fixed, just call rm_free_BGL() directly. The bgl pointer + * should also be made into a non-static variable. Tests before calls + * to rm_get_BGL should be removed. */ +# define slurm_rm_free_BGL(bgl) \ + _STMT_START { \ + int i; \ + if ((rm_get_data(bgl, RM_SwitchNum, &i) == STATUS_OK) && (i > 0)) { \ + if (rm_free_BGL(bgl) == STATUS_OK) bgl = NULL; \ + } \ + } _STMT_END + +#endif + #ifdef WITH_PTHREADS # define slurm_mutex_init(mutex) \ diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index 19d7e8cf2499b52a1c255425f1771af35a5a8d3d..f99717e97473bd02856cabf14e19f2dc668facaf 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -635,7 +635,7 @@ static void _read_part_db2(void) /* Add node name to existing BGL partition record */ hostlist_push(block_ptr->hostlist, bgl_node); } -#ifdef _DEBUG +#if _DEBUG fprintf(stderr, "part=%s, node=%s conn=%s mode=%s\n", part_id, bgl_node, _convert_conn_type(block_ptr->bgl_conn_type), @@ -646,20 +646,7 @@ static void _read_part_db2(void) /* perform post-processing for each bluegene partition */ list_for_each(block_list, _post_block_read, NULL); - /* We can't free the data on single base partition system - * without wires, could also be a problem with old drivers. - * this fails with driver level 410. */ - if ((rc = rm_get_data(bgl, RM_SwitchNum, &i)) != STATUS_OK) { - fprintf(stderr, "rm_get_data(RM_SwitchNum): %s\n", - bgl_err_str(rc)); - return; - } - if (i == 0) - return; - if ((rc = rm_free_BGL(bgl)) != STATUS_OK) - fprintf(stderr, "rm_free_BGL(): %s\n", bgl_err_str(rc)); - else - bgl = NULL; + slurm_rm_free_BGL(bgl); #endif }