mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-23 18:19:39 +00:00
To mimic the environment that systemd is in when it causes the problem, we preserve a prefix cgroup path across checkpoint and restore which the tasks live below, and then we open a fd to this path. Without --cgroup-root /prefix on dump, this test fails: (00.030429) 32: Error (criu/files-reg.c:1487): File home/ubuntu/criu/test/zdtm/static/cgroup02.test/zdtmtst/prefix has bad mode 040600 (expect 040777) Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
32 lines
565 B
Bash
Executable file
32 lines
565 B
Bash
Executable file
#!/bin/bash
|
|
|
|
[ "$1" == "--clean" -o "$1" == "--pre-restore" ] || exit 0
|
|
|
|
set -e
|
|
|
|
rmroots() {
|
|
echo "Cleaning $tname ($1)"
|
|
|
|
mount -t cgroup none $tname -o "$1"
|
|
|
|
for d in "$tname/prefix" "$tname/newroot"; do
|
|
test -d "$d" || continue
|
|
# sort by line length
|
|
for i in `find $d -type d | awk '{print length, $0}' | sort -rn | cut -d " " -f2-`; do
|
|
echo $i
|
|
rmdir $i
|
|
done
|
|
done
|
|
|
|
echo "Left there is:"
|
|
ls "$tname"
|
|
umount "$tname"
|
|
}
|
|
|
|
tname=$(mktemp -d cgclean.XXXXXX)
|
|
|
|
for ctl in $(cat /proc/self/cgroup | cut -d: -f2); do
|
|
rmroots "$ctl"
|
|
done
|
|
|
|
rmdir $tname
|