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