Path: blob/main/tools/test/stress2/misc/backingstore3.sh
39536 views
#!/bin/sh12#3# Copyright (c) 2009 Peter Holm <[email protected]>4# All rights reserved.5#6# Redistribution and use in source and binary forms, with or without7# modification, are permitted provided that the following conditions8# are met:9# 1. Redistributions of source code must retain the above copyright10# notice, this list of conditions and the following disclaimer.11# 2. Redistributions in binary form must reproduce the above copyright12# notice, this list of conditions and the following disclaimer in the13# documentation and/or other materials provided with the distribution.14#15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25# SUCH DAMAGE.26#2728# Test unmount of a device that is already gone2930# Caused "panic: bundirty: buffer 0xdafaf2c4 still on queue 1"3132[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 13334. ../default.cfg3536D=$diskimage37export here=`pwd`3839m1=$mdstart40m2=$((m1 + 1))41mount | grep "$mntpoint" | grep -q md$m2 && umount $mntpoint$m242mdconfig -l | grep -q md$m2 && mdconfig -d -u $m243mount | grep "$mntpoint" | grep -q md$m1 && umount $mntpoint$m144mdconfig -l | grep -q md$m1 && mdconfig -d -u $m145[ -d $mntpoint$m1 ] || mkdir -p $mntpoint$m146[ -d $mntpoint$m2 ] || mkdir -p $mntpoint$m24748dd if=/dev=zero of=$D$m bs=25m count=1 status=none || exit 14950mdconfig -a -t vnode -f $D$m1 -u $m15152newfs md$m1 > /dev/null 2>&153mount /dev/md$m1 $mntpoint$m15455truncate -s 500M $mntpoint$m1/diskimage56mdconfig -a -t vnode -f $mntpoint$m1/diskimage -u $m25758newfs md$m2 > /dev/null 2>&159mount /dev/md$m2 $mntpoint$m26061dd if=/dev/zero of=$mntpoint$m2/file bs=1m > /dev/null 2>&16263# Reversed umount sequence:64umount -f /dev/md$m165umount -f /dev/md$m26667mount | grep "$mntpoint" | grep -q md$m2 && umount $mntpoint$m268mdconfig -l | grep -q md$m2 && mdconfig -d -u $m269mount | grep "$mntpoint" | grep -q md$m1 && umount $mntpoint$m170mdconfig -l | grep -q md$m1 && mdconfig -d -u $m1717273