xref: /illumos-gate/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen_007_pos.ksh (revision 45a4b79d042e642c2ed7090ec290469ccf8fc563)
1#!/bin/ksh -p
2
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9# A full copy of the text of the CDDL should have accompanied this
10# source.  A copy of the CDDL is also available via the Internet at
11# http://www.illumos.org/license/CDDL.
12#
13
14#
15# Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
16#
17
18. $STF_SUITE/tests/functional/cli_root/zpool_reopen/zpool_reopen.shlib
19
20#
21# DESCRIPTION:
22# Test zpool reopen while performing IO to the pool.
23# Verify that no IO errors of any kind of reported.
24#
25# STRATEGY:
26# 1. Create a non-redundant pool.
27# 2. Repeat:
28#   a. Write files to the pool.
29#   b. Execute 'zpool reopen'.
30# 3. Verify that no errors are reported by 'zpool status'.
31
32verify_runnable "global"
33
34function cleanup
35{
36	poolexists $TESTPOOL && destroy_pool $TESTPOOL
37}
38
39log_assert "Testing zpool reopen with concurrent user IO"
40log_onexit cleanup
41
42set_removed_disk
43scsi_host=$(get_scsi_host $REMOVED_DISK)
44
45# 1. Create a non-redundant pool.
46log_must zpool create $TESTPOOL $DISK1 $DISK2 $DISK3
47
48for i in $(seq 10); do
49	# 3a. Write files in the background to the pool.
50	mkfile 64m /$TESTPOOL/data.$i &
51
52	# 3b. Execute 'zpool reopen'.
53	log_must zpool reopen $TESTPOOL
54
55	for disk in $DISK1 $DISK2 $DISK3; do
56		zpool status -P -v $TESTPOOL | grep $disk | \
57		    read -r name state rd wr cksum
58		log_must [ $state = "ONLINE" ]
59	        log_must [ $rd -eq 0 ]
60	        log_must [ $wr -eq 0 ]
61	        log_must [ $cksum -eq 0 ]
62	done
63done
64
65wait
66
67log_pass "Zpool reopen with concurrent user IO successful"
68