From e180d3414113c21a6296c9895e15087ad55976e7 Mon Sep 17 00:00:00 2001 From: jette <jette@schedmd.com> Date: Tue, 13 Aug 2013 08:46:35 -0700 Subject: [PATCH] select/cons_res - Add test for zero node allocation I don't see how this could happen, but it might explain something reported by Harvard University. In any case, this could prevent an infinite loop if the task distribution funciton is passed a job allocation with zero nodes. --- src/plugins/select/cons_res/dist_tasks.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/select/cons_res/dist_tasks.c b/src/plugins/select/cons_res/dist_tasks.c index a14afd5d987..b163a5337ca 100644 --- a/src/plugins/select/cons_res/dist_tasks.c +++ b/src/plugins/select/cons_res/dist_tasks.c @@ -136,8 +136,9 @@ static int _compute_c_b_task_dist(struct job_record *job_ptr) job_resources_t *job_res = job_ptr->job_resrcs; bool log_over_subscribe = true; - if (!job_res || !job_res->cpus) { - error("cons_res: _compute_c_b_task_dist given NULL job_ptr"); + if (!job_res || !job_res->cpus || !job_res->nhosts) { + error("cons_res: _compute_c_b_task_dist invalid allocation " + "for job %u", job_ptr->job_id); return SLURM_ERROR; } @@ -210,8 +211,9 @@ static int _compute_plane_dist(struct job_record *job_ptr) job_resources_t *job_res = job_ptr->job_resrcs; bool log_over_subscribe = true; - if (!job_res || !job_res->cpus) { - error("cons_res: _compute_plane_dist given NULL job_res"); + if (!job_res || !job_res->cpus || !job_res->nhosts) { + error("cons_res: _compute_c_b_task_dist invalid allocation " + "for job %u", job_ptr->job_id); return SLURM_ERROR; } -- GitLab