From e2696a6202e47557c1142dd012b02fce06e35f9f Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 13 Aug 2020 10:25:09 +0200 Subject: [PATCH] mxqd: Fix checks for group_jobs and jobs_max After commit e6ef2ad4d965c56d1c0d566de5b0667d3c9e4fa6 ("Move server_is_qualified() to mxqd_control") the result of the qualification checks (blacklist, whitelist, prerequisites, exclusive mode) are no longer stored as a boolean in glist->server_is_qualified. Instead, glist->jobs_max is set to 0 if the server is not qualified to start a job from the group. However, there is a bug in start_user: if (glist->jobs_running == group->group_jobs) { continue; } if (glist->jobs_running == glist->jobs_max) { continue; } The number of jobs running may actually be higher then the current limits, if limits are decreased while jobs are already running. This not only applies to changes cause by mxqset, but also to a server restart with different limits. Change comparisons from equality to greater than or equal. --- mxqd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mxqd.c b/mxqd.c index 7274b9e1..efa864d9 100644 --- a/mxqd.c +++ b/mxqd.c @@ -1428,10 +1428,10 @@ unsigned long start_user(struct mxq_user_list *ulist, long slots_to_start) group = &glist->group; - if (glist->jobs_running == group->group_jobs) { + if (glist->jobs_running >= group->group_jobs) { continue; } - if (glist->jobs_running == glist->jobs_max) { + if (glist->jobs_running >= glist->jobs_max) { continue; } if (mxq_group_jobs_inq(group) == 0) {