Skip to content

Commit

Permalink
mxqd: Fix checks for group_jobs and jobs_max
Browse files Browse the repository at this point in the history
After commit e6ef2ad ("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.
  • Loading branch information
donald committed Aug 13, 2020
1 parent 5afd6c9 commit e2696a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e2696a6

Please sign in to comment.