1#!/bin/sh 2 3# 4# Copyright (c) 2024 Peter Holm <pho@FreeBSD.org> 5# 6# SPDX-License-Identifier: BSD-2-Clause 7# 8 9# Copy from nullfs over zfs to nullfs over ufs 10# Test scenario description by: mjguzik 11 12# Page fault seen: 13# https://people.freebsd.org/~pho/stress/log/log0498.txt 14 15[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 16[ `sysctl -n kern.kstack_pages` -lt 4 ] && exit 0 17 18. ../default.cfg 19 20set -u 21kldstat -v | grep -q zfs.ko || { kldload zfs.ko || 22 exit 0; loaded=1; } 23 24u1=$mdstart 25u2=$((u1 + 1)) 26u3=$((u2 + 1)) 27mp0=/stress2_tank/test # zfs mount 28mp1=$mntpoint # nullfs of zfs 29mp2=$mntpoint$mdstart # ufs 30mp3=$mntpoint$((mdstart + 1)) # nullfs of ufs 31mkdir -p $mp2 $mp3 32 33mdconfig -l | grep -q md$u1 && mdconfig -d -u $u1 34mdconfig -l | grep -q md$u2 && mdconfig -d -u $u2 35 36mdconfig -s 2g -u $u1 37mdconfig -s 2g -u $u2 38 39zpool list | egrep -q "^stress2_tank" && zpool destroy stress2_tank 40[ -d /stress2_tank ] && rm -rf /stress2_tank 41zpool create stress2_tank raidz md$u1 md$u2 42zfs create ${mp0#/} 43 44mount | grep -q $mp1 && umount -f $mp1 45mount -t nullfs $mp0 $mp1 46 47mdconfig -a -t swap -s 1g -u $u3 48newfs $newfs_flags /dev/md$u3 > /dev/null 49mount /dev/md$u3 $mp2 50mount -t nullfs $mp2 $mp3 51 52dd if=/dev/zero of=$diskimage bs=1m count=50 status=none 53cp $diskimage $mp1 54cp $mp1/diskimage $mp3 55rm -f $diskimage 56 57umount $mp3 58umount $mp2 59mdconfig -d -u $u3 60 61while mount | grep -q "on $mntpoint "; do 62 umount $mntpoint && break 63 sleep 1 64done 65 66zfs umount ${mp0#/} 67zfs destroy -r stress2_tank 68zpool destroy stress2_tank 69 70mdconfig -d -u $u2 71mdconfig -d -u $u1 72set +u 73[ -n "$loaded" ] && kldunload zfs.ko 74exit 0 75