mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 05:18:00 +00:00
zdtm: don't call mount_cgroups a few times concurrently
Here is a race now: ./zdtm.sh --ct -d -C -x static/cgroup02 ns/static/pipe02 &> ns_static_pipe02.log || \ { flock Makefile cat ns_static_pipe02.log; exit 1; } ./zdtm.sh --ct -d -C -x static/cgroup02 ns/static/busyloop00 &> ns_static_busyloop00.log || \ { flock Makefile cat ns_static_busyloop00.log; exit 1; } make[3]: `zdtm_ct' is up to date. mkdir: cannot create directory ‘zdtm.GgIjUS/holder’: File exists Reported-by: Mr Jenkins Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
248fc31531
commit
eda6b3d002
@ -42,7 +42,10 @@ clean:
|
||||
$(Q) $(MAKE) -C libcriu clean
|
||||
$(Q) $(MAKE) -C rpc clean
|
||||
|
||||
$(TST): zdtm_ct
|
||||
mount_cgroups: .FORCE
|
||||
flock zdtm_mount_cgroups ./zdtm_mount_cgroups
|
||||
|
||||
$(TST): zdtm_ct mount_cgroups .FORCE
|
||||
./zdtm.sh --ct ${ZDTM_ARGS} $(@) &> $(subst /,_,$@).log || \
|
||||
{ flock Makefile cat $(subst /,_,$@).log; exit 1; }
|
||||
.PHONY: zdtm_ns
|
||||
|
18
test/zdtm.sh
18
test/zdtm.sh
@ -318,23 +318,6 @@ exit_callback()
|
||||
}
|
||||
trap exit_callback EXIT
|
||||
|
||||
# If a controller is mounted during dumping processes, criu may fail with error:
|
||||
# Error (cgroup.c:768): cg: Set 3 is not subset of 2
|
||||
# so lets mount all test controllers before executing tests.
|
||||
mount_cgroups()
|
||||
{
|
||||
cat /proc/self/cgroup | grep zdtmtst.defaultroot && return
|
||||
local tdir
|
||||
tdir=`mktemp -d zdtm.XXXXXX`
|
||||
for i in "zdtmtst" "zdtmtst.defaultroot"; do
|
||||
mount -t cgroup -o none,name=$i zdtm $tdir &&
|
||||
# a fake group prevents destroying of a controller
|
||||
mkdir $tdir/holder &&
|
||||
umount $tdir || return 1
|
||||
done
|
||||
rmdir $tdir
|
||||
}
|
||||
|
||||
construct_root()
|
||||
{
|
||||
local root=$1
|
||||
@ -923,7 +906,6 @@ while :; do
|
||||
# mntns is used to mount /proc
|
||||
# net is used to avoid conflicts of parasite sockets
|
||||
make zdtm_ct &&
|
||||
mount_cgroups &&
|
||||
./zdtm_ct ./zdtm.sh "$@"
|
||||
exit
|
||||
}
|
||||
|
16
test/zdtm_mount_cgroups
Executable file
16
test/zdtm_mount_cgroups
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# If a controller is created during dumping processes, criu may fail with error:
|
||||
# Error (cgroup.c:768): cg: Set 3 is not subset of 2
|
||||
# so lets create all test controllers before executing tests.
|
||||
|
||||
cat /proc/self/cgroup | grep zdtmtst.defaultroot && exit
|
||||
|
||||
tdir=`mktemp -d zdtm.XXXXXX`
|
||||
for i in "zdtmtst" "zdtmtst.defaultroot"; do
|
||||
mount -t cgroup -o none,name=$i zdtm $tdir &&
|
||||
# a fake group prevents destroying of a controller
|
||||
mkdir $tdir/holder &&
|
||||
umount $tdir || exit 1
|
||||
done
|
||||
rmdir $tdir
|
Loading…
x
Reference in New Issue
Block a user