-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zinject: add "probe" device injection type
Injecting a device probe failure is not possible by matching IO types, because probe IO goes to the label regions, which is explicitly excluded from injection. Even if it were possible, it would be awkward to do, because a probe is sequence of reads and writes. This commit adds a new IO "type" to match for injection, which looks for the ZIO_FLAG_PROBE flag instead. Any probe IO will be match the injection record and recieve the wanted error. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
- Loading branch information
Showing
7 changed files
with
88 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,11 +19,11 @@ | |
.\" CDDL HEADER END | ||
.\" | ||
.\" Copyright 2013 Darik Horn <[email protected]>. All rights reserved. | ||
.\" Copyright (c) 2024, Klara Inc. | ||
.\" Copyright (c) 2024, 2025, Klara, Inc. | ||
.\" | ||
.\" lint-ok: WARNING: sections out of conventional order: Sh SYNOPSIS | ||
.\" | ||
.Dd December 2, 2024 | ||
.Dd January 14, 2025 | ||
.Dt ZINJECT 8 | ||
.Os | ||
. | ||
|
@@ -265,15 +265,16 @@ will be translated to the appropriate blkid range according to the | |
object's properties. | ||
.It Fl s Ar seconds | ||
Run for this many seconds before reporting failure. | ||
.It Fl T Ar failure | ||
Set the failure type to one of | ||
.Sy all , | ||
.Sy flush , | ||
.Sy claim , | ||
.Sy free , | ||
.Sy read , | ||
or | ||
.Sy write . | ||
.It Fl T Ar type | ||
Inject the error into I/O of this type. | ||
.Bl -tag -compact -width "read, write, flush, claim, free" | ||
.It Sy read , Sy write , Sy flush , Sy claim , Sy free | ||
Fundamental I/O types | ||
.It Sy all | ||
All fundamental I/O types | ||
.It Sy probe | ||
Device probe I/O | ||
.El | ||
.It Fl t Ar mos_type | ||
Set this to | ||
.Bl -tag -compact -width "spacemap" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
tests/zfs-tests/tests/functional/cli_root/zinject/zinject_probe.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# The contents of this file are subject to the terms of the | ||
# Common Development and Distribution License (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# | ||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
# or https://opensource.org/licenses/CDDL-1.0. | ||
# See the License for the specific language governing permissions | ||
# and limitations under the License. | ||
# | ||
# When distributing Covered Code, include this CDDL HEADER in each | ||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
# If applicable, add the following below this CDDL HEADER, with the | ||
# fields enclosed by brackets "[]" replaced with your own identifying | ||
# information: Portions Copyright [yyyy] [name of copyright owner] | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright (c) 2025, Klara, Inc. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
|
||
verify_runnable "global" | ||
|
||
log_assert "Check zinject can correctly inject a probe failure." | ||
|
||
DISK1=${DISKS%% *} | ||
|
||
function cleanup | ||
{ | ||
zinject -c all | ||
default_cleanup_noexit | ||
} | ||
|
||
log_onexit cleanup | ||
|
||
zpool create $TESTPOOL $DISK1 | ||
|
||
log_must zinject -d $DISK1 -e io -T probe $TESTPOOL | ||
log_must zinject -d $DISK1 -e io -T write $TESTPOOL | ||
|
||
log_must dd if=/dev/urandom of=/$TESTPOOL/file bs=1M count=1 | ||
|
||
log_note "waiting for pool to suspend" | ||
typeset -i tries=10 | ||
until [[ $(kstat_pool $TESTPOOL state) == "SUSPENDED" ]] ; do | ||
if ((tries-- == 0)); then | ||
log_fail "pool didn't suspend" | ||
fi | ||
sleep 1 | ||
done | ||
|
||
log_must zinject -c all | ||
log_must zpool clear $TESTPOOL | ||
log_must zpool destroy -f $TESTPOOL | ||
|
||
log_pass "zinject can correctly inject a probe failure." |