From 5889538b97d254428847feddf7ff3e80b6569d70 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Thu, 1 Dec 2011 16:28:55 -0800
Subject: [PATCH] BGQ - fix issue when switching from not allowing sub-block
 allocations into allowing them.

---
 src/plugins/select/bluegene/ba_bgq/block_allocator.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/plugins/select/bluegene/ba_bgq/block_allocator.c b/src/plugins/select/bluegene/ba_bgq/block_allocator.c
index 5fd30f2c7ad..2afb99ae157 100644
--- a/src/plugins/select/bluegene/ba_bgq/block_allocator.c
+++ b/src/plugins/select/bluegene/ba_bgq/block_allocator.c
@@ -1261,6 +1261,17 @@ extern void ba_sync_job_to_block(bg_record_t *bg_record,
 			ba_mp = list_peek(bg_record->ba_mp_list);
 			list_append(bg_record->job_list, job_ptr);
 			jobinfo = job_ptr->select_jobinfo->data;
+			/* If you were switching from no sub-block
+			   allocations to allowing it, the units_avail
+			   wouldn't be around for any jobs, but no
+			   problem since they were always the size of
+			   the block.
+			*/
+			if (!jobinfo->units_avail) {
+				jobinfo->units_avail =
+					bit_copy(ba_mp->cnode_bitmap);
+				bit_not(jobinfo->units_avail);
+			}
 			if (bit_overlap(ba_mp->cnode_bitmap,
 					jobinfo->units_avail)) {
 				error("we have an overlapping job allocation "
-- 
GitLab