DragonFlyBSD Kernel Audit
DF-2620 / fixC.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-2620 FIX VALIDATION -- variant C on the patched kernel.
# Same trigger as trigger_C.sh: same-clid MASTER+SLAVE merge (nmasters=1
# < nchains=2), umount -f, then remount + activity.
# PASS criteria: umount returns 0; no hammer2 thread left alive after
# umount (no zombies); no panic during umount or the reclaim phase.
LOG=/root/poc/df2620/fixC_run.log
exec > $LOG 2>&1
set -x

vnconfig -u vn0 2>/dev/null
vnconfig -u vn1 2>/dev/null
vnconfig -c vn0 /root/poc/df2620/base.img
vnconfig -c vn1 /root/poc/df2620/C.img
mkdir -p /mnt/h2 /mnt/h2b

echo "=== 1. mount MASTER ==="
mount -t hammer2 -o ro /dev/vn0@testvol /mnt/h2
echo MOUNT1_RC=$?
echo -n "T1="; ps axlw | grep -c "h2xop-testvol"

echo "=== 2. same-clid merge via second device (EBUSY expected) ==="
mount -t hammer2 -o ro /dev/vn1@testvol /mnt/h2b
echo "MOUNT2_RC=$?"
echo -n "T2="; ps axlw | grep -c "h2xop-testvol"

echo "=== 3. umount -f ==="
date
umount -f /mnt/h2
echo UMOUNT_RC=$?
date
echo -n "T3(expect 1 = no zombies, just grep): "; ps axlw | grep -c "h2xop-testvol"

echo "=== 4. reclaim + activity ==="
mount -t hammer2 -o ro /dev/vn0@testvol /mnt/h2b
echo MOUNT3_RC=$?
i=0
while [ $i -lt 30 ]; do
	ls -la /mnt/h2b >/dev/null 2>&1
	echo -n "loop$i rc=$? t="; ps axlw | grep -c "h2xop-testvol"
	i=$((i+1))
	sleep 1
done
umount /mnt/h2b
echo FINAL_UMOUNT_RC=$?
echo FIX_C_DONE