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 https://opensource.org/licenses/CDDL-1.0. 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 (c) 2018 by Lawrence Livermore National Security, LLC. 25# 26 27# DESCRIPTION: 28# Verify zpool status -s (slow IOs) works 29# 30# STRATEGY: 31# 1. Create a file 32# 2. Inject slow IOs into the pool 33# 3. Verify we can see the slow IOs with "zpool status -s". 34# 4. Verify we can see delay events. 35# 36 37. $STF_SUITE/include/libtest.shlib 38. $STF_SUITE/include/zpool_script.shlib 39 40DISK=${DISKS%% *} 41 42verify_runnable "both" 43 44default_mirror_setup_noexit $DISKS 45 46function cleanup 47{ 48 log_must zinject -c all 49 log_must set_tunable64 ZIO_SLOW_IO_MS $OLD_SLOW_IO 50 log_must set_tunable64 SLOW_IO_EVENTS_PER_SECOND $OLD_SLOW_IO_EVENTS 51 default_cleanup_noexit 52} 53 54log_onexit cleanup 55 56log_must zpool events -c 57 58# Mark any IOs greater than 10ms as slow IOs 59OLD_SLOW_IO=$(get_tunable ZIO_SLOW_IO_MS) 60OLD_SLOW_IO_EVENTS=$(get_tunable SLOW_IO_EVENTS_PER_SECOND) 61log_must set_tunable64 ZIO_SLOW_IO_MS 10 62log_must set_tunable64 SLOW_IO_EVENTS_PER_SECOND 1000 63 64# Create 20ms IOs 65log_must zinject -d $DISK -D20:100 $TESTPOOL 66log_must mkfile 1048576 /$TESTPOOL/testfile 67sync_pool $TESTPOOL 68 69log_must zinject -c all 70SLOW_IOS=$(zpool status -sp | awk -v d="$DISK" '$0 ~ d {print $6}') 71DELAY_EVENTS=$(zpool events | grep -c delay) 72 73log_must [ $SLOW_IOS -gt 0 ] 74log_must [ $DELAY_EVENTS -gt 0 ] 75 76log_pass "Correctly saw $SLOW_IOS slow IOs and $DELAY_EVENTS delay events" 77