1*64dee23eSTony Hutter#!/bin/ksh -p 2*64dee23eSTony Hutter# 3*64dee23eSTony Hutter# CDDL HEADER START 4*64dee23eSTony Hutter# 5*64dee23eSTony Hutter# The contents of this file are subject to the terms of the 6*64dee23eSTony Hutter# Common Development and Distribution License (the "License"). 7*64dee23eSTony Hutter# You may not use this file except in compliance with the License. 8*64dee23eSTony Hutter# 9*64dee23eSTony Hutter# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*64dee23eSTony Hutter# or http://www.opensolaris.org/os/licensing. 11*64dee23eSTony Hutter# See the License for the specific language governing permissions 12*64dee23eSTony Hutter# and limitations under the License. 13*64dee23eSTony Hutter# 14*64dee23eSTony Hutter# When distributing Covered Code, include this CDDL HEADER in each 15*64dee23eSTony Hutter# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*64dee23eSTony Hutter# If applicable, add the following below this CDDL HEADER, with the 17*64dee23eSTony Hutter# fields enclosed by brackets "[]" replaced with your own identifying 18*64dee23eSTony Hutter# information: Portions Copyright [yyyy] [name of copyright owner] 19*64dee23eSTony Hutter# 20*64dee23eSTony Hutter# CDDL HEADER END 21*64dee23eSTony Hutter# 22*64dee23eSTony Hutter# Copyright (c) 2018 Lawrence Livermore National Security, LLC. 23*64dee23eSTony Hutter 24*64dee23eSTony Hutter. $STF_SUITE/include/libtest.shlib 25*64dee23eSTony Hutter. $STF_SUITE/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg 26*64dee23eSTony Hutter 27*64dee23eSTony Hutter# 28*64dee23eSTony Hutter# DESCRIPTION: 29*64dee23eSTony Hutter# zpool status should print "(repairing)" on drives with errors found 30*64dee23eSTony Hutter# while scrubbing. 31*64dee23eSTony Hutter# 32*64dee23eSTony Hutter# STRATEGY: 33*64dee23eSTony Hutter# 1. Create a file (already done in setup.ksh) 34*64dee23eSTony Hutter# 2. Inject read errors on one vdev 35*64dee23eSTony Hutter# 3. Run a scrub 36*64dee23eSTony Hutter# 4. Verify we see "(repairing)" on the bad vdev 37*64dee23eSTony Hutter# 38*64dee23eSTony Hutter 39*64dee23eSTony Hutterverify_runnable "global" 40*64dee23eSTony Hutter 41*64dee23eSTony Hutterlog_assert "Verify we see '(repairing)' while scrubbing a bad vdev." 42*64dee23eSTony Hutter 43*64dee23eSTony Hutterfunction cleanup 44*64dee23eSTony Hutter{ 45*64dee23eSTony Hutter log_must zinject -c all 46*64dee23eSTony Hutter log_must set_tunable64 zfs_scan_vdev_limit $ZFS_SCAN_VDEV_LIMIT_DEFAULT 47*64dee23eSTony Hutter zpool scrub -s $TESTPOOL || true 48*64dee23eSTony Hutter} 49*64dee23eSTony Hutter 50*64dee23eSTony Hutterlog_onexit cleanup 51*64dee23eSTony Hutter 52*64dee23eSTony Hutter# A file is already created in setup.ksh. Inject read errors on the first disk. 53*64dee23eSTony Hutterlog_must zinject -d $DISK1 -e io -T read -f 100 $TESTPOOL 54*64dee23eSTony Hutter 55*64dee23eSTony Hutter# Make the scrub slow 56*64dee23eSTony Hutterlog_must zinject -d $DISK1 -D10:1 $TESTPOOL 57*64dee23eSTony Hutterlog_must set_tunable64 zfs_scan_vdev_limit $ZFS_SCAN_VDEV_LIMIT_SLOW 58*64dee23eSTony Hutter 59*64dee23eSTony Hutterlog_must zpool scrub $TESTPOOL 60*64dee23eSTony Hutter 61*64dee23eSTony Hutter# Wait for the scrub to show '(repairing)'. Timeout after 10 sec if it doesn't 62*64dee23eSTony Hutter# show it. 63*64dee23eSTony Hutterfor i in {0..100} ; do 64*64dee23eSTony Hutter if ! is_pool_scrubbing $TESTPOOL ; then 65*64dee23eSTony Hutter break 66*64dee23eSTony Hutter fi 67*64dee23eSTony Hutter 68*64dee23eSTony Hutter if zpool status | grep "$DISK1" | grep -q '(repairing)' ; then 69*64dee23eSTony Hutter log_pass "Correctly saw '(repairing)' while scrubbing" 70*64dee23eSTony Hutter fi 71*64dee23eSTony Hutter 72*64dee23eSTony Hutter sleep 0.1 73*64dee23eSTony Hutterdone 74*64dee23eSTony Hutterlog_fail "Never saw '(repairing)' while scrubbing" 75