From b6d75617a62ea72343fe685000fcd866f19b8e16 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 8 Jul 2004 23:45:44 +0000
Subject: [PATCH] Correct handling of shared node flags by partition and job. A
 partition with "Shared=yes" configuration failed to function as desired.
 (gnats:459).

---
 src/slurmctld/node_scheduler.c | 1 +
 src/slurmctld/read_config.c    | 5 +++--
 src/slurmctld/slurmctld.h      | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/slurmctld/node_scheduler.c b/src/slurmctld/node_scheduler.c
index 8d1afe4866c..91aeaf65325 100644
--- a/src/slurmctld/node_scheduler.c
+++ b/src/slurmctld/node_scheduler.c
@@ -950,6 +950,7 @@ int select_nodes(struct job_record *job_ptr, bool test_only)
 	/* assign the nodes and stage_in the job */
 	job_ptr->nodes = bitmap2node_name(req_bitmap);
 	job_ptr->node_bitmap = req_bitmap;
+	job_ptr->details->shared = shared;
 	allocate_nodes(job_ptr);
 	build_node_details(job_ptr);
 	req_bitmap = NULL;
diff --git a/src/slurmctld/read_config.c b/src/slurmctld/read_config.c
index 24b2da12711..e6712281fb8 100644
--- a/src/slurmctld/read_config.c
+++ b/src/slurmctld/read_config.c
@@ -117,8 +117,6 @@ static int _build_bitmaps(void)
 	    (avail_node_bitmap    == NULL) ||
 	    (share_node_bitmap    == NULL)) 
 		fatal ("bit_alloc malloc failure");
-	/* Set all bits, all nodes initially available for sharing */
-	bit_nset(share_node_bitmap, 0, (node_record_count-1));
 
 	/* initialize the configuration bitmaps */
 	config_iterator = list_iterator_create(config_list);
@@ -135,6 +133,9 @@ static int _build_bitmaps(void)
 	}
 	list_iterator_destroy(config_iterator);
 
+	/* Set all bits, all nodes initially available for sharing */
+	bit_nset(share_node_bitmap, 0, (node_record_count-1));
+
 	/* identify all nodes non-sharable due to non-sharing jobs */
 	job_iterator = list_iterator_create(job_list);
 	while ((job_ptr = (struct job_record *) list_next(job_iterator))) {
diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h
index 7a6d2de1eee..f94d6fe280c 100644
--- a/src/slurmctld/slurmctld.h
+++ b/src/slurmctld/slurmctld.h
@@ -3,7 +3,7 @@
  *****************************************************************************
  *  Copyright (C) 2002 The Regents of the University of California.
  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
- *  Written by Moe Jette <jette@llnl.gov> et. al.
+ *  Written by Morris Jette <jette@llnl.gov> et. al.
  *  UCRL-CODE-2002-040.
  *  
  *  This file is part of SLURM, a resource management program.
@@ -180,7 +180,7 @@ extern int node_record_count;		/* count in node_record_table_ptr */
 extern bitstr_t *avail_node_bitmap;	/* bitmap of available nodes, 
 					 * not DOWN, DRAINED or DRAINING */
 extern bitstr_t *idle_node_bitmap;	/* bitmap of idle nodes */
-extern bitstr_t *share_node_bitmap;	/* bitmap of non-sharable nodes */
+extern bitstr_t *share_node_bitmap;	/* bitmap of sharable nodes */
 extern struct config_record default_config_record;
 extern struct node_record default_node_record;
 
-- 
GitLab