From b9fe681539dc6d56ce8bbcaa9245fa7d83bb00a5 Mon Sep 17 00:00:00 2001
From: jette <jette@schedmd.com>
Date: Sat, 7 Dec 2013 19:33:54 -0800
Subject: [PATCH] Fix for dynamic changes to GRES

If the GRES is associated with specific files AND
the GRES count is reset using scontrol AND
the slurmd is restarted either without a gres.conf file or with a count and no specific files AND
the GRES count is then increased using scontrol the GRES bitmap will not match its count

This fixes the root cause of the mismatch between bitmap size and GRES
count and should render the rebuilding of the bitmap unnecessary.
The rebuilding was handled in the following commits
commit ec4df3bfb6430b14a0b43db74f204280c7c2e726
commit 1712d6192098b4bbd1fc6d76605d93789afb7b52
---
 src/common/gres.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/common/gres.c b/src/common/gres.c
index afa2a3c77cf..5eae82798f3 100644
--- a/src/common/gres.c
+++ b/src/common/gres.c
@@ -977,7 +977,8 @@ extern int gres_plugin_node_config_unpack(Buf buffer, char* node_name)
 				      tmp_name, count, node_name);
 				count = 1024;
 			}
-			gres_context[j].has_file = has_file;
+			if (has_file)	/* Don't clear if already set */
+				gres_context[j].has_file = has_file;
 			break;
  		}
 		if (j >= gres_context_cnt) {
@@ -1397,7 +1398,7 @@ extern int _node_config_validate(char *node_name, char *orig_config,
 	else if (gres_data->gres_cnt_avail == NO_VAL)
 		gres_data->gres_cnt_avail = 0;
 
-	if (context_ptr->has_file) {
+	if (context_ptr->has_file || gres_data->gres_cnt_avail) {
 		if (gres_data->gres_bit_alloc == NULL) {
 			gres_data->gres_bit_alloc =
 				bit_alloc(gres_data->gres_cnt_avail);
@@ -1524,7 +1525,7 @@ static int _node_reconfig(char *node_name, char *orig_config, char **new_config,
 	else if (gres_data->gres_cnt_avail == NO_VAL)
 		gres_data->gres_cnt_avail = 0;
 
-	if (context_ptr->has_file) {
+	if (context_ptr->has_file || gres_data->gres_cnt_avail) {
 		if (gres_data->gres_bit_alloc == NULL) {
 			gres_data->gres_bit_alloc =
 				bit_alloc(gres_data->gres_cnt_avail);
-- 
GitLab