From 076472fde999beb98d85a88f2104c9e9e3bb2efb Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 22 Jun 2004 00:29:46 +0000
Subject: [PATCH] Fix bug in update of node state to DRAINING/DRAINED when
 update request occurs prior to initial node registration. Node that should
 have been DRAINED was being set to state DRAINING.

---
 NEWS                     | 2 ++
 src/slurmctld/node_mgr.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 9c4ae893efe..72e540b437e 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ documents those changes that are of interest to users and admins.
     distributing large rlimit to jobs.
  -- Add support for slurm_spawn() and associated APIs (needed for IBM 
     SP systems).
+ -- Fix bug in update of node state to DRAINING/DRAINED when update 
+    request occurs prior to initial node registration.
 
 * Changes in SLURM 0.3.4
 ========================
diff --git a/src/slurmctld/node_mgr.c b/src/slurmctld/node_mgr.c
index 659bfdd2eed..2c3e748bc6c 100644
--- a/src/slurmctld/node_mgr.c
+++ b/src/slurmctld/node_mgr.c
@@ -911,7 +911,7 @@ int update_node ( update_node_msg_t * update_node_msg )
 			}
 			else if ((state_val == NODE_STATE_DRAINED) ||
 			         (state_val == NODE_STATE_DRAINING)) {
-				if (bit_test (idle_node_bitmap, node_inx))
+				if ((node_ptr->run_job_cnt + node_ptr->comp_job_cnt) == 0)
 					state_val = NODE_STATE_DRAINED;
 				else
 					state_val = NODE_STATE_DRAINING;
-- 
GitLab