From f8f9b01d978f86b94b675712ca7d5beeca7c08b5 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Fri, 18 Feb 2022 12:07:56 +0100 Subject: [PATCH] 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 Change-Id: Ic859444769d1bfe18cf02bdd23cbef56407289a7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11670 Tested-by: SPDK CI Jenkins Reviewed-by: Pawel Piatek Reviewed-by: Jim Harris Reviewed-by: Dong Yi Reviewed-by: Tomasz Zawadzki Community-CI: Broadcom CI --- test/scheduler/cgroups.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/scheduler/cgroups.sh b/test/scheduler/cgroups.sh index 8a3ebbf5ae..68bc3230dd 100644 --- a/test/scheduler/cgroups.sh +++ b/test/scheduler/cgroups.sh @@ -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