Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ c - crash b - bug fix e - enhancement f - new feature n - note

4.1.5
b - For cray: make sure that reservations are released when jobs are requeued. TRQ-1572.
c - If the job is no long valid after attempting to lock the array in get_jobs_array(),
make sure the array is valid before attempting to unlock it. TRQ-1598.

4.1.4
e - When in cray mode, write physmem and availmem in addition to totmem so that
Expand Down
4 changes: 2 additions & 2 deletions src/pam/pam_pbssimpleauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "portability.h"
#include "list_link.h"
#include "pbs_ifl.h"
#include "lib_ifl.h"
#include "attribute.h"
#include "server_limits.h"
#include "pbs_job.h"
Expand Down Expand Up @@ -54,7 +55,6 @@
#endif



/* --- authentication management functions (only) --- */

PAM_EXTERN
Expand Down Expand Up @@ -104,7 +104,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc,
}

/* get the username and passwd, allow uid 0 */
retval = pam_get_user(pamh, &username, NULL);
retval = pam_get_user(pamh, (const char **)&username, NULL);

#if defined(PAM_CONV_AGAIN) && defined(PAM_INCOMPLETE)
if (retval == PAM_CONV_AGAIN)
Expand Down
2 changes: 1 addition & 1 deletion src/resmom/start_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -4147,7 +4147,7 @@ int TMomFinalizeChild(
/* Put the script's arguments on the command line (see configure option --enable-shell-use-argv). */
if (TJE->is_interactive == FALSE)
{
arg[aindex] = calloc(1,
arg[aindex] = (char *)calloc(1,
strlen(path_jobs) +
strlen(pjob->ji_qs.ji_fileprefix) +
strlen(JOB_SCRIPT_SUFFIX) + 6);
Expand Down
4 changes: 3 additions & 1 deletion src/server/display_alps_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "list_link.h"
#include "../lib/Libutils/u_lock_ctl.h"

extern int LOGLEVEL;


int status_node(struct pbsnode *, struct batch_request *, int *, tlist_head *);

Expand All @@ -24,7 +26,7 @@ int get_alps_statuses(
while ((alps_node = next_host(&(parent->alps_subnodes), &iter, NULL)) != NULL)
{
rc = status_node(alps_node, preq, bad, pstathd);
unlock_node(alps_node, __func__, NULL, 0);
unlock_node(alps_node, __func__, NULL, LOGLEVEL);

if (rc != PBSE_NONE)
break;
Expand Down
1 change: 1 addition & 0 deletions src/server/exiting_jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ int check_exiting_jobs()
}
else
{
pjob_mutex.unlock();
retry_job_exit(jeri);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/server/job_container.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,18 +478,18 @@ job *svr_find_job(
{
pj = pj->ji_external_clone;

lock_ji_mutex(pj, __func__, NULL, 0);
unlock_ji_mutex(pj->ji_parent_job, __func__, NULL, 0);
lock_ji_mutex(pj, __func__, NULL, LOGLEVEL);
unlock_ji_mutex(pj->ji_parent_job, __func__, NULL, LOGLEVEL);

if (pj->ji_being_recycled == TRUE)
{
unlock_ji_mutex(pj, __func__, NULL, 0);
unlock_ji_mutex(pj, __func__, NULL, LOGLEVEL);
pj = NULL;
}
}
else
{
unlock_ji_mutex(pj, __func__, NULL, 0);
unlock_ji_mutex(pj, __func__, NULL, LOGLEVEL);
pj = NULL;
}
}
Expand Down
19 changes: 11 additions & 8 deletions src/server/job_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,13 +741,13 @@ void job_free(

if (pj->ji_cray_clone != NULL)
{
lock_ji_mutex(pj->ji_cray_clone, __func__, NULL, 0);
lock_ji_mutex(pj->ji_cray_clone, __func__, NULL, LOGLEVEL);
job_free(pj->ji_cray_clone, TRUE);
}

if (pj->ji_external_clone != NULL)
{
lock_ji_mutex(pj->ji_external_clone, __func__, NULL, 0);
lock_ji_mutex(pj->ji_external_clone, __func__, NULL, LOGLEVEL);
job_free(pj->ji_external_clone, TRUE);
}

Expand Down Expand Up @@ -2056,12 +2056,15 @@ job_array *get_jobs_array(
pjob = svr_find_job(jobid, TRUE);
if (pjob == NULL)
{
unlock_ai_mutex(pa, __func__, "1", LOGLEVEL);
pa = NULL;
if (pa != NULL)
{
unlock_ai_mutex(pa, __func__, "1", LOGLEVEL);
pa = NULL;
}

*pjob_ptr = NULL;
}
mutex_mgr job_mutex2(pjob->ji_mutex,true);
job_mutex2.set_lock_on_exit(false);

}

return(pa);
Expand Down Expand Up @@ -2299,7 +2302,7 @@ int split_job(
change_external_job_name(external);
external->ji_parent_job = pjob;
pjob->ji_external_clone = external;
unlock_ji_mutex(external, __func__, NULL, 0);
unlock_ji_mutex(external, __func__, NULL, LOGLEVEL);
}

if (pjob->ji_cray_clone == NULL)
Expand All @@ -2308,7 +2311,7 @@ int split_job(
fix_cray_exec_hosts(cray);
cray->ji_parent_job = pjob;
pjob->ji_cray_clone = cray;
unlock_ji_mutex(cray, __func__, NULL, 0);
unlock_ji_mutex(cray, __func__, NULL, LOGLEVEL);
}

return(PBSE_NONE);
Expand Down
22 changes: 16 additions & 6 deletions src/server/job_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,29 @@ int job_route(
time_t time_now = time(NULL);
char log_buf[LOCAL_LOG_BUF_SIZE];

struct pbs_queue *qp = jobp->ji_qhdr;
struct pbs_queue *qp;
long retry_time;

if (qp == NULL)
return(PBSE_QUENOEN);

if (LOGLEVEL >= 7)
{
sprintf(log_buf, "%s", jobp->ji_qs.ji_jobid);
LOG_EVENT(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, log_buf);
log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, log_buf);
}

qp = get_jobs_queue(&jobp);

if (jobp == NULL)
{
return(PBSE_JOB_RECYCLED);
}

if (qp == NULL)
{
return(PBSE_BADSTATE);
}

mutex_mgr qp_mutex = mutex_mgr(qp->qu_mutex, true);

mutex_mgr qp_mutex = mutex_mgr(qp->qu_mutex);
/* see if the job is able to be routed */
switch (jobp->ji_qs.ji_state)
{
Expand Down
9 changes: 5 additions & 4 deletions src/server/login_nodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
#include "login_nodes.h"
#include "../lib/Libutils/u_lock_ctl.h"

extern int LOGLEVEL;

login_holder logins;

Expand Down Expand Up @@ -132,7 +133,7 @@ struct pbsnode *check_node(
{
struct pbsnode *pnode = ln->pnode;

lock_node(pnode, __func__, NULL, 20);
lock_node(pnode, __func__, NULL, LOGLEVEL);

if ((hasprop(pnode, needed) == TRUE) &&
(pnode->nd_nsn - pnode->nd_np_to_be_used >= 1) &&
Expand All @@ -141,7 +142,7 @@ struct pbsnode *check_node(
return(pnode);
else
{
unlock_node(pnode, __func__, NULL, 20);
unlock_node(pnode, __func__, NULL, LOGLEVEL);
return(NULL);
}
} /* END check_node() */
Expand Down Expand Up @@ -252,7 +253,7 @@ struct pbsnode *get_next_login_node(
if (ln != NULL)
{
pnode = ln->pnode;
lock_node(pnode, __func__, NULL, 0);
lock_node(pnode, __func__, NULL, LOGLEVEL);

if (needed != NULL)
{
Expand All @@ -272,7 +273,7 @@ struct pbsnode *get_next_login_node(

if (node_fits == FALSE)
{
unlock_node(pnode, __func__, NULL, 0);
unlock_node(pnode, __func__, NULL, LOGLEVEL);
pnode = find_fitting_node(needed);
}
else
Expand Down
24 changes: 12 additions & 12 deletions src/server/node_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ struct pbsnode *find_node_in_allnodes(
pnode = (struct pbsnode *)an->ra->slots[index].item;

if (pnode != NULL)
lock_node(pnode, __func__, 0, 0);
lock_node(pnode, __func__, 0, LOGLEVEL);
}

pthread_mutex_unlock(an->allnodes_mutex);
Expand Down Expand Up @@ -351,17 +351,17 @@ struct pbsnode *find_nodebyname(
{
if (alps_reporter != NULL)
{
lock_node(alps_reporter, __func__, NULL, 0);
lock_node(alps_reporter, __func__, NULL, LOGLEVEL);

if ((i = get_value_hash(alps_reporter->alps_subnodes.ht, (void *)nodename)) >= 0)
{
if ((pnode = (struct pbsnode *)alps_reporter->alps_subnodes.ra->slots[i].item) != NULL)
{
lock_node(pnode, __func__, NULL, 0);
lock_node(pnode, __func__, NULL, LOGLEVEL);
}
}

unlock_node(alps_reporter, __func__, NULL, 0);
unlock_node(alps_reporter, __func__, NULL, LOGLEVEL);
}
}
else
Expand Down Expand Up @@ -2427,15 +2427,15 @@ int setup_nodes(void)
np->nd_is_alps_reporter = TRUE;
alps_reporter = np;
initialize_all_nodes_array(&(np->alps_subnodes));
unlock_node(np, __func__, NULL, 0);
unlock_node(np, __func__, NULL, LOGLEVEL);
}
else if (is_alps_starter == TRUE)
{
np = find_nodebyname(nodename);
np->nd_is_alps_login = TRUE;
add_to_login_holder(np);
/* NYI: add to login node list */
unlock_node(np, __func__, NULL, 0);
unlock_node(np, __func__, NULL, LOGLEVEL);
}
}

Expand Down Expand Up @@ -3248,7 +3248,7 @@ static struct pbsnode *get_my_next_alps_node(
{
struct pbsnode *alps_node = next_host(&(pnode->alps_subnodes), &(iter->alps_index), NULL);

unlock_node(pnode, __func__, NULL, 0);
unlock_node(pnode, __func__, NULL, LOGLEVEL);

return(alps_node);
} /* END get_my_next_alps_node() */
Expand Down Expand Up @@ -3340,7 +3340,7 @@ struct pbsnode *next_node(

if (next != NULL)
{
lock_node(next, __func__, NULL, 0);
lock_node(next, __func__, NULL, LOGLEVEL);

if (next->nd_is_alps_reporter)
next = get_my_next_alps_node(iter, next);
Expand All @@ -3349,7 +3349,7 @@ struct pbsnode *next_node(
}
else
{
unlock_node(current, __func__, NULL, 0);
unlock_node(current, __func__, NULL, LOGLEVEL);
iter->alps_index = -1;

pthread_mutex_lock(an->allnodes_mutex);
Expand All @@ -3358,7 +3358,7 @@ struct pbsnode *next_node(

if (next != NULL)
{
lock_node(next, __func__, NULL, 0);
lock_node(next, __func__, NULL, LOGLEVEL);

if (next->nd_is_alps_reporter)
next = get_my_next_alps_node(iter, next);
Expand Down Expand Up @@ -3542,7 +3542,7 @@ struct pbsnode *next_host(
if (held != NULL)
{
name = strdup(held->nd_name);
unlock_node(held, __func__, NULL, 0);
unlock_node(held, __func__, NULL, LOGLEVEL);
}
pthread_mutex_lock(an->allnodes_mutex);
}
Expand Down Expand Up @@ -3595,7 +3595,7 @@ void *send_hierarchy_threadtask(
if (pnode != NULL)
{
port = pnode->nd_mom_rm_port;
unlock_node(pnode, __func__, NULL, 0);
unlock_node(pnode, __func__, NULL, LOGLEVEL);

if (send_hierarchy(hi->name, port) != PBSE_NONE)
{
Expand Down
Loading