Skip to content
Snippets Groups Projects
Commit 5d6fa153 authored by Danny Auble's avatar Danny Auble
Browse files

Fix issue where cgroup information was loaded on the start of the

slurmctld when starting up the jobacct_gather plugin.  It isn't needed
and makes errors in the slurmctld if not running as root.
parent e7b4ed56
No related branches found
No related tags found
No related merge requests found
...@@ -61,12 +61,14 @@ pthread_mutex_t jobacct_lock __attribute__((weak_import)); ...@@ -61,12 +61,14 @@ pthread_mutex_t jobacct_lock __attribute__((weak_import));
uint32_t jobacct_mem_limit __attribute__((weak_import)); uint32_t jobacct_mem_limit __attribute__((weak_import));
uint32_t jobacct_step_id __attribute__((weak_import)); uint32_t jobacct_step_id __attribute__((weak_import));
uint32_t jobacct_vmem_limit __attribute__((weak_import)); uint32_t jobacct_vmem_limit __attribute__((weak_import));
int bg_recover __attribute__((weak_import)) = NOT_FROM_CONTROLLER;
#else #else
uint32_t jobacct_job_id; uint32_t jobacct_job_id;
pthread_mutex_t jobacct_lock; pthread_mutex_t jobacct_lock;
uint32_t jobacct_mem_limit; uint32_t jobacct_mem_limit;
uint32_t jobacct_step_id; uint32_t jobacct_step_id;
uint32_t jobacct_vmem_limit; uint32_t jobacct_vmem_limit;
int bg_recover = NOT_FROM_CONTROLLER;
#endif #endif
...@@ -593,33 +595,40 @@ static void _destroy_prec(void *object) ...@@ -593,33 +595,40 @@ static void _destroy_prec(void *object)
*/ */
extern int init (void) extern int init (void)
{ {
/* read cgroup configuration */ char *temp;
if (read_slurm_cgroup_conf(&slurm_cgroup_conf))
return SLURM_ERROR; /* If running on the slurmctld don't do any of this since it
isn't needed.
/* initialize cpuinfo internal data */ */
if (xcpuinfo_init() != XCPUINFO_SUCCESS) { if (bg_recover == NOT_FROM_CONTROLLER) {
free_slurm_cgroup_conf(&slurm_cgroup_conf); /* read cgroup configuration */
return SLURM_ERROR; if (read_slurm_cgroup_conf(&slurm_cgroup_conf))
} return SLURM_ERROR;
/* initialize cpuinfo internal data */
if (xcpuinfo_init() != XCPUINFO_SUCCESS) {
free_slurm_cgroup_conf(&slurm_cgroup_conf);
return SLURM_ERROR;
}
/* enable cpuacct cgroup subsystem */ /* enable cpuacct cgroup subsystem */
if (jobacct_gather_cgroup_cpuacct_init(&slurm_cgroup_conf) != if (jobacct_gather_cgroup_cpuacct_init(&slurm_cgroup_conf) !=
SLURM_SUCCESS) { SLURM_SUCCESS) {
xcpuinfo_fini(); xcpuinfo_fini();
free_slurm_cgroup_conf(&slurm_cgroup_conf); free_slurm_cgroup_conf(&slurm_cgroup_conf);
return SLURM_ERROR; return SLURM_ERROR;
} }
/* enable memory cgroup subsystem */ /* enable memory cgroup subsystem */
if (jobacct_gather_cgroup_memory_init(&slurm_cgroup_conf) != if (jobacct_gather_cgroup_memory_init(&slurm_cgroup_conf) !=
SLURM_SUCCESS) { SLURM_SUCCESS) {
xcpuinfo_fini(); xcpuinfo_fini();
free_slurm_cgroup_conf(&slurm_cgroup_conf); free_slurm_cgroup_conf(&slurm_cgroup_conf);
return SLURM_ERROR; return SLURM_ERROR;
}
} }
char *temp = slurm_get_proctrack_type(); temp = slurm_get_proctrack_type();
if (!strcasecmp(temp, "proctrack/pgid")) { if (!strcasecmp(temp, "proctrack/pgid")) {
info("WARNING: We will use a much slower algorithm with " info("WARNING: We will use a much slower algorithm with "
"proctrack/pgid, use Proctracktype=proctrack/linuxproc " "proctrack/pgid, use Proctracktype=proctrack/linuxproc "
...@@ -637,6 +646,7 @@ extern int init (void) ...@@ -637,6 +646,7 @@ extern int init (void)
"need to change it.", ACCOUNTING_STORAGE_TYPE_NONE); "need to change it.", ACCOUNTING_STORAGE_TYPE_NONE);
} }
xfree(temp); xfree(temp);
verbose("%s loaded", plugin_name); verbose("%s loaded", plugin_name);
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment