From 68f7798ebefc007db62053c199d0b37a87532e2e Mon Sep 17 00:00:00 2001 From: Aditi Gaur <agaur@lbl.gov> Date: Thu, 29 Oct 2020 10:03:11 -0700 Subject: [PATCH] Add a 'tmpfs' job_container plugin Adds a 'tmpfs' job container plugin that moves jobs into their own namespace consisting of a private /tmp and a private /dev/shm. The plugin also provides the ability to have a namespace.conf that sets the basepath for the plugin to create the bind mounts as well as an initialization script that can be used to set up the namespace. Signed-off-by: Aditi Gaur <agaur@lbl.gov> --- configure | 3 +- configure.ac | 1 + src/plugins/job_container/Makefile.am | 2 +- src/plugins/job_container/Makefile.in | 2 +- src/plugins/job_container/tmpfs/Makefile.am | 14 + src/plugins/job_container/tmpfs/Makefile.in | 814 ++++++++++++++++++ .../job_container/tmpfs/job_container_tmpfs.c | 683 +++++++++++++++ src/plugins/job_container/tmpfs/read_nsconf.c | 163 ++++ src/plugins/job_container/tmpfs/read_nsconf.h | 56 ++ src/slurmd/slurmstepd/mgr.c | 41 +- 10 files changed, 1775 insertions(+), 4 deletions(-) create mode 100644 src/plugins/job_container/tmpfs/Makefile.am create mode 100644 src/plugins/job_container/tmpfs/Makefile.in create mode 100644 src/plugins/job_container/tmpfs/job_container_tmpfs.c create mode 100644 src/plugins/job_container/tmpfs/read_nsconf.c create mode 100644 src/plugins/job_container/tmpfs/read_nsconf.h diff --git a/configure b/configure index 691e3647ece..e0ea9ae58a6 100755 --- a/configure +++ b/configure @@ -25215,7 +25215,7 @@ $as_echo "${x_ac_deprecated=no}" >&6; } -ac_config_files="$ac_config_files Makefile auxdir/Makefile contribs/Makefile contribs/cray/Makefile contribs/cray/csm/Makefile contribs/cray/slurmsmwd/Makefile contribs/lua/Makefile contribs/mic/Makefile contribs/nss_slurm/Makefile contribs/pam/Makefile contribs/pam_slurm_adopt/Makefile contribs/perlapi/Makefile contribs/perlapi/libslurm/Makefile contribs/perlapi/libslurm/perl/Makefile.PL contribs/perlapi/libslurmdb/Makefile contribs/perlapi/libslurmdb/perl/Makefile.PL contribs/seff/Makefile contribs/torque/Makefile contribs/openlava/Makefile contribs/sgather/Makefile contribs/sgi/Makefile contribs/sjobexit/Makefile contribs/pmi/Makefile contribs/pmi2/Makefile doc/Makefile doc/man/Makefile doc/man/man1/Makefile doc/man/man3/Makefile doc/man/man5/Makefile doc/man/man8/Makefile doc/html/Makefile doc/html/configurator.html doc/html/configurator.easy.html etc/Makefile src/Makefile src/api/Makefile src/bcast/Makefile src/common/Makefile src/database/Makefile src/lua/Makefile src/sacct/Makefile src/sacctmgr/Makefile src/sreport/Makefile src/salloc/Makefile src/sbatch/Makefile src/sbcast/Makefile src/sattach/Makefile src/scancel/Makefile src/scontrol/Makefile src/scrontab/Makefile src/sdiag/Makefile src/sinfo/Makefile src/slurmctld/Makefile src/slurmd/Makefile src/slurmd/common/Makefile src/slurmd/slurmd/Makefile src/slurmd/slurmstepd/Makefile src/slurmdbd/Makefile src/slurmrestd/Makefile src/slurmrestd/plugins/Makefile src/slurmrestd/plugins/auth/Makefile src/slurmrestd/plugins/auth/jwt/Makefile src/slurmrestd/plugins/auth/local/Makefile src/slurmrestd/plugins/openapi/Makefile src/slurmrestd/plugins/openapi/v0.0.35/Makefile src/slurmrestd/plugins/openapi/v0.0.36/Makefile src/slurmrestd/plugins/openapi/dbv0.0.36/Makefile src/sprio/Makefile src/squeue/Makefile src/srun/Makefile src/srun/libsrun/Makefile src/sshare/Makefile src/sstat/Makefile src/strigger/Makefile src/sview/Makefile src/plugins/Makefile src/plugins/accounting_storage/Makefile src/plugins/accounting_storage/common/Makefile src/plugins/accounting_storage/mysql/Makefile src/plugins/accounting_storage/none/Makefile src/plugins/accounting_storage/slurmdbd/Makefile src/plugins/acct_gather_energy/Makefile src/plugins/acct_gather_energy/ibmaem/Makefile src/plugins/acct_gather_energy/ipmi/Makefile src/plugins/acct_gather_energy/none/Makefile src/plugins/acct_gather_energy/pm_counters/Makefile src/plugins/acct_gather_energy/rapl/Makefile src/plugins/acct_gather_energy/rsmi/Makefile src/plugins/acct_gather_energy/xcc/Makefile src/plugins/acct_gather_interconnect/Makefile src/plugins/acct_gather_interconnect/ofed/Makefile src/plugins/acct_gather_interconnect/none/Makefile src/plugins/acct_gather_filesystem/Makefile src/plugins/acct_gather_filesystem/lustre/Makefile src/plugins/acct_gather_filesystem/none/Makefile src/plugins/acct_gather_profile/Makefile src/plugins/acct_gather_profile/hdf5/Makefile src/plugins/acct_gather_profile/hdf5/sh5util/Makefile src/plugins/acct_gather_profile/influxdb/Makefile src/plugins/acct_gather_profile/none/Makefile src/plugins/auth/Makefile src/plugins/auth/jwt/Makefile src/plugins/auth/munge/Makefile src/plugins/auth/none/Makefile src/plugins/burst_buffer/Makefile src/plugins/burst_buffer/common/Makefile src/plugins/burst_buffer/datawarp/Makefile src/plugins/burst_buffer/generic/Makefile src/plugins/cli_filter/Makefile src/plugins/cli_filter/common/Makefile src/plugins/cli_filter/lua/Makefile src/plugins/cli_filter/none/Makefile src/plugins/cli_filter/syslog/Makefile src/plugins/cli_filter/user_defaults/Makefile src/plugins/core_spec/Makefile src/plugins/core_spec/cray_aries/Makefile src/plugins/core_spec/none/Makefile src/plugins/cred/Makefile src/plugins/cred/munge/Makefile src/plugins/cred/none/Makefile src/plugins/ext_sensors/Makefile src/plugins/ext_sensors/rrd/Makefile src/plugins/ext_sensors/none/Makefile src/plugins/gpu/Makefile src/plugins/gpu/generic/Makefile src/plugins/gpu/nvml/Makefile src/plugins/gpu/rsmi/Makefile src/plugins/gres/Makefile src/plugins/gres/common/Makefile src/plugins/gres/gpu/Makefile src/plugins/gres/nic/Makefile src/plugins/gres/mic/Makefile src/plugins/gres/mps/Makefile src/plugins/jobacct_gather/Makefile src/plugins/jobacct_gather/common/Makefile src/plugins/jobacct_gather/linux/Makefile src/plugins/jobacct_gather/cgroup/Makefile src/plugins/jobacct_gather/none/Makefile src/plugins/jobcomp/Makefile src/plugins/jobcomp/elasticsearch/Makefile src/plugins/jobcomp/filetxt/Makefile src/plugins/jobcomp/lua/Makefile src/plugins/jobcomp/none/Makefile src/plugins/jobcomp/script/Makefile src/plugins/jobcomp/mysql/Makefile src/plugins/job_container/Makefile src/plugins/job_container/cncu/Makefile src/plugins/job_container/none/Makefile src/plugins/job_submit/Makefile src/plugins/job_submit/all_partitions/Makefile src/plugins/job_submit/cray_aries/Makefile src/plugins/job_submit/defaults/Makefile src/plugins/job_submit/logging/Makefile src/plugins/job_submit/lua/Makefile src/plugins/job_submit/partition/Makefile src/plugins/job_submit/pbs/Makefile src/plugins/job_submit/require_timelimit/Makefile src/plugins/job_submit/throttle/Makefile src/plugins/launch/Makefile src/plugins/launch/slurm/Makefile src/plugins/mcs/Makefile src/plugins/mcs/account/Makefile src/plugins/mcs/group/Makefile src/plugins/mcs/none/Makefile src/plugins/mcs/user/Makefile src/plugins/node_features/Makefile src/plugins/node_features/knl_cray/Makefile src/plugins/node_features/knl_generic/Makefile src/plugins/power/Makefile src/plugins/power/common/Makefile src/plugins/power/cray_aries/Makefile src/plugins/power/none/Makefile src/plugins/preempt/Makefile src/plugins/preempt/none/Makefile src/plugins/preempt/partition_prio/Makefile src/plugins/preempt/qos/Makefile src/plugins/priority/Makefile src/plugins/priority/basic/Makefile src/plugins/priority/multifactor/Makefile src/plugins/prep/Makefile src/plugins/prep/script/Makefile src/plugins/proctrack/Makefile src/plugins/proctrack/cray_aries/Makefile src/plugins/proctrack/cgroup/Makefile src/plugins/proctrack/pgid/Makefile src/plugins/proctrack/linuxproc/Makefile src/plugins/route/Makefile src/plugins/route/default/Makefile src/plugins/route/topology/Makefile src/plugins/sched/Makefile src/plugins/sched/backfill/Makefile src/plugins/sched/builtin/Makefile src/plugins/sched/hold/Makefile src/plugins/select/Makefile src/plugins/select/cons_common/Makefile src/plugins/select/cons_res/Makefile src/plugins/select/cons_tres/Makefile src/plugins/select/cray_aries/Makefile src/plugins/select/linear/Makefile src/plugins/select/other/Makefile src/plugins/site_factor/Makefile src/plugins/site_factor/none/Makefile src/plugins/slurmctld/Makefile src/plugins/slurmctld/nonstop/Makefile src/plugins/switch/Makefile src/plugins/switch/cray_aries/Makefile src/plugins/switch/none/Makefile src/plugins/mpi/Makefile src/plugins/mpi/cray_shasta/Makefile src/plugins/mpi/none/Makefile src/plugins/mpi/pmi2/Makefile src/plugins/mpi/pmix/Makefile src/plugins/task/Makefile src/plugins/task/affinity/Makefile src/plugins/task/cgroup/Makefile src/plugins/task/cray_aries/Makefile src/plugins/task/none/Makefile src/plugins/topology/Makefile src/plugins/topology/3d_torus/Makefile src/plugins/topology/hypercube/Makefile src/plugins/topology/none/Makefile src/plugins/topology/tree/Makefile testsuite/Makefile testsuite/expect/Makefile testsuite/slurm_unit/Makefile testsuite/slurm_unit/api/Makefile testsuite/slurm_unit/api/manual/Makefile testsuite/slurm_unit/common/Makefile testsuite/slurm_unit/common/slurm_protocol_pack/Makefile testsuite/slurm_unit/common/slurmdb_pack/Makefile testsuite/slurm_unit/common/bitstring/Makefile testsuite/slurm_unit/slurmd/Makefile testsuite/slurm_unit/slurmd/common/Makefile" +ac_config_files="$ac_config_files Makefile auxdir/Makefile contribs/Makefile contribs/cray/Makefile contribs/cray/csm/Makefile contribs/cray/slurmsmwd/Makefile contribs/lua/Makefile contribs/mic/Makefile contribs/nss_slurm/Makefile contribs/pam/Makefile contribs/pam_slurm_adopt/Makefile contribs/perlapi/Makefile contribs/perlapi/libslurm/Makefile contribs/perlapi/libslurm/perl/Makefile.PL contribs/perlapi/libslurmdb/Makefile contribs/perlapi/libslurmdb/perl/Makefile.PL contribs/seff/Makefile contribs/torque/Makefile contribs/openlava/Makefile contribs/sgather/Makefile contribs/sgi/Makefile contribs/sjobexit/Makefile contribs/pmi/Makefile contribs/pmi2/Makefile doc/Makefile doc/man/Makefile doc/man/man1/Makefile doc/man/man3/Makefile doc/man/man5/Makefile doc/man/man8/Makefile doc/html/Makefile doc/html/configurator.html doc/html/configurator.easy.html etc/Makefile src/Makefile src/api/Makefile src/bcast/Makefile src/common/Makefile src/database/Makefile src/lua/Makefile src/sacct/Makefile src/sacctmgr/Makefile src/sreport/Makefile src/salloc/Makefile src/sbatch/Makefile src/sbcast/Makefile src/sattach/Makefile src/scancel/Makefile src/scontrol/Makefile src/scrontab/Makefile src/sdiag/Makefile src/sinfo/Makefile src/slurmctld/Makefile src/slurmd/Makefile src/slurmd/common/Makefile src/slurmd/slurmd/Makefile src/slurmd/slurmstepd/Makefile src/slurmdbd/Makefile src/slurmrestd/Makefile src/slurmrestd/plugins/Makefile src/slurmrestd/plugins/auth/Makefile src/slurmrestd/plugins/auth/jwt/Makefile src/slurmrestd/plugins/auth/local/Makefile src/slurmrestd/plugins/openapi/Makefile src/slurmrestd/plugins/openapi/v0.0.35/Makefile src/slurmrestd/plugins/openapi/v0.0.36/Makefile src/slurmrestd/plugins/openapi/dbv0.0.36/Makefile src/sprio/Makefile src/squeue/Makefile src/srun/Makefile src/srun/libsrun/Makefile src/sshare/Makefile src/sstat/Makefile src/strigger/Makefile src/sview/Makefile src/plugins/Makefile src/plugins/accounting_storage/Makefile src/plugins/accounting_storage/common/Makefile src/plugins/accounting_storage/mysql/Makefile src/plugins/accounting_storage/none/Makefile src/plugins/accounting_storage/slurmdbd/Makefile src/plugins/acct_gather_energy/Makefile src/plugins/acct_gather_energy/ibmaem/Makefile src/plugins/acct_gather_energy/ipmi/Makefile src/plugins/acct_gather_energy/none/Makefile src/plugins/acct_gather_energy/pm_counters/Makefile src/plugins/acct_gather_energy/rapl/Makefile src/plugins/acct_gather_energy/rsmi/Makefile src/plugins/acct_gather_energy/xcc/Makefile src/plugins/acct_gather_interconnect/Makefile src/plugins/acct_gather_interconnect/ofed/Makefile src/plugins/acct_gather_interconnect/none/Makefile src/plugins/acct_gather_filesystem/Makefile src/plugins/acct_gather_filesystem/lustre/Makefile src/plugins/acct_gather_filesystem/none/Makefile src/plugins/acct_gather_profile/Makefile src/plugins/acct_gather_profile/hdf5/Makefile src/plugins/acct_gather_profile/hdf5/sh5util/Makefile src/plugins/acct_gather_profile/influxdb/Makefile src/plugins/acct_gather_profile/none/Makefile src/plugins/auth/Makefile src/plugins/auth/jwt/Makefile src/plugins/auth/munge/Makefile src/plugins/auth/none/Makefile src/plugins/burst_buffer/Makefile src/plugins/burst_buffer/common/Makefile src/plugins/burst_buffer/datawarp/Makefile src/plugins/burst_buffer/generic/Makefile src/plugins/cli_filter/Makefile src/plugins/cli_filter/common/Makefile src/plugins/cli_filter/lua/Makefile src/plugins/cli_filter/none/Makefile src/plugins/cli_filter/syslog/Makefile src/plugins/cli_filter/user_defaults/Makefile src/plugins/core_spec/Makefile src/plugins/core_spec/cray_aries/Makefile src/plugins/core_spec/none/Makefile src/plugins/cred/Makefile src/plugins/cred/munge/Makefile src/plugins/cred/none/Makefile src/plugins/ext_sensors/Makefile src/plugins/ext_sensors/rrd/Makefile src/plugins/ext_sensors/none/Makefile src/plugins/gpu/Makefile src/plugins/gpu/generic/Makefile src/plugins/gpu/nvml/Makefile src/plugins/gpu/rsmi/Makefile src/plugins/gres/Makefile src/plugins/gres/common/Makefile src/plugins/gres/gpu/Makefile src/plugins/gres/nic/Makefile src/plugins/gres/mic/Makefile src/plugins/gres/mps/Makefile src/plugins/jobacct_gather/Makefile src/plugins/jobacct_gather/common/Makefile src/plugins/jobacct_gather/linux/Makefile src/plugins/jobacct_gather/cgroup/Makefile src/plugins/jobacct_gather/none/Makefile src/plugins/jobcomp/Makefile src/plugins/jobcomp/elasticsearch/Makefile src/plugins/jobcomp/filetxt/Makefile src/plugins/jobcomp/lua/Makefile src/plugins/jobcomp/none/Makefile src/plugins/jobcomp/script/Makefile src/plugins/jobcomp/mysql/Makefile src/plugins/job_container/Makefile src/plugins/job_container/cncu/Makefile src/plugins/job_container/none/Makefile src/plugins/job_container/tmpfs/Makefile src/plugins/job_submit/Makefile src/plugins/job_submit/all_partitions/Makefile src/plugins/job_submit/cray_aries/Makefile src/plugins/job_submit/defaults/Makefile src/plugins/job_submit/logging/Makefile src/plugins/job_submit/lua/Makefile src/plugins/job_submit/partition/Makefile src/plugins/job_submit/pbs/Makefile src/plugins/job_submit/require_timelimit/Makefile src/plugins/job_submit/throttle/Makefile src/plugins/launch/Makefile src/plugins/launch/slurm/Makefile src/plugins/mcs/Makefile src/plugins/mcs/account/Makefile src/plugins/mcs/group/Makefile src/plugins/mcs/none/Makefile src/plugins/mcs/user/Makefile src/plugins/node_features/Makefile src/plugins/node_features/knl_cray/Makefile src/plugins/node_features/knl_generic/Makefile src/plugins/power/Makefile src/plugins/power/common/Makefile src/plugins/power/cray_aries/Makefile src/plugins/power/none/Makefile src/plugins/preempt/Makefile src/plugins/preempt/none/Makefile src/plugins/preempt/partition_prio/Makefile src/plugins/preempt/qos/Makefile src/plugins/priority/Makefile src/plugins/priority/basic/Makefile src/plugins/priority/multifactor/Makefile src/plugins/prep/Makefile src/plugins/prep/script/Makefile src/plugins/proctrack/Makefile src/plugins/proctrack/cray_aries/Makefile src/plugins/proctrack/cgroup/Makefile src/plugins/proctrack/pgid/Makefile src/plugins/proctrack/linuxproc/Makefile src/plugins/route/Makefile src/plugins/route/default/Makefile src/plugins/route/topology/Makefile src/plugins/sched/Makefile src/plugins/sched/backfill/Makefile src/plugins/sched/builtin/Makefile src/plugins/sched/hold/Makefile src/plugins/select/Makefile src/plugins/select/cons_common/Makefile src/plugins/select/cons_res/Makefile src/plugins/select/cons_tres/Makefile src/plugins/select/cray_aries/Makefile src/plugins/select/linear/Makefile src/plugins/select/other/Makefile src/plugins/site_factor/Makefile src/plugins/site_factor/none/Makefile src/plugins/slurmctld/Makefile src/plugins/slurmctld/nonstop/Makefile src/plugins/switch/Makefile src/plugins/switch/cray_aries/Makefile src/plugins/switch/none/Makefile src/plugins/mpi/Makefile src/plugins/mpi/cray_shasta/Makefile src/plugins/mpi/none/Makefile src/plugins/mpi/pmi2/Makefile src/plugins/mpi/pmix/Makefile src/plugins/task/Makefile src/plugins/task/affinity/Makefile src/plugins/task/cgroup/Makefile src/plugins/task/cray_aries/Makefile src/plugins/task/none/Makefile src/plugins/topology/Makefile src/plugins/topology/3d_torus/Makefile src/plugins/topology/hypercube/Makefile src/plugins/topology/none/Makefile src/plugins/topology/tree/Makefile testsuite/Makefile testsuite/expect/Makefile testsuite/slurm_unit/Makefile testsuite/slurm_unit/api/Makefile testsuite/slurm_unit/api/manual/Makefile testsuite/slurm_unit/common/Makefile testsuite/slurm_unit/common/slurm_protocol_pack/Makefile testsuite/slurm_unit/common/slurmdb_pack/Makefile testsuite/slurm_unit/common/bitstring/Makefile testsuite/slurm_unit/slurmd/Makefile testsuite/slurm_unit/slurmd/common/Makefile" cat >confcache <<\_ACEOF @@ -26630,6 +26630,7 @@ do "src/plugins/job_container/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/job_container/Makefile" ;; "src/plugins/job_container/cncu/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/job_container/cncu/Makefile" ;; "src/plugins/job_container/none/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/job_container/none/Makefile" ;; + "src/plugins/job_container/tmpfs/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/job_container/tmpfs/Makefile" ;; "src/plugins/job_submit/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/job_submit/Makefile" ;; "src/plugins/job_submit/all_partitions/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/job_submit/all_partitions/Makefile" ;; "src/plugins/job_submit/cray_aries/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/job_submit/cray_aries/Makefile" ;; diff --git a/configure.ac b/configure.ac index d69d47348a3..d55e537fa3d 100644 --- a/configure.ac +++ b/configure.ac @@ -535,6 +535,7 @@ AC_CONFIG_FILES([Makefile src/plugins/job_container/Makefile src/plugins/job_container/cncu/Makefile src/plugins/job_container/none/Makefile + src/plugins/job_container/tmpfs/Makefile src/plugins/job_submit/Makefile src/plugins/job_submit/all_partitions/Makefile src/plugins/job_submit/cray_aries/Makefile diff --git a/src/plugins/job_container/Makefile.am b/src/plugins/job_container/Makefile.am index 8e1960a456c..1075192ca29 100644 --- a/src/plugins/job_container/Makefile.am +++ b/src/plugins/job_container/Makefile.am @@ -1,3 +1,3 @@ # Makefile for job_container plugins -SUBDIRS = cncu none +SUBDIRS = cncu none tmpfs diff --git a/src/plugins/job_container/Makefile.in b/src/plugins/job_container/Makefile.in index c7fcf5018e0..d85b965f7a6 100644 --- a/src/plugins/job_container/Makefile.in +++ b/src/plugins/job_container/Makefile.in @@ -454,7 +454,7 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = cncu none +SUBDIRS = cncu none tmpfs all: all-recursive .SUFFIXES: diff --git a/src/plugins/job_container/tmpfs/Makefile.am b/src/plugins/job_container/tmpfs/Makefile.am new file mode 100644 index 00000000000..c24aa5e4610 --- /dev/null +++ b/src/plugins/job_container/tmpfs/Makefile.am @@ -0,0 +1,14 @@ +# Makefile for job_container/tmpfs plugin + +AUTOMAKE_OPTIONS = foreign + +PLUGIN_FLAGS = -module -avoid-version --export-dynamic + +AM_CPPFLAGS = -DSLURM_PLUGIN_DEBUG -I$(top_srcdir) -I$(top_srcdir)/src/common + +pkglib_LTLIBRARIES = job_container_tmpfs.la + +# job_container/none plugin. +job_container_tmpfs_la_SOURCES = job_container_tmpfs.c read_nsconf.c \ + read_nsconf.h +job_container_tmpfs_la_LDFLAGS = $(PLUGIN_FLAGS) diff --git a/src/plugins/job_container/tmpfs/Makefile.in b/src/plugins/job_container/tmpfs/Makefile.in new file mode 100644 index 00000000000..cbac2e8b92d --- /dev/null +++ b/src/plugins/job_container/tmpfs/Makefile.in @@ -0,0 +1,814 @@ +# Makefile.in generated by automake 1.16.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile for job_container/tmpfs plugin + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = src/plugins/job_container/tmpfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/auxdir/ax_check_compile_flag.m4 \ + $(top_srcdir)/auxdir/ax_check_zlib.m4 \ + $(top_srcdir)/auxdir/ax_gcc_builtin.m4 \ + $(top_srcdir)/auxdir/ax_lib_hdf5.m4 \ + $(top_srcdir)/auxdir/ax_pthread.m4 \ + $(top_srcdir)/auxdir/libtool.m4 \ + $(top_srcdir)/auxdir/ltoptions.m4 \ + $(top_srcdir)/auxdir/ltsugar.m4 \ + $(top_srcdir)/auxdir/ltversion.m4 \ + $(top_srcdir)/auxdir/lt~obsolete.m4 \ + $(top_srcdir)/auxdir/slurm.m4 \ + $(top_srcdir)/auxdir/slurmrestd.m4 \ + $(top_srcdir)/auxdir/x_ac_affinity.m4 \ + $(top_srcdir)/auxdir/x_ac_c99.m4 \ + $(top_srcdir)/auxdir/x_ac_cgroup.m4 \ + $(top_srcdir)/auxdir/x_ac_cray.m4 \ + $(top_srcdir)/auxdir/x_ac_curl.m4 \ + $(top_srcdir)/auxdir/x_ac_databases.m4 \ + $(top_srcdir)/auxdir/x_ac_debug.m4 \ + $(top_srcdir)/auxdir/x_ac_deprecated.m4 \ + $(top_srcdir)/auxdir/x_ac_dlfcn.m4 \ + $(top_srcdir)/auxdir/x_ac_env.m4 \ + $(top_srcdir)/auxdir/x_ac_freeipmi.m4 \ + $(top_srcdir)/auxdir/x_ac_http_parser.m4 \ + $(top_srcdir)/auxdir/x_ac_hwloc.m4 \ + $(top_srcdir)/auxdir/x_ac_json.m4 \ + $(top_srcdir)/auxdir/x_ac_jwt.m4 \ + $(top_srcdir)/auxdir/x_ac_lua.m4 \ + $(top_srcdir)/auxdir/x_ac_lz4.m4 \ + $(top_srcdir)/auxdir/x_ac_man2html.m4 \ + $(top_srcdir)/auxdir/x_ac_munge.m4 \ + $(top_srcdir)/auxdir/x_ac_netloc.m4 \ + $(top_srcdir)/auxdir/x_ac_nvml.m4 \ + $(top_srcdir)/auxdir/x_ac_ofed.m4 \ + $(top_srcdir)/auxdir/x_ac_pam.m4 \ + $(top_srcdir)/auxdir/x_ac_pmix.m4 \ + $(top_srcdir)/auxdir/x_ac_printf_null.m4 \ + $(top_srcdir)/auxdir/x_ac_ptrace.m4 \ + $(top_srcdir)/auxdir/x_ac_readline.m4 \ + $(top_srcdir)/auxdir/x_ac_rrdtool.m4 \ + $(top_srcdir)/auxdir/x_ac_rsmi.m4 \ + $(top_srcdir)/auxdir/x_ac_setproctitle.m4 \ + $(top_srcdir)/auxdir/x_ac_systemd.m4 \ + $(top_srcdir)/auxdir/x_ac_ucx.m4 \ + $(top_srcdir)/auxdir/x_ac_uid_gid_size.m4 \ + $(top_srcdir)/auxdir/x_ac_x11.m4 \ + $(top_srcdir)/auxdir/x_ac_yaml.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/slurm/slurm.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkglibdir)" +LTLIBRARIES = $(pkglib_LTLIBRARIES) +job_container_tmpfs_la_LIBADD = +am_job_container_tmpfs_la_OBJECTS = job_container_tmpfs.lo \ + read_nsconf.lo +job_container_tmpfs_la_OBJECTS = $(am_job_container_tmpfs_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +job_container_tmpfs_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(job_container_tmpfs_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/slurm +depcomp = $(SHELL) $(top_srcdir)/auxdir/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/job_container_tmpfs.Plo \ + ./$(DEPDIR)/read_nsconf.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(job_container_tmpfs_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AR_FLAGS = @AR_FLAGS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRAY_JOB_CPPFLAGS = @CRAY_JOB_CPPFLAGS@ +CRAY_JOB_LDFLAGS = @CRAY_JOB_LDFLAGS@ +CRAY_SELECT_CPPFLAGS = @CRAY_SELECT_CPPFLAGS@ +CRAY_SELECT_LDFLAGS = @CRAY_SELECT_LDFLAGS@ +CRAY_SWITCH_CPPFLAGS = @CRAY_SWITCH_CPPFLAGS@ +CRAY_SWITCH_LDFLAGS = @CRAY_SWITCH_LDFLAGS@ +CRAY_TASK_CPPFLAGS = @CRAY_TASK_CPPFLAGS@ +CRAY_TASK_LDFLAGS = @CRAY_TASK_LDFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATAWARP_CPPFLAGS = @DATAWARP_CPPFLAGS@ +DATAWARP_LDFLAGS = @DATAWARP_LDFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DL_LIBS = @DL_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FREEIPMI_CPPFLAGS = @FREEIPMI_CPPFLAGS@ +FREEIPMI_LDFLAGS = @FREEIPMI_LDFLAGS@ +FREEIPMI_LIBS = @FREEIPMI_LIBS@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +H5CC = @H5CC@ +H5FC = @H5FC@ +HAVEMYSQLCONFIG = @HAVEMYSQLCONFIG@ +HAVE_MAN2HTML = @HAVE_MAN2HTML@ +HDF5_CC = @HDF5_CC@ +HDF5_CFLAGS = @HDF5_CFLAGS@ +HDF5_CPPFLAGS = @HDF5_CPPFLAGS@ +HDF5_FC = @HDF5_FC@ +HDF5_FFLAGS = @HDF5_FFLAGS@ +HDF5_FLIBS = @HDF5_FLIBS@ +HDF5_LDFLAGS = @HDF5_LDFLAGS@ +HDF5_LIBS = @HDF5_LIBS@ +HDF5_TYPE = @HDF5_TYPE@ +HDF5_VERSION = @HDF5_VERSION@ +HTTP_PARSER_CPPFLAGS = @HTTP_PARSER_CPPFLAGS@ +HTTP_PARSER_LDFLAGS = @HTTP_PARSER_LDFLAGS@ +HWLOC_CPPFLAGS = @HWLOC_CPPFLAGS@ +HWLOC_LDFLAGS = @HWLOC_LDFLAGS@ +HWLOC_LIBS = @HWLOC_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JSON_CPPFLAGS = @JSON_CPPFLAGS@ +JSON_LDFLAGS = @JSON_LDFLAGS@ +JWT_CPPFLAGS = @JWT_CPPFLAGS@ +JWT_LDFLAGS = @JWT_LDFLAGS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_SLURM = @LIB_SLURM@ +LIB_SLURM_BUILD = @LIB_SLURM_BUILD@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +LZ4_CPPFLAGS = @LZ4_CPPFLAGS@ +LZ4_LDFLAGS = @LZ4_LDFLAGS@ +LZ4_LIBS = @LZ4_LIBS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MUNGE_CPPFLAGS = @MUNGE_CPPFLAGS@ +MUNGE_DIR = @MUNGE_DIR@ +MUNGE_LDFLAGS = @MUNGE_LDFLAGS@ +MUNGE_LIBS = @MUNGE_LIBS@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +MYSQL_LIBS = @MYSQL_LIBS@ +NETLOC_CPPFLAGS = @NETLOC_CPPFLAGS@ +NETLOC_LDFLAGS = @NETLOC_LDFLAGS@ +NETLOC_LIBS = @NETLOC_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NUMA_LIBS = @NUMA_LIBS@ +NVML_CPPFLAGS = @NVML_CPPFLAGS@ +NVML_LIBS = @NVML_LIBS@ +OBJCOPY = @OBJCOPY@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OFED_CPPFLAGS = @OFED_CPPFLAGS@ +OFED_LDFLAGS = @OFED_LDFLAGS@ +OFED_LIBS = @OFED_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PAM_DIR = @PAM_DIR@ +PAM_LIBS = @PAM_LIBS@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PMIX_V1_CPPFLAGS = @PMIX_V1_CPPFLAGS@ +PMIX_V1_LDFLAGS = @PMIX_V1_LDFLAGS@ +PMIX_V2_CPPFLAGS = @PMIX_V2_CPPFLAGS@ +PMIX_V2_LDFLAGS = @PMIX_V2_LDFLAGS@ +PMIX_V3_CPPFLAGS = @PMIX_V3_CPPFLAGS@ +PMIX_V3_LDFLAGS = @PMIX_V3_LDFLAGS@ +PMIX_V4_CPPFLAGS = @PMIX_V4_CPPFLAGS@ +PMIX_V4_LDFLAGS = @PMIX_V4_LDFLAGS@ +PROJECT = @PROJECT@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +READLINE_LIBS = @READLINE_LIBS@ +RELEASE = @RELEASE@ +RRDTOOL_CPPFLAGS = @RRDTOOL_CPPFLAGS@ +RRDTOOL_LDFLAGS = @RRDTOOL_LDFLAGS@ +RRDTOOL_LIBS = @RRDTOOL_LIBS@ +RSMI_CPPFLAGS = @RSMI_CPPFLAGS@ +RSMI_LDFLAGS = @RSMI_LDFLAGS@ +RSMI_LIBS = @RSMI_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SLEEP_CMD = @SLEEP_CMD@ +SLURMCTLD_PORT = @SLURMCTLD_PORT@ +SLURMCTLD_PORT_COUNT = @SLURMCTLD_PORT_COUNT@ +SLURMDBD_PORT = @SLURMDBD_PORT@ +SLURMD_PORT = @SLURMD_PORT@ +SLURMRESTD_PORT = @SLURMRESTD_PORT@ +SLURM_API_AGE = @SLURM_API_AGE@ +SLURM_API_CURRENT = @SLURM_API_CURRENT@ +SLURM_API_MAJOR = @SLURM_API_MAJOR@ +SLURM_API_REVISION = @SLURM_API_REVISION@ +SLURM_API_VERSION = @SLURM_API_VERSION@ +SLURM_MAJOR = @SLURM_MAJOR@ +SLURM_MICRO = @SLURM_MICRO@ +SLURM_MINOR = @SLURM_MINOR@ +SLURM_PREFIX = @SLURM_PREFIX@ +SLURM_VERSION_NUMBER = @SLURM_VERSION_NUMBER@ +SLURM_VERSION_STRING = @SLURM_VERSION_STRING@ +STRIP = @STRIP@ +SUCMD = @SUCMD@ +SYSTEMD_TASKSMAX_OPTION = @SYSTEMD_TASKSMAX_OPTION@ +UCX_CPPFLAGS = @UCX_CPPFLAGS@ +UCX_LDFLAGS = @UCX_LDFLAGS@ +UCX_LIBS = @UCX_LIBS@ +UTIL_LIBS = @UTIL_LIBS@ +VERSION = @VERSION@ +YAML_CPPFLAGS = @YAML_CPPFLAGS@ +YAML_LDFLAGS = @YAML_LDFLAGS@ +ZLIB_CPPFLAGS = @ZLIB_CPPFLAGS@ +ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_have_man2html = @ac_have_man2html@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lua_CFLAGS = @lua_CFLAGS@ +lua_LIBS = @lua_LIBS@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = foreign +PLUGIN_FLAGS = -module -avoid-version --export-dynamic +AM_CPPFLAGS = -DSLURM_PLUGIN_DEBUG -I$(top_srcdir) -I$(top_srcdir)/src/common +pkglib_LTLIBRARIES = job_container_tmpfs.la + +# job_container/none plugin. +job_container_tmpfs_la_SOURCES = job_container_tmpfs.c read_nsconf.c \ + read_nsconf.h + +job_container_tmpfs_la_LDFLAGS = $(PLUGIN_FLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/plugins/job_container/tmpfs/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/plugins/job_container/tmpfs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ + } + +uninstall-pkglibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ + done + +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + @list='$(pkglib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +job_container_tmpfs.la: $(job_container_tmpfs_la_OBJECTS) $(job_container_tmpfs_la_DEPENDENCIES) $(EXTRA_job_container_tmpfs_la_DEPENDENCIES) + $(AM_V_CCLD)$(job_container_tmpfs_la_LINK) -rpath $(pkglibdir) $(job_container_tmpfs_la_OBJECTS) $(job_container_tmpfs_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job_container_tmpfs.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read_nsconf.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/job_container_tmpfs.Plo + -rm -f ./$(DEPDIR)/read_nsconf.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-pkglibLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/job_container_tmpfs.Plo + -rm -f ./$(DEPDIR)/read_nsconf.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkglibLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-pkglibLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags dvi dvi-am \ + html html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pkglibLTLIBRARIES install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-pkglibLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/plugins/job_container/tmpfs/job_container_tmpfs.c b/src/plugins/job_container/tmpfs/job_container_tmpfs.c new file mode 100644 index 00000000000..763cb29a4b5 --- /dev/null +++ b/src/plugins/job_container/tmpfs/job_container_tmpfs.c @@ -0,0 +1,683 @@ +/*****************************************************************************\ + * job_container_tmpfs.c - Define job container plugin for creating a + * temporary mount namespace for the job, to provide + * quota based access to node local memory. + ***************************************************************************** + * Copyright (C) 2019-2021 Regents of the University of California + * Produced at Lawrence Berkeley National Laboratory + * Written by Aditi Gaur <agaur@lbl.gov> + * All rights reserved. + * + * This file is part of SLURM, a resource management program. + * For details, see <https://slurm.schedmd.com/>. + * Please also read the included file: DISCLAIMER. + * + * SLURM is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * In addition, as a special exception, the copyright holders give permission + * to link the code of portions of this program with the OpenSSL library under + * certain conditions as described in each individual source file, and + * distribute linked combinations including the two. You must obey the GNU + * General Public License in all respects for all of the code used other than + * OpenSSL. If you modify file(s) with this exception, you may extend this + * exception to your version of the file(s), but you are not obligated to do + * so. If you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files in + * the program, then also delete it here. + * + * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with SLURM; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +\*****************************************************************************/ + +#define _GNU_SOURCE +#define _XOPEN_SOURCE 500 /* For ftw.h */ +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <sys/mman.h> +#include <sched.h> +#include <fcntl.h> +#include <ftw.h> +#include <sys/mount.h> +#include <linux/limits.h> +#include <semaphore.h> + +#include "src/common/slurm_xlator.h" +#include "src/common/log.h" +#include "src/common/run_command.h" + +#include "read_nsconf.h" + +#if defined (__APPLE__) +extern slurmd_conf_t *conf __attribute__((weak_import)); +#else +slurmd_conf_t *conf = NULL; +#endif + +const char plugin_name[] = "job_container tmpfs plugin"; +const char plugin_type[] = "job_container/tmpfs"; +const uint32_t plugin_version = SLURM_VERSION_NUMBER; + +static slurm_ns_conf_t *ns_conf = NULL; + +static int _create_paths(uint32_t job_id, + char *job_mount, + char *ns_holder, + char *src_bind, + char *active) +{ + ns_conf = get_slurm_ns_conf(); + + if (!ns_conf) { + error("%s: Configuration not read correctly: did namespace.conf not exist?", + __func__); + return SLURM_ERROR; + } + + xassert(job_mount); + + if (snprintf(job_mount, PATH_MAX, "%s/%d", ns_conf->basepath, job_id) + >= PATH_MAX) { + error("%s: Unable to build job %u mount path: %m", + __func__, job_id); + return SLURM_ERROR; + } + + if (ns_holder) { + if (snprintf(ns_holder, PATH_MAX, "%s/.ns", job_mount) + >= PATH_MAX) { + error("%s: Unable to build job %u ns_holder path: %m", + __func__, job_id); + return SLURM_ERROR; + } + } + + if (src_bind) { + if (snprintf(src_bind, PATH_MAX, "%s/.%u", job_mount, job_id) + >= PATH_MAX) { + error("%s: Unable to build job %u src_bind path: %m", + __func__, job_id); + return SLURM_ERROR; + } + } + + if (active) { + if (snprintf(active, PATH_MAX, "%s/.active", job_mount) + >= PATH_MAX) { + error("%s: Unable to build job %u active path: %m", + __func__, job_id); + return SLURM_ERROR; + } + } + + return SLURM_SUCCESS; +} + +extern void container_p_reconfig(void) +{ + return; +} + +/* + * init() is called when the plugin is loaded, before any other functions + * are called. Put global initialization here. + */ +extern int init(void) +{ + debug("%s loaded", plugin_name); + + return SLURM_SUCCESS; +} + +/* + * fini() is called when the plugin is removed. Clear any allocated + * storage here. + */ +extern int fini(void) +{ + int rc = 0; + + debug("%s unloaded", plugin_name); + +#ifdef HAVE_NATIVE_CRAY + return SLURM_SUCCESS; +#endif + + ns_conf = get_slurm_ns_conf(); + if (!ns_conf) { + error("%s: Configuration not loaded", __func__); + return SLURM_ERROR; + } + rc = umount2(ns_conf->basepath, MNT_DETACH); + if (rc) { + error("%s: umount2: %s failed: %s", + __func__, ns_conf->basepath, strerror(errno)); + return SLURM_ERROR; + } + free_ns_conf(); + + return SLURM_SUCCESS; +} + +extern int container_p_restore(char *dir_name, bool recover) +{ + struct stat stbuf; + +#ifdef HAVE_NATIVE_CRAY + return SLURM_SUCCESS; +#endif + + ns_conf = get_slurm_ns_conf(); + if (!ns_conf) { + error("%s: Configuration not loaded", __func__); + return SLURM_ERROR; + } + + debug("namepsace.conf read successfully"); + + if (stat(ns_conf->basepath, &stbuf)) { + error("%s: stat failed %s, %s", + __func__, ns_conf->basepath, strerror(errno)); + return SLURM_ERROR; + } + + /* + * MS_BIND mountflag would make mount() ignore all other mountflags + * except MS_REC. We need MS_PRIVATE mountflag as well to make the + * mount (as well as all mounts inside it) private, which needs to be + * done by calling mount() a second time with MS_PRIVATE and MS_REC + * flags. + */ + if (mount(ns_conf->basepath, ns_conf->basepath, "xfs", MS_BIND, NULL)) { + error("%s: Initial base mount failed, %s", + __func__, strerror(errno)); + return SLURM_ERROR; + } + if (mount(ns_conf->basepath, ns_conf->basepath, "xfs", + MS_PRIVATE | MS_REC, NULL)) { + error("%s: Initial base mount failed, %s", + __func__, strerror(errno)); + return SLURM_ERROR; + } + debug3("tmpfs: Base namespace created"); + + return SLURM_SUCCESS; +} + +static int _mount_private_tmp(char *path) +{ + if (!path) { + error("%s: cannot mount /tmp", __func__); + return -1; + } + if (mount(NULL, "/", NULL, MS_PRIVATE|MS_REC, NULL)) { + error("%s: making root private: failed: %s", + __func__, strerror(errno)); + return -1; + } + if (mount(path, "/tmp", NULL, MS_BIND|MS_REC, NULL)) { + error("%s: /tmp mount failed, %s", + __func__, strerror(errno)); + return -1; + } + + return 0; +} + +static int _mount_private_shm(void) +{ + int rc = 0; + + rc = umount("/dev/shm"); + if (rc && errno != EINVAL) { + error("%s: umount /dev/shm failed: %s\n", + __func__, strerror(errno)); + return rc; + } + rc = mount("tmpfs", "/dev/shm", "tmpfs", 0, NULL); + if (rc) { + error("%s: mounting private /dev/shm failed: %s\n", + __func__, strerror(errno)); + return -1; + } + return rc; +} + +static int _rm_data(const char *path, const struct stat *st_buf, + int type, struct FTW *ftwbuf) +{ + if (remove(path) < 0) { + if (type == FTW_NS) + error("%s: Unreachable file of FTW_NS type: %s", + __func__, path); + if (type == FTW_DNR) + error("%s: Unreadable directory: %s", __func__, path); + error("%s: could not remove path: %s: %s", + __func__, path, strerror(errno)); + return errno; + } + return 0; +} + +extern int container_p_create(uint32_t job_id) +{ + char job_mount[PATH_MAX]; + char ns_holder[PATH_MAX]; + char src_bind[PATH_MAX]; + char active[PATH_MAX]; + char *result = NULL; + int fd; + int rc = 0; + sem_t *sem1 = NULL; + sem_t *sem2 = NULL; + pid_t cpid; + +#ifdef HAVE_NATIVE_CRAY + return 0; +#endif + + if (_create_paths(job_id, job_mount, ns_holder, src_bind, active) + != SLURM_SUCCESS) { + return -1; + } + + rc = mkdir(job_mount, 0700); + if (rc && errno != EEXIST) { + error("%s: mkdir %s failed: %s", + __func__, job_mount, strerror(errno)); + return -1; + } else if (rc && errno == EEXIST) { + /* stat to see if .active exists */ + struct stat st; + rc = stat(active, &st); + if (rc) { + /* + * If .active does not exist, then the directory for + * the job exists but namespace is not active. This + * should not happen normally. Throw error and exit + */ + error("%s: Dir %s exists but %s was not found, exiting", + __func__, job_mount, active); + goto exit2; + } + /* + * If it exists, this is coming from sbcast likely, + * exit as success + */ + rc = 0; + goto exit2; + } + + fd = open(ns_holder, O_CREAT|O_RDWR, S_IRWXU); + if (fd == -1) { + error("%s: open failed %s: %s", + __func__, ns_holder, strerror(errno)); + rc = -1; + goto exit2; + } + close(fd); + + /* run any initialization script- if any*/ + if (ns_conf->initscript) { + result = run_command("initscript", ns_conf->initscript, NULL, + 10000, 0, &rc); + if (rc) { + error("%s: init script: %s failed", + __func__, ns_conf->initscript); + goto exit2; + } else { + debug3("initscript stdout: %s", result); + } + } + + rc = mkdir(src_bind, 0700); + if (rc) { + error("%s: mkdir failed %s, %s", + __func__, src_bind, strerror(errno)); + goto exit2; + } + + sem1 = mmap(NULL, sizeof(*sem1), PROT_READ|PROT_WRITE, + MAP_SHARED|MAP_ANONYMOUS, -1, 0); + if (sem1 == MAP_FAILED) { + error("%s: mmap failed: %s", __func__, strerror(errno)); + rc = -1; + goto exit2; + } + + sem2 = mmap(NULL, sizeof(*sem2), PROT_READ|PROT_WRITE, + MAP_SHARED|MAP_ANONYMOUS, -1, 0); + if (sem2 == MAP_FAILED) { + error("%s: mmap failed: %s", __func__, strerror(errno)); + munmap(sem1, sizeof(*sem1)); + sem_destroy(sem1); + rc = -1; + goto exit2; + } + + rc = sem_init(sem1, 1, 0); + if (rc) { + error("%s: sem_init: %s", __func__, strerror(errno)); + goto exit1; + } + rc = sem_init(sem2, 1, 0); + if (rc) { + error("%s: sem_init: %s", __func__, strerror(errno)); + goto exit1; + } + + cpid = fork(); + + if (cpid == -1) { + error("%s: fork Failed: %s\n", __func__, strerror(errno)); + rc = -1; + goto exit1; + } + + if (cpid == 0) { + rc = unshare(CLONE_NEWNS); + if (rc) { + error("%s: %s", __func__, strerror(errno)); + goto child_exit; + } + if (sem_post(sem1) < 0) { + error("%s: sem_post failed: %s", + __func__, strerror(errno)); + rc = -1; + goto child_exit; + } + if (sem_wait(sem2) < 0) { + error("%s: sem_wait failed %s", + __func__, strerror(errno)); + rc = -1; + goto child_exit; + } + + /* + * Now we have a persistent mount namespace. + * Mount private /tmp inside the namespace. + */ + if (_mount_private_tmp(src_bind) == -1) { + rc = -1; + goto child_exit; + } + /* + * This umount is to remove the basepath mount from being + * visible inside the namespace. So if a user looks up the + * mounts inside the job, they will only see their job mount + * but not the basepath mount. + */ + rc = umount2(ns_conf->basepath, MNT_DETACH); + if (rc) { + error("%s: umount2 failed: %s", + __func__, strerror(errno)); + goto child_exit; + } + child_exit: + munmap(sem1, sizeof(*sem1)); + sem_destroy(sem1); + munmap(sem2, sizeof(*sem2)); + sem_destroy(sem2); + + if (!rc) { + rc = _mount_private_shm(); + if (rc) + error("%s: could not mount private shm", + __func__); + } + exit(rc); + } else { + struct stat sb; + int wstatus; + char proc_path[PATH_MAX]; + + if (sem_wait(sem1) < 0) { + error("%s: sem_Wait failed: %s", + __func__, strerror(errno)); + rc = -1; + goto exit1; + } + + if (snprintf(proc_path, PATH_MAX, "/proc/%u/ns/mnt", cpid) + >= PATH_MAX) { + error("%s: Unable to build job %u /proc path: %m", + __func__, job_id); + rc = -1; + goto exit1; + } + + rc = stat(proc_path, &sb); + if (rc) { + error("%s: stat failed: %s", __func__, strerror(errno)); + if (sem_post(sem2) < 0) + error("%s: Could not release semaphore: %s", + __func__, strerror(errno)); + goto exit1; + } + + /* + * Bind mount /proc/pid/ns/mnt to hold namespace active + * without a process attached to it + */ + rc = mount(proc_path, ns_holder, NULL, MS_BIND, NULL); + if (rc) { + error("%s: ns base mount failed: %s", + __func__, strerror(errno)); + if (sem_post(sem2) < 0) + error("%s: Could not release semaphore: %s", + __func__, strerror(errno)); + goto exit1; + } + if (sem_post(sem2) < 0) { + error("%s: sem_post failed: %s", + __func__, strerror(errno)); + goto exit1; + } + + rc = waitpid(cpid, &wstatus, 0); + if (rc == -1) { + error("%s: waitpid failed", __func__); + goto exit1; + } else { + if (rc == cpid) + debug3("child exited: %d", + WEXITSTATUS(wstatus)); + } + + rc = 0; + } + +exit1: + munmap(sem1, sizeof(*sem1)); + sem_destroy(sem1); + munmap(sem2, sizeof(*sem2)); + sem_destroy(sem2); + +exit2: + if (rc) { + /* cleanup the job mount */ + if (nftw(job_mount, _rm_data, 64, FTW_DEPTH|FTW_PHYS) < 0) { + error("%s: Directory traversal failed: %s: %s", + __func__, job_mount, strerror(errno)); + return SLURM_ERROR; + } + + } + + return rc; +} + +static int _get_fd(uint32_t job_id) +{ + char job_mount[PATH_MAX]; + char ns_holder[PATH_MAX]; + char active[PATH_MAX]; + int fd; + int rc = 0; + struct stat st; + + if (_create_paths(job_id, job_mount, ns_holder, NULL, active) + != SLURM_SUCCESS) { + return -1; + } + + /* assert that namespace is active */ + rc = stat(active, &st); + if (rc) { + /* + * If .active does not exist, then dont pass + * the fd of the namespace. It means perhaps + * namespace may not have been fully set up when + * the request for the fd came in. + */ + debug("%s not found, namespace cannot be joined", active); + return -1; + } + + fd = open(ns_holder, O_RDONLY); + if (fd == -1) { + error("%s: %s", __func__, strerror(errno)); + return -1; + } + + return fd; +} + +/* Add a process to a job container, create the proctrack container to add */ +extern int container_p_join_external(uint32_t job_id) +{ + return _get_fd(job_id); +} + +/* Add proctrack container (PAGG) to a job container */ +extern int container_p_add_cont(uint32_t job_id, uint64_t cont_id) +{ + return SLURM_SUCCESS; +} + +/* Call getpid() inside it */ +/* Add a process to a job container, create the proctrack container to add */ +extern int container_p_join(uint32_t job_id, uid_t uid) +{ + char job_mount[PATH_MAX]; + char ns_holder[PATH_MAX]; + char src_bind[PATH_MAX]; + char active[PATH_MAX]; + int fd; + int rc = 0; + +#ifdef HAVE_NATIVE_CRAY + return SLURM_SUCCESS; +#endif + + /* + * Jobid 0 means we are not a real job, but a script running instead we + * do not need to handle this request. + */ + if (job_id == 0) + return SLURM_SUCCESS; + + if (_create_paths(job_id, job_mount, ns_holder, src_bind, active) + != SLURM_SUCCESS) { + return SLURM_ERROR; + } + + rc = chown(src_bind, uid, -1); + if (rc) { + error("%s: chown failed for %s: %s", + __func__, src_bind, strerror(errno)); + return SLURM_ERROR; + } + + fd = open(ns_holder, O_RDONLY); + if (fd == -1) { + error("%s: open failed for %s: %s", + __func__, ns_holder, strerror(errno)); + return SLURM_ERROR; + } + + rc = setns(fd, CLONE_NEWNS); + if (rc) { + error("%s: setns failed for %s: %s", + __func__, ns_holder, strerror(errno)); + return SLURM_ERROR; + } else { + struct stat st; + if (stat(active, &st)) { + /* touch .active to imply namespace is active */ + int fp = 0; + fp = open(active, O_CREAT|O_RDWR, S_IRWXU); + if (fp == -1) { + error("%s: open failed %s: %s", + __func__, active, strerror(errno)); + return SLURM_ERROR; + } + } + debug3("job entered namespace"); + } + + return SLURM_SUCCESS; +} + +extern int container_p_delete(uint32_t job_id) +{ + char job_mount[PATH_MAX]; + char ns_holder[PATH_MAX]; + int rc = 0; + struct stat st; + +#ifdef HAVE_NATIVE_CRAY + return SLURM_SUCCESS; +#endif + + if (_create_paths(job_id, job_mount, ns_holder, NULL, NULL) + != SLURM_SUCCESS) { + return SLURM_ERROR; + } + + if (stat(job_mount, &st)) { + error("%s: Job mount not found", __func__); + return SLURM_ERROR; + } + + ns_conf = get_slurm_ns_conf(); + if (!ns_conf) { + error("%s: Configuration not loaded", __func__); + return SLURM_ERROR; + } + + errno = 0; + rc = umount2(ns_holder, MNT_DETACH); + if (rc) { + error("%s: umount2 %s failed: %s", + __func__, ns_holder, strerror(errno)); + return SLURM_ERROR; + } + + /* + * Traverses the job directory, and delete all files. + * Doesn't - + * traverse filesystem boundaries, + * follow symbolic links + * Does - + * a post order traversal and delete directory after processing + * contents + */ + if (nftw(job_mount, _rm_data, 64, FTW_DEPTH|FTW_PHYS) < 0) { + error("%s: Directory traversal failed: %s: %s", + __func__, job_mount, strerror(errno)); + return SLURM_ERROR; + } + + return SLURM_SUCCESS; +} diff --git a/src/plugins/job_container/tmpfs/read_nsconf.c b/src/plugins/job_container/tmpfs/read_nsconf.c new file mode 100644 index 00000000000..3bda6f6875a --- /dev/null +++ b/src/plugins/job_container/tmpfs/read_nsconf.c @@ -0,0 +1,163 @@ +/*****************************************************************************\ + * read_nsconf.c - parse namespace.conf configuration file. + ***************************************************************************** + * Copyright (C) 2019-2021 Regents of the University of California + * Produced at Lawrence Berkeley National Laboratory + * Written by Aditi Gaur <agaur@lbl.gov> + * All rights reserved. + * + * This file is part of SLURM, a resource management program. + * For details, see <https://slurm.schedmd.com/>. + * Please also read the included file: DISCLAIMER. + * + * SLURM is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * In addition, as a special exception, the copyright holders give permission + * to link the code of portions of this program with the OpenSSL library under + * certain conditions as described in each individual source file, and + * distribute linked combinations including the two. You must obey the GNU + * General Public License in all respects for all of the code used other than + * OpenSSL. If you modify file(s) with this exception, you may extend this + * exception to your version of the file(s), but you are not obligated to do + * so. If you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files in + * the program, then also delete it here. + * + * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with SLURM; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +\*****************************************************************************/ +#include <unistd.h> +#include <sys/stat.h> + +#include "slurm/slurm_errno.h" + +#include "src/common/xstring.h" +#include "src/common/log.h" +#include "src/common/parse_config.h" +#include "src/common/read_config.h" +#include "src/common/xmalloc.h" + +#include "read_nsconf.h" + +static slurm_ns_conf_t slurm_ns_conf; +static bool slurm_ns_conf_inited = false; + +static int _read_slurm_ns_conf(void) +{ + char *conf_path = NULL; + s_p_hashtbl_t **node_tbl = NULL; + s_p_hashtbl_t *node = NULL; + s_p_hashtbl_t *tbl = NULL; + struct stat buf; + int node_count; + char *nodename = NULL; + char *basepath = NULL; + char *initscript = NULL; + int rc = SLURM_SUCCESS; + int i; + s_p_options_t node_options[] = { + {"NodeName", S_P_STRING}, + {"BasePath", S_P_PLAIN_STRING}, + {"InitScript", S_P_PLAIN_STRING}, + {NULL} + }; + + s_p_options_t options[] = { + {"NodeName", S_P_EXPLINE, NULL, NULL, node_options}, + {NULL} + }; + + xassert(conf->node_name); + + conf_path = get_extra_conf_path("namespace.conf"); + + if ((!conf_path) || (stat(conf_path, &buf) == -1)) { + error("No namespace.conf file"); + return ENOENT; + } + debug("Reading namespace.conf file %s", conf_path); + tbl = s_p_hashtbl_create(options); + if (s_p_parse_file(tbl, NULL, conf_path, false) == SLURM_ERROR) { + fatal("Could not open/read/parse namespace.conf file %s", + conf_path); + return SLURM_ERROR; + } + + if (!s_p_get_expline(&node_tbl, &node_count, "NodeName", tbl)) { + error("Could not parse namespace.conf file %s", conf_path); + return SLURM_ERROR; + } + for (i = 0; i < node_count; i++) { + node = node_tbl[i]; + if (!s_p_get_string(&nodename, "NodeName", node)) { + error("empty nodename detected, please verify namespace.conf is correct"); + rc = SLURM_ERROR; + xfree(nodename); + continue; + } + + if (xstrcmp(nodename, conf->node_name)) { + xfree(nodename); + continue; + } + + if (!s_p_get_string(&basepath, "BasePath", node)) { + error("empty basepath detected, please verify namespace.conf is correct"); + rc = SLURM_ERROR; + xfree(basepath); + break; + } + slurm_ns_conf.basepath = basepath; + + if (!s_p_get_string(&initscript, "InitScript", node)) { + debug3("empty init script detected"); + xfree(initscript); + slurm_ns_conf.initscript = NULL; + } else { + slurm_ns_conf.initscript = initscript; + } + xfree(nodename); + break; + } + + if (!slurm_ns_conf.basepath) { + error("Configuration for this node not found in namespace.conf"); + rc = SLURM_ERROR; + } + s_p_hashtbl_destroy(tbl); + xfree(conf_path); + + return rc; +} + +extern slurm_ns_conf_t *get_slurm_ns_conf(void) +{ + int rc; + if (!slurm_ns_conf_inited) { + memset(&slurm_ns_conf, 0, sizeof(slurm_ns_conf_t)); + rc = _read_slurm_ns_conf(); + if (rc == SLURM_ERROR) + return NULL; + slurm_ns_conf_inited = true; + } + + return &slurm_ns_conf; +} + +extern void free_ns_conf(void) +{ + if (slurm_ns_conf_inited) { + xfree(slurm_ns_conf.basepath); + xfree(slurm_ns_conf.initscript); + } + return; +} diff --git a/src/plugins/job_container/tmpfs/read_nsconf.h b/src/plugins/job_container/tmpfs/read_nsconf.h new file mode 100644 index 00000000000..08a5a07e54d --- /dev/null +++ b/src/plugins/job_container/tmpfs/read_nsconf.h @@ -0,0 +1,56 @@ +/*****************************************************************************\ + * read_nsconf.h - parse namespace.conf configuration file. + ***************************************************************************** + * Copyright (C) 2019-2021 Regents of the University of California + * Produced at Lawrence Berkeley National Laboratory + * Written by Aditi Gaur <agaur@lbl.gov> + * All rights reserved. + * + * This file is part of SLURM, a resource management program. + * For details, see <https://slurm.schedmd.com/>. + * Please also read the included file: DISCLAIMER. + * + * SLURM is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * In addition, as a special exception, the copyright holders give permission + * to link the code of portions of this program with the OpenSSL library under + * certain conditions as described in each individual source file, and + * distribute linked combinations including the two. You must obey the GNU + * General Public License in all respects for all of the code used other than + * OpenSSL. If you modify file(s) with this exception, you may extend this + * exception to your version of the file(s), but you are not obligated to do + * so. If you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files in + * the program, then also delete it here. + * + * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with SLURM; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +\*****************************************************************************/ +#ifndef _READ_NSCONF_H +#define _READ_NSCONF_H + +#include "src/slurmd/slurmd/slurmd.h" + +/* + * Slurm namespace job container plugin initialization + * parameters + */ +typedef struct slurm_ns_conf { + char *basepath; + char *initscript; +} slurm_ns_conf_t; + +extern slurm_ns_conf_t *get_slurm_ns_conf(void); + +extern void free_ns_conf(void); + +#endif diff --git a/src/slurmd/slurmstepd/mgr.c b/src/slurmd/slurmstepd/mgr.c index 62070f83f82..e4235fadfa8 100644 --- a/src/slurmd/slurmstepd/mgr.c +++ b/src/slurmd/slurmstepd/mgr.c @@ -1418,14 +1418,52 @@ fail1: static int _pre_task_child_privileged( stepd_step_rec_t *job, int taskid, struct priv_state *sp) { + int setwd = 0; /* set working dir */ + int rc = 0; + if (_reclaim_privileges(sp) < 0) return SLURM_ERROR; +#ifndef HAVE_NATIVE_CRAY + /* Add job's pid to job container */ + + if (container_g_join(job->step_id.job_id, job->uid)) { + error("container_g_join failed: %u", job->step_id.job_id); + exit(1); + } + + /* + * tmpfs job container plugin changes the working directory + * back to root working directory, so change it back to users + * but after dropping privillege + */ + setwd = 1; +#endif + if (spank_task_privileged(job, taskid) < 0) return error("spank_task_init_privileged failed"); /* sp->gid_list should already be initialized */ - return (_drop_privileges(job, true, sp, false)); + rc = _drop_privileges(job, true, sp, false); + if (rc) { + error ("_drop_privileges: %m"); + return rc; + } + + if (setwd) { + if (chdir(job->cwd) < 0) { + error("couldn't chdir to `%s': %m: going to /tmp instead", + job->cwd); + if (chdir("/tmp") < 0) { + error("couldn't chdir to /tmp either. dying."); + return SLURM_ERROR; + } + } + + } + + return rc; + } struct exec_wait_info { @@ -1769,6 +1807,7 @@ _fork_all_tasks(stepd_step_rec_t *job, bool *io_initialized) if (_pre_task_child_privileged(job, i, &sprivs) < 0) _exit(1); + if (_become_user(job, &sprivs) < 0) { error("_become_user failed: %m"); /* child process, should not return */ -- GitLab