1#!/bin/sh 2# 3# Copyright (c) 2008 Peter Holm <pho@FreeBSD.org> 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# 27 28# Mount regression test 29 30# panic: vm_fault: fault on nofault entry, addr: deadc000 31# cpuid = 1 32# KDB: enter: panic 33# [thread pid 69453 tid 100388 ] 34# Stopped at kdb_enter+0x2b: nop 35# db> where 36# Tracing pid 69453 tid 100388 td 0xc4b5c1b0 37# kdb_enter(c091d9db) at kdb_enter+0x2b 38# panic(c0938fa0,deadc000,e6b44834,c06c650e,c0a57d20,...) at panic+0x14b 39# vm_fault(c1869000,deadc000,1,0) at vm_fault+0x1e0 40# trap_pfault(e6b4499c,0,deadc112) at trap_pfault+0x137 41# trap(8,c0910028,28,deadc0de,deadc0de,...) at trap+0x3f5 42# calltrap() at calltrap+0x5 43# --- trap 0xc, eip = 0xc0667def, esp = 0xe6b449dc, ebp = 0xe6b44a00 --- 44# g_io_request(c66d6bdc,c4a1d840,d7c99940,d7c99940,e6b44a34,...) at g_io_request+0x5f 45# g_vfs_strategy(c40624c4,d7c99940,d7c99940,0,c4e16dec,...) at g_vfs_strategy+0x49 46# ffs_geom_strategy(c40624c4,d7c99940,4ba0,0,c09dad00,...) at ffs_geom_strategy+0x141 47# ufs_strategy(e6b44a7c) at ufs_strategy+0xb5 48# VOP_STRATEGY_APV(c09da7c0,e6b44a7c) at VOP_STRATEGY_APV+0x95 49# bufstrategy(c50d2be0,d7c99940) at bufstrategy+0x55 50# breadn(c50d2b2c,0,0,1000,0,...) at breadn+0xf7 51# bread(c50d2b2c,0,0,1000,0,...) at bread+0x20 52# ffs_read(e6b44bb0) at ffs_read+0x23f 53# VOP_READ_APV(c09da7c0,e6b44bb0) at VOP_READ_APV+0x7e 54# ufs_readdir(e6b44c38) at ufs_readdir+0xd1 55# VOP_READDIR_APV(c09da7c0,e6b44c38) at VOP_READDIR_APV+0x7e 56# getdirentries(c4b5c1b0,e6b44d04) at getdirentries+0x13f 57# syscall(3b,3b,3b,8240160,1,...) at syscall+0x256 58 59[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 60 61. ../default.cfg 62 63mount | grep -q "$mntpoint" && umount $mntpoint 64mdconfig -l | grep -q $mdstart && mdconfig -d -u $mdstart 65 66mdconfig -a -t swap -s 1g -u $mdstart 67bsdlabel -w md$mdstart auto 68 69newfs $newfs_flags md${mdstart}$part > /dev/null 70 71# The test: 72 73echo "Expect: mount: /dev/md5a: Device busy" 74mount -r /dev/md${mdstart}$part $mntpoint 75mount -r /dev/md${mdstart}$part $mntpoint 76umount $mntpoint 77 78ls -lR $mntpoint > /dev/null # panic 79 80# End of test 81mount | grep -q "$mntpoint" && umount $mntpoint 82mdconfig -l | grep -q $mdstart && mdconfig -d -u $mdstart 83