View | Details | Raw Unified | Return to ticket 11323 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/plugins/acct_gather_energy/xcc/acct_gather_energy_xcc.c (-1 / +15 lines)
Lines 810-817 extern int fini(void) Link Here
810
810
811
	slurm_mutex_lock(&ipmi_mutex);
811
	slurm_mutex_lock(&ipmi_mutex);
812
812
813
	if (ipmi_ctx)
813
	if (ipmi_ctx) {
814
		ipmi_ctx_close(ipmi_ctx);
814
		ipmi_ctx_destroy(ipmi_ctx);
815
		ipmi_ctx_destroy(ipmi_ctx);
816
	}
815
	_reset_slurm_ipmi_conf(&slurm_ipmi_conf);
817
	_reset_slurm_ipmi_conf(&slurm_ipmi_conf);
816
818
817
	slurm_mutex_unlock(&ipmi_mutex);
819
	slurm_mutex_unlock(&ipmi_mutex);
Lines 845-852 extern int acct_gather_energy_p_get_data(enum acct_energy_type data_type, Link Here
845
	case ENERGY_DATA_JOULES_TASK:
847
	case ENERGY_DATA_JOULES_TASK:
846
		slurm_mutex_lock(&ipmi_mutex);
848
		slurm_mutex_lock(&ipmi_mutex);
847
		if (running_in_slurmd()) {
849
		if (running_in_slurmd()) {
850
			/*
851
			 * ipmi_ctx is global at thread level. If
852
			 * _init_ipmi_config creates a new context to answer
853
			 * REQUEST_ACCT_GATHER_ENERGY RPC in a separated thread,
854
			 * we need to destroy this context at the end.
855
			 * Otherwise, the FD liked to IPMI device is left open.
856
			 */
857
			bool destroy_ctx = (ipmi_ctx ? false : true);
848
			if (_init_ipmi_config() == SLURM_SUCCESS)
858
			if (_init_ipmi_config() == SLURM_SUCCESS)
849
				_thread_update_node_energy();
859
				_thread_update_node_energy();
860
			if (destroy_ctx) {
861
				ipmi_ctx_close(ipmi_ctx);
862
				ipmi_ctx_destroy(ipmi_ctx);
863
			}
850
		} else {
864
		} else {
851
			_get_joules_task(10);
865
			_get_joules_task(10);
852
		}
866
		}

Return to ticket 11323