criu/test/zdtm/static/mnt_ext_sharing.hook
Pavel Tikhomirov 486e1fd854 zdtm: add new mnt_ext_sharing test for mount-v2
These test simply checks that sharing between two mounts in container:
1) external mount and 2) it's bind persists (case when bind has the same
mountpoint).

Note: on old mount engine mounts inside container become also shared
with mount in criu mount namespace (outside container) after c/r which
is not right.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/76a09e850

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
2022-04-28 17:53:52 -07:00

27 lines
673 B
Bash
Executable file

#!/bin/bash
[ "$1" == "--clean" ] || exit 0
function err {
echo "$1"
exit 1
}
# Check shared ids don't match in criu mntns and test mntns
OUT="zdtm/static/mnt_ext_sharing.out"
[ -f "$OUT" ] || err "No $OUT file"
SHID=$(cat $OUT | grep internal_shared_id | awk '{print $5}')
[ -z "$SHID" ] && err "Failed to get shared id from file"
MATCH=$(cat /proc/self/mountinfo | grep "\<shared:$SHID\>.* - tmpfs zdtm_ext_sharing.internal")
[ -z "$MATCH" ] || err "Can lookup internal shared id $SHID in criu mntns"
TMP="/tmp/zdtm_ext_sharing.tmp"
echo "Cleanup mnt_ext_sharing"
umount "$TMP/internal"
umount "$TMP"
rm -rf $TMP
rm -rf "mnt_ext_sharing.test"
exit 0