Commit aabba6b2 authored by Gabriel Guimaraes's avatar Gabriel Guimaraes Committed by Pavel Emelyanov

Adding overlay-bug test

This test checks that the OverlayFS fixup for CRIU works correctly
by dumping and restoring a process that has an open file in an
OverlayFS mounted directory. This should work no matter if the
Kernel has the OverlayFS bug or not.
Signed-off-by: 's avatarGabriel Guimaraes <gabriellimaguimaraes@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent dbaab31f
...@@ -13,7 +13,7 @@ all: ...@@ -13,7 +13,7 @@ all:
.PHONY: all .PHONY: all
TESTS = unix-callback mem-snap rpc libcriu mounts/ext security pipes crit socketpairs TESTS = unix-callback mem-snap rpc libcriu mounts/ext security pipes crit socketpairs overlayfs
other: .FORCE other: .FORCE
for t in $(TESTS); do \ for t in $(TESTS); do \
......
run:
./run.sh
clean:
umount -f overlay_test/z
rm -rf overlay_test
#!/bin/bash
set -eu
CRIU=../../../criu
setup() {
setup_mount
sleep 10 3>z/file &
PROC_PID=$!
echo "PROC_PID=$PROC_PID"
sleep 1
}
setup_mount() {
mkdir -p overlay_test
cd overlay_test
mkdir -p a b c z checkpoint
mount -t overlay -o lowerdir=a,upperdir=b,workdir=c overlayfs z
}
check_criu() {
echo "Dumping $PROC_PID..."
if ! $CRIU dump -D checkpoint --shell-job -t "${PROC_PID}"; then
echo "ERROR! dump failed"
return 1
fi
echo "Restoring..."
if ! $CRIU restore -d -D checkpoint --shell-job; then
echo "ERROR! restore failed"
return 1
fi
return 0
}
cleanup() {
kill -INT "${PROC_PID}" > /dev/null 2>&1
umount z
cd "${ORIG_WD}"
rm -rf overlay_test
}
main() {
ORIG_WD=$(pwd)
setup
check_criu || {
cleanup
exit 1
}
cleanup
echo "OverlayFS C/R successful."
exit 0
}
main
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment