#!/bin/sh
# DF-2831 reproduction (guest, root). Stock kernel: expect ok_WRONG_SIZE>0.
# Fix kernel (fix.diff applied + nativekernel + reboot): expect ok_WRONG_SIZE=0
# with clean ENXIO failures under the hammer, and 2000/2000 with no hammer.
set -e
cd /root/df2831
vnconfig -c /dev/vn0 /root/df2831/df2831.img
sleep 2
ls /dev/vn0s1a

echo "=== control: no hammer ==="
./poc2831 /dev/vn0 /dev/vn0s1a 2000 0

echo "=== race: swapon vs forced reprobes ==="
./poc2831b /dev/vn0 /dev/vn0s1a /dev/vn1 /dev/vn1s1a 2000 0
./poc2831b /dev/vn0 /dev/vn0s1a /dev/vn1 /dev/vn1s1a 2000 0

vnconfig -u /dev/vn0
