From f5a3b44974f7a105c3b2833a1dd7ee249a50eebc Mon Sep 17 00:00:00 2001
From: Tim Wickberg <tim@schedmd.com>
Date: Thu, 31 Aug 2017 21:22:34 -0600
Subject: [PATCH] Use _remove_job_hash() rather than inline version of the
 same.

Add the xassert() that the inline version has to _remove_job_hash().
---
 src/slurmctld/job_mgr.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index d75fabbe813..2cf15f624e6 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -2753,6 +2753,7 @@ static void _remove_job_hash(struct job_record *job_entry)
 	job_pptr = &job_hash[JOB_HASH_INX(job_entry->job_id)];
 	while ((job_pptr != NULL) &&
 	       ((job_ptr = *job_pptr) != job_entry)) {
+		xassert(job_ptr->magic == JOB_MAGIC);
 		job_pptr = &job_ptr->job_next;
 	}
 	if (job_pptr == NULL) {
@@ -8619,16 +8620,7 @@ static void _list_delete_job(void *job_entry)
 	fed_mgr_remove_fed_job_info(job_ptr->job_id);
 
 	/* Remove the record from job hash table */
-	job_pptr = &job_hash[JOB_HASH_INX(job_ptr->job_id)];
-	while ((job_pptr != NULL) && (*job_pptr != NULL) &&
-	       ((tmp_ptr = *job_pptr) != (struct job_record *) job_entry)) {
-		xassert(tmp_ptr->magic == JOB_MAGIC);
-		job_pptr = &tmp_ptr->job_next;
-	}
-	if (job_pptr == NULL)
-		error("job hash error");
-	else
-		*job_pptr = job_ptr->job_next;
+	_remove_job_hash(job_ptr);
 
 	if (job_ptr->array_recs) {
 		job_array_size = MAX(1, job_ptr->array_recs->task_cnt);
-- 
GitLab