]>
Commit | Line | Data |
---|---|---|
6bb24f4d BB |
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 2009 Sun Microsystems, Inc. All rights reserved. | |
25 | # Use is subject to license terms. | |
26 | # | |
27 | ||
28 | # | |
c1d9abf9 | 29 | # Copyright (c) 2013, 2016 by Delphix. All rights reserved. |
6bb24f4d BB |
30 | # |
31 | ||
32 | . $STF_SUITE/include/libtest.shlib | |
33 | ||
34 | # | |
35 | # DESCRIPTION: | |
36 | # Turning a disk offline and back online during I/O completes. | |
37 | # | |
38 | # STRATEGY: | |
39 | # 1. Create a mirror and start some random I/O | |
40 | # 2. For each disk in the mirror, set it offline and online | |
41 | # 3. Verify the integrity of the file system and the resilvering. | |
42 | # | |
43 | ||
44 | verify_runnable "global" | |
45 | log_onexit cleanup | |
46 | ||
47 | DISKLIST=$(get_disklist $TESTPOOL) | |
48 | ||
49 | function cleanup | |
50 | { | |
51 | # | |
52 | # Ensure we don't leave disks in the offline state | |
53 | # | |
54 | for disk in $DISKLIST; do | |
c1d9abf9 | 55 | log_must zpool online $TESTPOOL $disk |
6bb24f4d BB |
56 | check_state $TESTPOOL $disk "online" |
57 | if [[ $? != 0 ]]; then | |
58 | log_fail "Unable to online $disk" | |
59 | fi | |
60 | ||
61 | done | |
62 | ||
c1d9abf9 JWK |
63 | kill $killpid >/dev/null 2>&1 |
64 | [[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/* | |
6bb24f4d BB |
65 | } |
66 | ||
67 | log_assert "Turning a disk offline and back online during I/O completes." | |
68 | ||
c1d9abf9 | 69 | file_trunc -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 & |
6bb24f4d BB |
70 | typeset killpid="$! " |
71 | ||
72 | for disk in $DISKLIST; do | |
73 | for i in 'do_offline' 'do_offline_while_already_offline'; do | |
c1d9abf9 | 74 | log_must zpool offline $TESTPOOL $disk |
6bb24f4d BB |
75 | check_state $TESTPOOL $disk "offline" |
76 | if [[ $? != 0 ]]; then | |
77 | log_fail "$disk of $TESTPOOL is not offline." | |
78 | fi | |
79 | done | |
80 | ||
c1d9abf9 | 81 | log_must zpool online $TESTPOOL $disk |
6bb24f4d BB |
82 | check_state $TESTPOOL $disk "online" |
83 | if [[ $? != 0 ]]; then | |
84 | log_fail "$disk of $TESTPOOL did not match online state" | |
85 | fi | |
86 | done | |
87 | ||
c1d9abf9 JWK |
88 | log_must kill $killpid |
89 | sync | |
6bb24f4d BB |
90 | |
91 | typeset dir=$(get_device_dir $DISKS) | |
92 | verify_filesys "$TESTPOOL" "$TESTPOOL/$TESTFS" "$dir" | |
93 | ||
94 | log_pass |