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
  40 #       2. Multiple copies of dataset_create_write_destroy are fired off
  41 #          one per pool in the background.
  42 #       3. Multiple copies of dataset_create_write_destroy_attr are filed off
  43 #          one per pool in the background.
  44 #       4. Multiple copies of dataset_xattr are filed off one per pool in the
  45 #          background.
  46 #       5. Create three datasets in each pool and start writing files in
  47 #          background.
  48 #       6. Wait for 30 seconds, then repeat the operation at step 2 - 7.
  49 #       7. Start writing to the same files, making holes in those files in
  50 #          background.
  51 #       8. Sync every 10 seconds.
  52 #       9. Wait for our stress timeout value to finish, and kill any remaining
  53 #          tests. The test is considered to have passed if the machine stays up
  54 #          during the time the stress tests are running and doesn't hit the stf
  55 #          time limit.
  56 
  57 log_assert "parallel dataset_create_write_destroy," \
  58         "dataset_create_write_destroy_attr , dataset_run_xattr" \
  59         "create separated filesystem and create files on them." \
  60         "Then synchronize per 10 seconds won't fail"
  61 
  62 function regular_sync #<seconds>
  63 {
  64         typeset -i timeout=$1
  65 
  66         while true; do
  67                 sleep $timeout
  68                 sync
  69         done
  70 
  71         exit 0
  72 }
  73 
  74 log_onexit cleanup
  75 
  76 typeset pool=
  77 typeset child_pids=
  78 
  79 for pool in $(get_pools); do
  80         log_note "dataset_create_write_destroy $pool"
  81         dataset_create_write_destroy $pool > /dev/null 2>&1 &
  82         child_pids="$child_pids $!"
  83 
  84         log_note "dataset_create_write_destroy_exattr $pool"
  85         dataset_create_write_destroy_exattr $pool > /dev/null 2>&1 &
  86         child_pids="$child_pids $!"
  87 
  88         log_note "dataset_run_xattr $pool "
  89         dataset_run_xattr $pool > /dev/null 2>&1 &
  90         child_pids="$child_pids $!"
  91 
  92         create_write_fs $pool $loop
  93 done
  94 
  95 regular_sync 10 > /dev/null 2>&1 &
  96 typeset sync_pid=$!
  97 
  98 #
  99 # Monitor stress processes until they exit or timed out
 100 #
 101 stress_timeout $STRESS_TIMEOUT $child_pids
 102 kill -9 $sync_pid
 103 
 104 log_pass