test/scheduler: Skip process if reading from /proc/pid/cgroup fails

This may happen when given process terminates right after we checked
for existance of the pid/cgroup but before we attempt to read the
file. When read fails, simply skip that process and continue.

Fixes issue #2381

Signed-off-by: Michal Berger <michallinuxstuff@gmail.com>
Change-Id: Ic859444769d1bfe18cf02bdd23cbef56407289a7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11670
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
Michal Berger 2022-02-18 12:07:56 +01:00 committed by Tomasz Zawadzki
parent 0957856db3
commit f8f9b01d97

View File

@ -26,11 +26,11 @@ init_cpuset_cgroup() {
# v1, move all the threads from all the existing cgroups to the top
# cgroup / and then migrate it to the /cpuset we created above.
for cgroup in /proc/+([0-9])/cgroup; do
[[ -e $cgroup ]] || continue
cgroup=$(< "$cgroup") cgroup=${cgroup##*:}
cgroup=$(< "$cgroup") || continue
cgroup=${cgroup##*:}
[[ $cgroup != / ]] || continue
move_cgroup_procs "${cgroup##*:}" /
done
done 2> /dev/null
# Now, move all the threads to the cpuset
move_cgroup_procs / /cpuset
elif ((cgroup_version == 1)); then