Hi devs,

You can find attached 2 patches for the example of cgroup release agent script etc/cgroup.release_common.example.in.

- cgroup_release_script_path_conf_miss_subsys.diff

  Append subsystem name to cgroup mountpoint path extracted from
  configuration file cgroup.conf. Without this patch, the script does
  not execute properly and some garbage is let in cgroup filesystems.

- cgroup_release_script_vars_cleanup.diff

  Not a bug but a cosmetic patch to avoid double definition of variable
  rmcg and uidcg.

I hope you're interested!

Regards,
--
R�mi Palancher
<[email protected]>
diff --git a/etc/cgroup.release_common.example.in b/etc/cgroup.release_common.example.in
index 8c1bfdd..d82ba88 100644
--- a/etc/cgroup.release_common.example.in
+++ b/etc/cgroup.release_common.example.in
@@ -23,7 +23,7 @@ get_mount_dir()
         $lssubsys -m $subsystem | awk '{print $2}'
     else
         if [ -f @sysconfdir@/cgroup.conf ]; then
-            grep -i "^CgroupMountpoint=" @sysconfdir@/cgroup.conf | sed s/.*=// | head -n 1
+            grep -i "^CgroupMountpoint=" @sysconfdir@/cgroup.conf | sed "s/.*=\(.*\)/\1\/${subsystem}/" | head -n 1
         else
             echo "/cgroup/$subsystem"
         fi
diff --git a/etc/cgroup.release_common.example.in b/etc/cgroup.release_common.example.in
index d82ba88..f2a82f7 100644
--- a/etc/cgroup.release_common.example.in
+++ b/etc/cgroup.release_common.example.in
@@ -69,15 +69,14 @@ then
     esac
 fi
 
+# try to extract the uid cgroup from the input one
+# ( extract /uid_% from /uid%/job_*...)
+uidcg=${rmcg%/job_*}
+
 # kernel call
 if [[ $# -eq 1 ]]
 then
 
-    rmcg=${mountdir}$@
-
-    # try to extract the uid cgroup from the input one
-    # ( extract /uid_% from /uid%/job_*...)
-    uidcg=${rmcg%/job_*}
     if [[ ${uidcg} == ${rmcg} ]]
     then
 	# not a slurm job pattern, perhaps the uidcg, just remove
@@ -98,10 +97,6 @@ then
 elif [[ $# -eq 2 ]] && [[ $1 == "sync" ]]
 then
 
-    shift
-    rmcg=${mountdir}$@
-    uidcg=${rmcg%/job_*}
-
     # remove this cgroup
     if [[ -d ${rmcg} ]]
     then

Reply via email to