1 #!/usr/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27
28 . ${STF_SUITE}/include/libtest.shlib
29 . ${STF_SUITE}/tests/stress/include/stress.kshlib
30
31 # DESCRIPTION:
32 # Running multiple copies of dataset_create_write_destroy,
33 # dataset_create_write_destroy_attr and dataset_xattr on separate
34 # raidz pools. Create new filesystem and write file at the same time.
35 # At the same time, synchronize it every 10 seconds.
36 # The system shall not cause the system to fail, hang or panic.
37 #
38 # STRATEGY:
39 # 1. Setup phase will have created several raidz pools each with
40 # a separate intent log.
41 # 2. Multiple copies of dataset_create_write_destroy are fired off
42 # one per pool in the background.
43 # 3. Multiple copies of dataset_create_write_destroy_attr are filed off
44 # one per pool in the background.
45 # 4. Multiple copies of dataset_xattr are filed off one per pool in the
46 # background.
47 # 5. Create three datasets in each pool and start writing files in
48 # background.
49 # 6. Wait for 30 seconds, then repeat the operation at step 2 - 7.
50 # 7. Start writing to the same files, making holes in those files in
51 # background.
52 # 8. Sync every 10 seconds.
53 # 9. Wait for our stress timeout value to finish, and kill any remaining
54 # tests. The test is considered to have passed if the machine stays up
55 # during the time the stress tests are running and doesn't hit the stf
56 # time limit.
57
58 log_assert "parallel dataset_create_write_destroy," \
59 "dataset_create_write_destroy_attr, dataset_run_xattr" \
60 "create separated filesystem and create files on them." \
61 "Then synchronize per 10 seconds won't fail"
62
63 function regular_sync #<seconds>
64 {
65 typeset -i timeout=$1
66
67 while true; do
68 sleep $timeout
69 sync
70 done
71
72 exit 0
73 }
74
75 log_onexit cleanup
76
77 typeset pool=
78 typeset child_pids=
79
80 for pool in $(get_pools); do
81 log_note "dataset_create_write_destroy $pool"
82 dataset_create_write_destroy $pool > /dev/null 2>&1 &
83 child_pids="$child_pids $!"
84
85 log_note "dataset_create_write_destroy_exattr $pool"
86 dataset_create_write_destroy_exattr $pool > /dev/null 2>&1 &
87 child_pids="$child_pids $!"
88
89 log_note "dataset_run_xattr $pool "
90 dataset_run_xattr $pool > /dev/null 2>&1 &
91 child_pids="$child_pids $!"
92
93 create_write_fs $pool $loop
94 done
95
96 regular_sync 10 > /dev/null 2>&1 &
97 typeset sync_pid=$!
98
99 #
100 # Monitor stress processes until they exit or timed out
101 #
102 stress_timeout $STRESS_TIMEOUT $child_pids
103 kill -9 $sync_pid
104
105 log_pass