From ebeb27bd7546c75ee186a144847d37db591cd9c3 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Fri, 3 Oct 2003 17:37:50 +0000 Subject: [PATCH] Reject job requests explicitly requesting more than 8 sets of consecutive nodes. This is a temporary patch until DPCS is upgraded in mid-October. --- src/slurmctld/job_mgr.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index d8c40965263..e175a7cf47a 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -59,6 +59,7 @@ #include "src/slurmctld/slurmctld.h" #define DETAILS_FLAG 0xdddd +#define MAX_NODE_FRAGMENTS 8 #define MAX_RETRIES 10 #define SLURM_CREATE_JOB_FLAG_NO_ALLOCATE_0 0 #define STEP_FLAG 0xbbbb @@ -122,6 +123,7 @@ static void _reset_step_bitmaps(struct job_record *job_ptr); static void _set_job_id(struct job_record *job_ptr); static void _set_job_prio(struct job_record *job_ptr); static bool _slurm_picks_nodes(job_desc_msg_t * job_specs); +static bool _too_many_fragments(bitstr_t *req_bitmap); static bool _top_priority(struct job_record *job_ptr); static int _validate_job_create_req(job_desc_msg_t * job_desc); static int _validate_job_desc(job_desc_msg_t * job_desc_msg, int allocate, @@ -1414,6 +1416,10 @@ static int _job_create(job_desc_msg_t * job_desc, uint32_t * new_job_id, error_code = ESLURM_REQUESTED_NODES_NOT_IN_PARTITION; goto cleanup; } + if (_too_many_fragments(req_bitmap)) { + error_code = ESLURM_TOO_MANY_REQUESTED_NODES; + goto cleanup; + } i = count_cpus(req_bitmap); if (i > job_desc->num_procs) job_desc->num_procs = i; @@ -3186,3 +3192,21 @@ void job_fini (void) xfree(job_hash); xfree(job_hash_over); } + +static bool _too_many_fragments(bitstr_t *req_bitmap) +{ +#ifdef MAX_NODE_FRAGMENTS + int i, frags=0; + int last_bit = 0, next_bit; + + for (i = 0; i < node_record_count; i++) { + next_bit = bit_test(req_bitmap, i); + if (next_bit == last_bit) + continue; + last_bit = next_bit; + if (next_bit && (++frags > MAX_NODE_FRAGMENTS)) + return true; + } +#endif + return false; +} -- GitLab