17c455ce2SPeter Holm#!/bin/sh 27c455ce2SPeter Holm 37c455ce2SPeter Holm# 4*4d846d26SWarner Losh# SPDX-License-Identifier: BSD-2-Clause 57c455ce2SPeter Holm# 67c455ce2SPeter Holm# Copyright (c) 2022 Peter Holm <pho@FreeBSD.org> 77c455ce2SPeter Holm# 87c455ce2SPeter Holm# Redistribution and use in source and binary forms, with or without 97c455ce2SPeter Holm# modification, are permitted provided that the following conditions 107c455ce2SPeter Holm# are met: 117c455ce2SPeter Holm# 1. Redistributions of source code must retain the above copyright 127c455ce2SPeter Holm# notice, this list of conditions and the following disclaimer. 137c455ce2SPeter Holm# 2. Redistributions in binary form must reproduce the above copyright 147c455ce2SPeter Holm# notice, this list of conditions and the following disclaimer in the 157c455ce2SPeter Holm# documentation and/or other materials provided with the distribution. 167c455ce2SPeter Holm# 177c455ce2SPeter Holm# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 187c455ce2SPeter Holm# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 197c455ce2SPeter Holm# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 207c455ce2SPeter Holm# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 217c455ce2SPeter Holm# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 227c455ce2SPeter Holm# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 237c455ce2SPeter Holm# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 247c455ce2SPeter Holm# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 257c455ce2SPeter Holm# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 267c455ce2SPeter Holm# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 277c455ce2SPeter Holm# SUCH DAMAGE. 287c455ce2SPeter Holm# 297c455ce2SPeter Holm 307c455ce2SPeter Holm# rename() livelock seen with a forced unmount of a FS 317c455ce2SPeter Holm# https://people.freebsd.org/~pho/stress/log/log0375.txt 327c455ce2SPeter Holm 337c455ce2SPeter Holm[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 347c455ce2SPeter Holm. ../default.cfg 357c455ce2SPeter Holmecho "Known issue. Skipping ..."; exit 0 367c455ce2SPeter Holm 377c455ce2SPeter Holmset -u 387c455ce2SPeter Holmlog=/tmp/force12.sh.log 397c455ce2SPeter Holmmount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint 407c455ce2SPeter Holmmdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart 417c455ce2SPeter Holmmdconfig -a -t swap -s 4g -u $mdstart 427c455ce2SPeter Holmflags=$newfs_flags 437c455ce2SPeter Holm[ `jot -r 1 0 1` -eq 1 ] && flags="-j" 447c455ce2SPeter Holmecho "newfs $flags md$mdstart" 457c455ce2SPeter Holmnewfs $flags md$mdstart > /dev/null 2>&1 467c455ce2SPeter Holm 477c455ce2SPeter Holmexport TESTPROGS=' 487c455ce2SPeter Holmtestcases/dirnprename/dirnprename 497c455ce2SPeter Holmtestcases/dirrename/dirrename 507c455ce2SPeter Holmtestcases/fts/fts 517c455ce2SPeter Holmtestcases/mkdir/mkdir 527c455ce2SPeter Holmtestcases/rename/rename 537c455ce2SPeter Holmtestcases/rw/rw 547c455ce2SPeter Holmtestcases/swap/swap 557c455ce2SPeter Holm' 567c455ce2SPeter Holm 577c455ce2SPeter Holmexport runRUNTIME=3m 587c455ce2SPeter Holmexport RUNDIR=$mntpoint/stressX 597c455ce2SPeter Holmexport CTRLDIR=$mntpoint/stressX.control 607c455ce2SPeter Holm 617c455ce2SPeter Holmmount /dev/md$mdstart $mntpoint 627c455ce2SPeter Holmchmod 777 $mntpoint 637c455ce2SPeter Holmexport dirnprenameLOAD=100 647c455ce2SPeter Holmexport dirrenameLOAD=100 657c455ce2SPeter Holm 667c455ce2SPeter Holmsu $testuser -c 'cd ..; ./testcases/run/run $TESTPROGS' > \ 677c455ce2SPeter Holm /dev/null 2>&1 & 687c455ce2SPeter Holm 697c455ce2SPeter Holmsleep `jot -r 1 60 180` 707c455ce2SPeter Holmwhile mdconfig -l | grep -q md$mdstart; do 717c455ce2SPeter Holm mdconfig -d -u $mdstart -o force || sleep 1 727c455ce2SPeter Holmdone 737c455ce2SPeter Holmsleep 1 747c455ce2SPeter Holm../tools/killall.sh 757c455ce2SPeter Holmwait 767c455ce2SPeter Holmn=0 777c455ce2SPeter Holmwhile mount | grep $mntpoint | grep -q /dev/md; do 787c455ce2SPeter Holm umount $mntpoint || sleep 1 797c455ce2SPeter Holm [ $((n += 1)) -gt 30 ] && { echo FAIL; exit 1; } 807c455ce2SPeter Holmdone 817c455ce2SPeter Holmmdconfig -d -u $mdstart > /dev/null 2>&1 827c455ce2SPeter Holmrm -f $log 837c455ce2SPeter Holmexit 0 84