1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0-or-later 3# Copyright (c) 2016-2018 Oracle and/or its affiliates. All Rights Reserved. 4# Copyright (c) International Business Machines Corp., 2003 5# 6# PURPOSE: Runs fsstress over an NFS mount point for a specified amount 7# of time. The purpose of this test is to stress the NFS kernel 8# code and possibly the underlying filesystem where the export 9# resides. A PASS is if the test completes. 10 11TST_TESTFUNC="do_test" 12TST_CLEANUP="do_cleanup" 13 14THREAD_NUM="${THREAD_NUM:-2}" 15OPERATION_NUM="${OPERATION_NUM:-1000}" 16 17do_cleanup() 18{ 19 [ -n "$pids" ] && kill -9 $pids 20 nfs_cleanup 21} 22 23do_test() 24{ 25 tst_res TINFO "Starting fsstress processes on NFS mounts" 26 27 local n=0 28 local pids 29 for i in $VERSION; do 30 fsstress -l 1 -d $TST_TMPDIR/$i/$n -n $OPERATION_NUM -p $THREAD_NUM -r -c > /dev/null & 31 pids="$pids $!" 32 n=$(( n + 1 )) 33 done 34 35 tst_res TINFO "waiting for pids:$pids" 36 for p in $pids; do 37 if ! wait $p; then 38 tst_res TFAIL "fsstress process failed" 39 return 40 fi 41 tst_res TINFO "fsstress '$p' completed" 42 done 43 pids= 44 45 tst_res TPASS "all fsstress processes completed on '$n' NFS mounts" 46} 47 48. nfs_lib.sh 49tst_run 50