From c2fbf88fef3efa7d806c4259be715c02792e60d9 Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" <mgrondona@llnl.gov> Date: Thu, 2 Jul 2015 13:02:25 -0700 Subject: [PATCH] slurmd: Do not launch job step during job prolog If a job step request comes in while the slurm prolog is running, slurmd will happily launch the job step. This means that a user could run code before the prolog is complete, which could cause strange errors or in some cases a security issue. Instead return an error (EINPROGRESS for now) and do not allow job steps to run during prolog. --- src/slurmd/slurmd/req.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c index 58072876c48..50e46dbde07 100644 --- a/src/slurmd/slurmd/req.c +++ b/src/slurmd/slurmd/req.c @@ -1172,6 +1172,14 @@ _rpc_launch_tasks(slurm_msg_t *msg) req->envc = envcount(req->env); #ifndef HAVE_FRONT_END + /* + * Do not launch a new job step while prolog in progress: + */ + if (_prolog_is_running (req->job_id)) { + info("[job %u] prolog in progress\n", req->job_id); + errnum = EINPROGRESS; + goto done; + } slurm_mutex_lock(&prolog_mutex); first_job_run = !slurm_cred_jobid_cached(conf->vctx, req->job_id); #endif @@ -1787,6 +1795,15 @@ _rpc_batch_job(slurm_msg_t *msg, bool new_msg) task_g_slurmd_batch_request(req->job_id, req); /* determine task affinity */ + /* + * Do not launch a new batch job while prolog in progress: + */ + if (_prolog_is_running(req->job_id)) { + info("[job %u] prolog running", req->job_id); + rc = EINPROGRESS; + goto done; + } + slurm_mutex_lock(&prolog_mutex); first_job_run = !slurm_cred_jobid_cached(conf->vctx, req->job_id); -- GitLab