From d2dda77833c6e2b466ba973a9f40336f3800b2f4 Mon Sep 17 00:00:00 2001
From: Dominik Bartkiewicz <bart@schedmd.com>
Date: Thu, 13 Apr 2017 10:54:52 -0600
Subject: [PATCH] Reset backfill timers correctly without skipping over them in
 certain circumstances.

---
 NEWS                                  |  2 ++
 src/plugins/sched/backfill/backfill.c | 13 +++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index a7273ff7996..1385e9055f0 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ documents those changes that are of interest to users and administrators.
  -- Clear Dependency field when all dependencies are satisfied.
  -- Add --array-unique to squeue which will display one unique pending job
     array element per line.
+ -- Reset backfill timers correctly without skipping over them in certain
+    circumstances.
 
 * Changes in Slurm 17.02.2
 ==========================
diff --git a/src/plugins/sched/backfill/backfill.c b/src/plugins/sched/backfill/backfill.c
index 5e5103b3d7e..5465bab82b3 100644
--- a/src/plugins/sched/backfill/backfill.c
+++ b/src/plugins/sched/backfill/backfill.c
@@ -1390,6 +1390,13 @@ next_task:
 				break;
 			}
 
+			/* Reset backfill scheduling timers, resume testing */
+			sched_start = time(NULL);
+			gettimeofday(&start_tv, NULL);
+			job_test_count = 1;
+			test_time_count = 0;
+			START_TIMER;
+
 			/* With bf_continue configured, the original job could
 			 * have been scheduled or cancelled and purged.
 			 * Revalidate job the record here. */
@@ -1408,12 +1415,6 @@ next_task:
 
 			job_ptr->time_limit = save_time_limit;
 			job_ptr->part_ptr = part_ptr;
-			/* Reset backfill scheduling timers, resume testing */
-			sched_start = time(NULL);
-			gettimeofday(&start_tv, NULL);
-			job_test_count = 1;
-			test_time_count = 0;
-			START_TIMER;
 		}
 
 		FREE_NULL_BITMAP(avail_bitmap);
-- 
GitLab