1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# CDDL HEADER START 5# 6# The contents of this file are subject to the terms of the 7# Common Development and Distribution License (the "License"). 8# You may not use this file except in compliance with the License. 9# 10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11# or https://opensource.org/licenses/CDDL-1.0. 12# See the License for the specific language governing permissions 13# and limitations under the License. 14# 15# When distributing Covered Code, include this CDDL HEADER in each 16# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17# If applicable, add the following below this CDDL HEADER, with the 18# fields enclosed by brackets "[]" replaced with your own identifying 19# information: Portions Copyright [yyyy] [name of copyright owner] 20# 21# CDDL HEADER END 22# 23 24# 25# Copyright (c) 2025 by Triad National Security, LLC. 26# 27 28. $STF_SUITE/include/libtest.shlib 29 30# 31# DESCRIPTION: 32# Setting vdev scheduler property while reading from vdev should not cause panic. 33# 34# STRATEGY: 35# 1. Create a zpool 36# 2. Write a file to the pool. 37# 3. Start reading from file, while also setting the scheduler property. 38# 39 40verify_runnable "global" 41 42command -v fio > /dev/null || log_unsupported "fio missing" 43 44function set_scheduler 45{ 46 for i in auto on off ; do 47 sleep 0.1 48 zpool set scheduler=$i $TESTPOOL1 $FILEDEV 49 done 50} 51 52function cleanup 53{ 54 destroy_pool $TESTPOOL1 55 log_must rm -f $FILEDEV 56} 57 58log_assert "Toggling vdev scheduler property while reading from vdev should not cause panic" 59log_onexit cleanup 60 61# 1. Create a pool 62 63FILEDEV="$TEST_BASE_DIR/filedev.$$" 64log_must truncate -s $(($MINVDEVSIZE * 2)) $FILEDEV 65create_pool $TESTPOOL1 $FILEDEV 66 67mntpnt=$(get_prop mountpoint $TESTPOOL1) 68 69# 2. Write a file to the pool, while also setting the scheduler property. 70 71log_must eval "fio --filename=$mntpnt/foobar --name=write-file \ 72 --rw=write --size=$MINVDEVSIZE --bs=128k --numjobs=1 --direct=1 \ 73 --ioengine=sync --time_based --runtime=2 &" 74 75ITERATIONS=4 76 77for i in $(seq $ITERATIONS); do 78 log_must set_scheduler 79done; 80wait 81 82# 3. Starting reading from file, while also setting the scheduler property. 83 84log_must eval "fio --filename=$mntpnt/foobar --name=read-file \ 85 --rw=read --size=$MINVDEVSIZE --bs=128k --numjobs=1 --direct=1 \ 86 --ioengine=sync --time_based --runtime=2 &" 87 88for i in $(seq $ITERATIONS); do 89 log_must set_scheduler 90done; 91wait 92 93log_pass "Setting vdev scheduler property while reading from vdev does not cause panic" 94