From 35108f3498a36cb085f3328d22c25bcbd60e94d8 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Tue, 28 Nov 2017 14:19:36 -0700 Subject: [PATCH] Avoid registering a job'd credential multiple times. Bug 4323 --- NEWS | 1 + src/common/slurm_cred.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index e38ccd06ee3..1837d8a818a 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ documents those changes that are of interest to users and administrators. -- Show reason field in 'sinfo -R' when nodes is marked as failed. -- Fix potential of slurmstepd segfaulting when the extern step fails to start. -- Allow nodes state to be updated between FAIL and DRAIN. + -- Avoid registering a job'd credential multiple times. * Changes in Slurm 17.02.9 ========================== diff --git a/src/common/slurm_cred.c b/src/common/slurm_cred.c index 8dc8e66aceb..8bb7f234cf0 100644 --- a/src/common/slurm_cred.c +++ b/src/common/slurm_cred.c @@ -1943,8 +1943,14 @@ _find_cred_state(cred_state_t *c, slurm_cred_t *cred) static job_state_t * _insert_job_state(slurm_cred_ctx_t ctx, uint32_t jobid) { - job_state_t *j = _job_state_create(jobid); - list_append(ctx->job_list, j); + job_state_t *j = list_find_first( + ctx->job_list, _list_find_job_state, &jobid);; + if (!j) { + j = _job_state_create(jobid); + list_append(ctx->job_list, j); + } else + debug2("%s: we already have a job state for job %u. No big deal, just an FYI.", + __func__, jobid); return j; } -- GitLab