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 #       shall not cause the system to fail, hang or panic.
  36 #
  37 # STRATEGY:
  38 #       1. Setup phase will have created several raidz pools
  39 #       2. Multiple copies of dataset_create_write_destroy are fired off
  40 #          one per raidz in the background.
  41 #       3. Multiple copies of dataset_create_write_destroy_attr are filed off
  42 #          one per raidz in the background.
  43 #       4. Multiple copies of dataset_xattr are filed off one per raidz in the
  44 #          background.
  45 #       6. Create three datasets in each pool and start writing files in
  46 #          background.
  47 #       7. Wait for 30 seconds, then repeat the operation at step 2 - 8.
  48 #       8. Start writing to the same files, making holes in those files in
  49 #          background.
  50 #       9. Wait for our stress timeout value to finish, and kill any remaining
  51 #          tests. The test is considered to have passed if the machine stays up
  52 #          during the time the stress tests are running and doesn't hit the stf
  53 #          time limit.
  54 
  55 log_assert "parallel dataset_create_write_destroy," \
  56         "dataset_create_write_destroy_attr , dataset_run_xattr" \
  57         "create three filesystems per pool and write files on them won't fail"
  58 
  59 log_onexit cleanup
  60 
  61 typeset pool=
  62 typeset child_pids=
  63 
  64 for pool in $(get_pools); do
  65         log_note "dataset_create_write_destroy $pool"
  66         dataset_create_write_destroy $pool > /dev/null 2>&1 &
  67         child_pids="$child_pids $!"
  68 
  69         log_note "dataset_create_write_destroy_exattr $pool"
  70         dataset_create_write_destroy_exattr $pool > /dev/null 2>&1 &
  71         child_pids="$child_pids $!"
  72 
  73         log_note "dataset_run_xattr $pool "
  74         dataset_run_xattr $pool > /dev/null 2>&1 &
  75         child_pids="$child_pids $!"
  76 
  77         create_write_fs $pool $loop
  78 done
  79 
  80 #
  81 # Monitor stress processes until they exit or timed out
  82 #
  83 stress_timeout $STRESS_TIMEOUT $child_pids
  84 
  85 log_pass