diff --git a/doc/man/man1/scontrol.1 b/doc/man/man1/scontrol.1 index 66d293eaa231d04abb70ae3ee95e1e5b7e905307..1d8f8179cb32b3edaa88343adca2bfd07f08ce8c 100644 --- a/doc/man/man1/scontrol.1 +++ b/doc/man/man1/scontrol.1 @@ -1078,9 +1078,11 @@ For create, if you do not want to give a reservation name, use List of accounts permitted to use the reserved nodes. E.g. Accounts=physcode1,physcode2. A user in any of the accounts may use the reserved nodes. -A new reservation must specify Users and/or Accounts. You can add or -remove individual accounts from an existing reservation by adding -a '+' or '\-' sign before the '=' sign. +A new reservation must specify Users and/or Accounts. +If both Users and Accounts are specified, a job must match both in order to +use the reservation. +You can add or remove individual accounts from an existing reservation by +adding a '+' or '\-' sign before the '=' sign. .TP \fICoreCnt\fP=<num> @@ -1219,9 +1221,11 @@ Value may be cleared with blank data value, "Features=". \fIUsers\fP=<user list> List of users permitted to use the reserved nodes. E.g. Users=jones1,smith2. -A new reservation must specify Users and/or Accounts. You can add or -remove individual users from an existing reservation by adding a '+' -or '\-' sign before the '=' sign. +A new reservation must specify Users and/or Accounts. +If both Users and Accounts are specified, a job must match both in order to +use the reservation. +You can add or remove individual users from an existing reservation by adding +a '+' or '\-' sign before the '=' sign. .TP \fBSPECIFICATIONS FOR UPDATE BLOCK/SUBMP \fR diff --git a/src/slurmctld/reservation.c b/src/slurmctld/reservation.c index 9fe83ec7a24030ab726d9045301114b6042678b3..07f670ff7968b3b147cc04f8fc36ea02084f857d 100644 --- a/src/slurmctld/reservation.c +++ b/src/slurmctld/reservation.c @@ -3034,6 +3034,7 @@ fini: FREE_NULL_BITMAP(save_bitmap); static int _valid_job_access_resv(struct job_record *job_ptr, slurmctld_resv_t *resv_ptr) { + bool uid_match = false; int i; /* Determine if we have access */ @@ -3072,10 +3073,19 @@ static int _valid_job_access_resv(struct job_record *job_ptr, assoc = assoc->usage->parent_assoc_ptr; } } else { -no_assocs: for (i=0; i<resv_ptr->user_cnt; i++) { - if (job_ptr->user_id == resv_ptr->user_list[i]) - return SLURM_SUCCESS; +no_assocs: if (resv_ptr->user_cnt == 0) + uid_match = true; + for (i = 0; i < resv_ptr->user_cnt; i++) { + if (job_ptr->user_id == resv_ptr->user_list[i]) { + uid_match = true; + break; + } } + if (!uid_match) + goto end_it; + if ((resv_ptr->user_cnt != 0) && (resv_ptr->account_cnt == 0)) + return SLURM_SUCCESS; + for (i=0; (i<resv_ptr->account_cnt) && job_ptr->account; i++) { if (resv_ptr->account_list[i] && (strcmp(job_ptr->account,