From fb604c7efd3b5696c19eb89f55a51d8cf166f8b1 Mon Sep 17 00:00:00 2001
From: Brian Christiansen <brian@schedmd.com>
Date: Thu, 14 Jan 2016 16:23:29 -0800
Subject: [PATCH] Fix nodes from being overallocated when allocation straddles
 multiple nodes.

Bug 2343
---
 NEWS                     | 1 +
 src/slurmctld/step_mgr.c | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 1b75715276a..f039aa7715d 100644
--- a/NEWS
+++ b/NEWS
@@ -67,6 +67,7 @@ documents those changes that are of interest to users and administrators.
     limit, rather than reserve resources for it when the next job ends, don't
     reserve any resources for it.
  -- Avoid slurmstepd abort if malloc fails during accounting gather operation.
+ -- Fix nodes from being overallocated when allocation straddles multiple nodes.
 
 * Changes in Slurm 15.08.6
 ==========================
diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c
index a656c205f5c..f8770f527d9 100644
--- a/src/slurmctld/step_mgr.c
+++ b/src/slurmctld/step_mgr.c
@@ -2629,8 +2629,10 @@ extern slurm_step_layout_t *step_layout_create(struct step_record *step_ptr,
 			if ((job_resrcs_ptr->whole_node != 1)
 			    && (slurmctld_conf.select_type_param
 				& (CR_CORE | CR_SOCKET))
-			    && (job_ptr->details->cpu_bind_type
-				& CPU_BIND_ONE_THREAD_PER_CORE)) {
+			    && ((job_ptr->details->cpu_bind_type !=
+				 (uint16_t)NO_VAL)
+				&& (job_ptr->details->cpu_bind_type
+				    & CPU_BIND_ONE_THREAD_PER_CORE))) {
 				uint16_t threads;
 				if (slurmctld_conf.fast_schedule)
 					threads = node_ptr->config_ptr->threads;
-- 
GitLab