1#!/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# 29# Copyright (c) 2013 by Delphix. All rights reserved. 30# 31 32. $STF_SUITE/include/libtest.shlib 33 34# 35# DESCRIPTION: 36# 'zpool history' can cope with simultaneous commands. 37# 38# STRATEGY: 39# 1. Create test pool and test fs. 40# 2. Loop 100 times, set properties to test fs simultaneously. 41# 3. Wait for all the command execution complete. 42# 4. Make sure all the commands was logged by 'zpool history'. 43# 44 45verify_runnable "global" 46 47log_assert "'zpool history' can cope with simultaneous commands." 48 49typeset -i orig_count=$($ZPOOL history $spool | $WC -l | $AWK '{print $1}') 50 51typeset -i i=0 52while ((i < 10)); do 53 $ZFS set compression=off $TESTPOOL/$TESTFS & 54 $ZFS set atime=off $TESTPOOL/$TESTFS & 55 $ZFS create $TESTPOOL/$TESTFS1 & 56 $ZFS create $TESTPOOL/$TESTFS2 & 57 $ZFS create $TESTPOOL/$TESTFS3 & 58 59 wait 60 61 $ZFS snapshot $TESTPOOL/$TESTFS1@snap & 62 $ZFS snapshot $TESTPOOL/$TESTFS2@snap & 63 $ZFS snapshot $TESTPOOL/$TESTFS3@snap & 64 65 wait 66 67 $ZFS clone $TESTPOOL/$TESTFS1@snap $TESTPOOL/clone1 & 68 $ZFS clone $TESTPOOL/$TESTFS2@snap $TESTPOOL/clone2 & 69 $ZFS clone $TESTPOOL/$TESTFS3@snap $TESTPOOL/clone3 & 70 71 wait 72 73 $ZFS promote $TESTPOOL/clone1 & 74 $ZFS promote $TESTPOOL/clone2 & 75 $ZFS promote $TESTPOOL/clone3 & 76 77 wait 78 79 $ZFS destroy $TESTPOOL/$TESTFS1 & 80 $ZFS destroy $TESTPOOL/$TESTFS2 & 81 $ZFS destroy $TESTPOOL/$TESTFS3 & 82 83 wait 84 85 $ZFS destroy -Rf $TESTPOOL/clone1 & 86 $ZFS destroy -Rf $TESTPOOL/clone2 & 87 $ZFS destroy -Rf $TESTPOOL/clone3 & 88 89 wait 90 ((i += 1)) 91done 92 93typeset -i entry_count=$($ZPOOL history $spool | $WC -l | $AWK '{print $1}') 94 95if ((entry_count - orig_count != 200)); then 96 log_fail "The entries count error: entry_count=$entry_count " \ 97 "orig_count = $orig_count" 98fi 99 100log_pass "'zpool history' can cope with simultaneous commands." 101