1eda14cbcSMatt Macy.\" 2eda14cbcSMatt Macy.\" CDDL HEADER START 3eda14cbcSMatt Macy.\" 4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the 5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License"). 6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License. 7eda14cbcSMatt Macy.\" 8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0. 10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions 11eda14cbcSMatt Macy.\" and limitations under the License. 12eda14cbcSMatt Macy.\" 13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each 14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the 16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying 17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner] 18eda14cbcSMatt Macy.\" 19eda14cbcSMatt Macy.\" CDDL HEADER END 20eda14cbcSMatt Macy.\" 21eda14cbcSMatt Macy.\" Copyright 2013 Darik Horn <dajhorn@vanadac.com>. All rights reserved. 22eda14cbcSMatt Macy.\" 2316038816SMartin Matuska.\" lint-ok: WARNING: sections out of conventional order: Sh SYNOPSIS 2416038816SMartin Matuska.\" 2516038816SMartin Matuska.Dd May 26, 2021 2616038816SMartin Matuska.Dt ZINJECT 8 2716038816SMartin Matuska.Os 2816038816SMartin Matuska. 2916038816SMartin Matuska.Sh NAME 3016038816SMartin Matuska.Nm zinject 3116038816SMartin Matuska.Nd ZFS Fault Injector 3216038816SMartin Matuska.Sh DESCRIPTION 3316038816SMartin Matuska.Nm 3416038816SMartin Matuskacreates artificial problems in a ZFS pool by simulating data corruption 3516038816SMartin Matuskaor device failures. 3616038816SMartin MatuskaThis program is dangerous. 3716038816SMartin Matuska. 3816038816SMartin Matuska.Sh SYNOPSIS 3916038816SMartin Matuska.Bl -tag -width Ds 4016038816SMartin Matuska.It Xo 4116038816SMartin Matuska.Nm zinject 4216038816SMartin Matuska.Xc 43eda14cbcSMatt MacyList injection records. 4416038816SMartin Matuska. 4516038816SMartin Matuska.It Xo 4616038816SMartin Matuska.Nm zinject 4716038816SMartin Matuska.Fl b Ar objset : Ns Ar object : Ns Ar level : Ns Ar start : Ns Ar end 4816038816SMartin Matuska.Op Fl f Ar frequency 4916038816SMartin Matuska.Fl amu 5016038816SMartin Matuska.Op pool 5116038816SMartin Matuska.Xc 52eda14cbcSMatt MacyForce an error into the pool at a bookmark. 5316038816SMartin Matuska. 5416038816SMartin Matuska.It Xo 5516038816SMartin Matuska.Nm zinject 5616038816SMartin Matuska.Fl c Ar id Ns | Ns Sy all 5716038816SMartin Matuska.Xc 58eda14cbcSMatt MacyCancel injection records. 5916038816SMartin Matuska. 6016038816SMartin Matuska.It Xo 6116038816SMartin Matuska.Nm zinject 6216038816SMartin Matuska.Fl d Ar vdev 6316038816SMartin Matuska.Fl A Sy degrade Ns | Ns Sy fault 6416038816SMartin Matuska.Ar pool 6516038816SMartin Matuska.Xc 66eda14cbcSMatt MacyForce a vdev into the DEGRADED or FAULTED state. 6716038816SMartin Matuska. 6816038816SMartin Matuska.It Xo 6916038816SMartin Matuska.Nm zinject 7016038816SMartin Matuska.Fl d Ar vdev 7116038816SMartin Matuska.Fl D Ar latency : Ns Ar lanes 7216038816SMartin Matuska.Ar pool 7316038816SMartin Matuska.Xc 74c03c5b1cSMartin MatuskaAdd an artificial delay to I/O requests on a particular 7516038816SMartin Matuskadevice, such that the requests take a minimum of 7616038816SMartin Matuska.Ar latency 7716038816SMartin Matuskamilliseconds to complete. 7816038816SMartin MatuskaEach delay has an associated number of 7916038816SMartin Matuska.Ar lanes 8016038816SMartin Matuskawhich defines the number of concurrent 81c03c5b1cSMartin MatuskaI/O requests that can be processed. 8216038816SMartin Matuska.Pp 8316038816SMartin MatuskaFor example, with a single lane delay of 10 ms 8416038816SMartin Matuska.No (\& Ns Fl D Ar 10 : Ns Ar 1 ) , 85c03c5b1cSMartin Matuskathe device will only be able to service a single I/O request 8616038816SMartin Matuskaat a time with each request taking 10 ms to complete. 8716038816SMartin MatuskaSo, if only a single request is submitted every 10 ms, the 88eda14cbcSMatt Macyaverage latency will be 10 ms; but if more than one request 89eda14cbcSMatt Macyis submitted every 10 ms, the average latency will be more 90eda14cbcSMatt Macythan 10 ms. 9116038816SMartin Matuska.Pp 92eda14cbcSMatt MacySimilarly, if a delay of 10 ms is specified to have two 9316038816SMartin Matuskalanes 9416038816SMartin Matuska.No (\& Ns Fl D Ar 10 : Ns Ar 2 ) , 9516038816SMartin Matuskathen the device will be able to service 9616038816SMartin Matuskatwo requests at a time, each with a minimum latency of 10 ms. 9716038816SMartin MatuskaSo, if two requests are submitted every 10 ms, then 98eda14cbcSMatt Macythe average latency will be 10 ms; but if more than two 99eda14cbcSMatt Macyrequests are submitted every 10 ms, the average latency 100eda14cbcSMatt Macywill be more than 10 ms. 10116038816SMartin Matuska.Pp 10216038816SMartin MatuskaAlso note, these delays are additive. 10316038816SMartin MatuskaSo two invocations of 10416038816SMartin Matuska.Fl D Ar 10 : Ns Ar 1 10516038816SMartin Matuskaare roughly equivalent to a single invocation of 10616038816SMartin Matuska.Fl D Ar 10 : Ns Ar 2 . 10716038816SMartin MatuskaThis also means, that one can specify multiple 10816038816SMartin Matuskalanes with differing target latencies. 10916038816SMartin MatuskaFor example, an invocation of 11016038816SMartin Matuska.Fl D Ar 10 : Ns Ar 1 11116038816SMartin Matuskafollowed by 11216038816SMartin Matuska.Fl D Ar 25 : Ns Ar 2 11316038816SMartin Matuskawill create 3 lanes on the device: one lane with a latency 114eda14cbcSMatt Macyof 10 ms and two lanes with a 25 ms latency. 11516038816SMartin Matuska. 11616038816SMartin Matuska.It Xo 11716038816SMartin Matuska.Nm zinject 11816038816SMartin Matuska.Fl d Ar vdev 11916038816SMartin Matuska.Op Fl e Ar device_error 12016038816SMartin Matuska.Op Fl L Ar label_error 12116038816SMartin Matuska.Op Fl T Ar failure 12216038816SMartin Matuska.Op Fl f Ar frequency 12316038816SMartin Matuska.Op Fl F 12416038816SMartin Matuska.Ar pool 12516038816SMartin Matuska.Xc 126eda14cbcSMatt MacyForce a vdev error. 12716038816SMartin Matuska. 12816038816SMartin Matuska.It Xo 12916038816SMartin Matuska.Nm zinject 13016038816SMartin Matuska.Fl I 13116038816SMartin Matuska.Op Fl s Ar seconds Ns | Ns Fl g Ar txgs 13216038816SMartin Matuska.Ar pool 13316038816SMartin Matuska.Xc 134eda14cbcSMatt MacySimulate a hardware failure that fails to honor a cache flush. 13516038816SMartin Matuska. 13616038816SMartin Matuska.It Xo 13716038816SMartin Matuska.Nm zinject 13816038816SMartin Matuska.Fl p Ar function 13916038816SMartin Matuska.Ar pool 14016038816SMartin Matuska.Xc 141eda14cbcSMatt MacyPanic inside the specified function. 14216038816SMartin Matuska. 14316038816SMartin Matuska.It Xo 14416038816SMartin Matuska.Nm zinject 14516038816SMartin Matuska.Fl t Sy data 14616038816SMartin Matuska.Fl C Ar dvas 14716038816SMartin Matuska.Op Fl e Ar device_error 14816038816SMartin Matuska.Op Fl f Ar frequency 14916038816SMartin Matuska.Op Fl l Ar level 15016038816SMartin Matuska.Op Fl r Ar range 15116038816SMartin Matuska.Op Fl amq 15216038816SMartin Matuska.Ar path 15316038816SMartin Matuska.Xc 154eda14cbcSMatt MacyForce an error into the contents of a file. 15516038816SMartin Matuska. 15616038816SMartin Matuska.It Xo 15716038816SMartin Matuska.Nm zinject 15816038816SMartin Matuska.Fl t Sy dnode 15916038816SMartin Matuska.Fl C Ar dvas 16016038816SMartin Matuska.Op Fl e Ar device_error 16116038816SMartin Matuska.Op Fl f Ar frequency 16216038816SMartin Matuska.Op Fl l Ar level 16316038816SMartin Matuska.Op Fl amq 16416038816SMartin Matuska.Ar path 16516038816SMartin Matuska.Xc 166eda14cbcSMatt MacyForce an error into the metadnode for a file or directory. 16716038816SMartin Matuska. 16816038816SMartin Matuska.It Xo 16916038816SMartin Matuska.Nm zinject 17016038816SMartin Matuska.Fl t Ar mos_type 17116038816SMartin Matuska.Fl C Ar dvas 17216038816SMartin Matuska.Op Fl e Ar device_error 17316038816SMartin Matuska.Op Fl f Ar frequency 17416038816SMartin Matuska.Op Fl l Ar level 17516038816SMartin Matuska.Op Fl r Ar range 17616038816SMartin Matuska.Op Fl amqu 17716038816SMartin Matuska.Ar pool 17816038816SMartin Matuska.Xc 179eda14cbcSMatt MacyForce an error into the MOS of a pool. 18016038816SMartin Matuska.El 18116038816SMartin Matuska.Sh OPTIONS 18216038816SMartin Matuska.Bl -tag -width "-C dvas" 18316038816SMartin Matuska.It Fl a 184eda14cbcSMatt MacyFlush the ARC before injection. 18516038816SMartin Matuska.It Fl b Ar objset : Ns Ar object : Ns Ar level : Ns Ar start : Ns Ar end 18616038816SMartin MatuskaForce an error into the pool at this bookmark tuple. 18716038816SMartin MatuskaEach number is in hexadecimal, and only one block can be specified. 18816038816SMartin Matuska.It Fl C Ar dvas 18916038816SMartin MatuskaInject the given error only into specific DVAs. 19016038816SMartin MatuskaThe mask should be specified as a list of 0-indexed DVAs separated by commas 191c03c5b1cSMartin Matuska.No (e.g. Ar 0,2 Ns No ). 19216038816SMartin MatuskaThis option is not applicable to logical data errors such as 19316038816SMartin Matuska.Sy decompress 194eda14cbcSMatt Macyand 19516038816SMartin Matuska.Sy decrypt . 19616038816SMartin Matuska.It Fl d Ar vdev 197eda14cbcSMatt MacyA vdev specified by path or GUID. 19816038816SMartin Matuska.It Fl e Ar device_error 199eda14cbcSMatt MacySpecify 20016038816SMartin Matuska.Bl -tag -compact -width "decompress" 20116038816SMartin Matuska.It Sy checksum 20216038816SMartin Matuskafor an ECKSUM error, 20316038816SMartin Matuska.It Sy decompress 20416038816SMartin Matuskafor a data decompression error, 20516038816SMartin Matuska.It Sy decrypt 20616038816SMartin Matuskafor a data decryption error, 20716038816SMartin Matuska.It Sy corrupt 20816038816SMartin Matuskato flip a bit in the data after a read, 20916038816SMartin Matuska.It Sy dtl 21016038816SMartin Matuskafor an ECHILD error, 21116038816SMartin Matuska.It Sy io 21216038816SMartin Matuskafor an EIO error where reopening the device will succeed, or 21316038816SMartin Matuska.It Sy nxio 21416038816SMartin Matuskafor an ENXIO error where reopening the device will fail. 21516038816SMartin Matuska.El 21616038816SMartin Matuska.Pp 21716038816SMartin MatuskaFor EIO and ENXIO, the "failed" reads or writes still occur. 21816038816SMartin MatuskaThe probe simply sets the error value reported by the I/O pipeline 21916038816SMartin Matuskaso it appears the read or write failed. 22016038816SMartin MatuskaDecryption errors only currently work with file data. 22116038816SMartin Matuska.It Fl f Ar frequency 22216038816SMartin MatuskaOnly inject errors a fraction of the time. 22316038816SMartin MatuskaExpressed as a real number percentage between 22416038816SMartin Matuska.Sy 0.0001 22516038816SMartin Matuskaand 22616038816SMartin Matuska.Sy 100 . 22716038816SMartin Matuska.It Fl F 22816038816SMartin MatuskaFail faster. 22916038816SMartin MatuskaDo fewer checks. 23016038816SMartin Matuska.It Fl f Ar txgs 231eda14cbcSMatt MacyRun for this many transaction groups before reporting failure. 23216038816SMartin Matuska.It Fl h 233eda14cbcSMatt MacyPrint the usage message. 23416038816SMartin Matuska.It Fl l Ar level 23516038816SMartin MatuskaInject an error at a particular block level. 23616038816SMartin MatuskaThe default is 23716038816SMartin Matuska.Sy 0 . 23816038816SMartin Matuska.It Fl L Ar label_error 239eda14cbcSMatt MacySet the label error region to one of 24016038816SMartin Matuska.Sy nvlist , 24116038816SMartin Matuska.Sy pad1 , 24216038816SMartin Matuska.Sy pad2 , 24316038816SMartin Matuskaor 24416038816SMartin Matuska.Sy uber . 24516038816SMartin Matuska.It Fl m 246eda14cbcSMatt MacyAutomatically remount the underlying filesystem. 24716038816SMartin Matuska.It Fl q 24816038816SMartin MatuskaQuiet mode. 24916038816SMartin MatuskaOnly print the handler number added. 25016038816SMartin Matuska.It Fl r Ar range 251eda14cbcSMatt MacyInject an error over a particular logical range of an object, which 252eda14cbcSMatt Macywill be translated to the appropriate blkid range according to the 253eda14cbcSMatt Macyobject's properties. 25416038816SMartin Matuska.It Fl s Ar seconds 255eda14cbcSMatt MacyRun for this many seconds before reporting failure. 25616038816SMartin Matuska.It Fl T Ar failure 257eda14cbcSMatt MacySet the failure type to one of 25816038816SMartin Matuska.Sy all , 25916038816SMartin Matuska.Sy claim , 26016038816SMartin Matuska.Sy free , 26116038816SMartin Matuska.Sy read , 26216038816SMartin Matuskaor 26316038816SMartin Matuska.Sy write . 26416038816SMartin Matuska.It Fl t Ar mos_type 265eda14cbcSMatt MacySet this to 26616038816SMartin Matuska.Bl -tag -compact -width "spacemap" 26716038816SMartin Matuska.It Sy mos 26816038816SMartin Matuskafor any data in the MOS, 26916038816SMartin Matuska.It Sy mosdir 27016038816SMartin Matuskafor an object directory, 27116038816SMartin Matuska.It Sy config 27216038816SMartin Matuskafor the pool configuration, 27316038816SMartin Matuska.It Sy bpobj 27416038816SMartin Matuskafor the block pointer list, 27516038816SMartin Matuska.It Sy spacemap 27616038816SMartin Matuskafor the space map, 27716038816SMartin Matuska.It Sy metaslab 27816038816SMartin Matuskafor the metaslab, or 27916038816SMartin Matuska.It Sy errlog 28016038816SMartin Matuskafor the persistent error log. 28116038816SMartin Matuska.El 28216038816SMartin Matuska.It Fl u 283eda14cbcSMatt MacyUnload the pool after injection. 28416038816SMartin Matuska.El 28516038816SMartin Matuska. 28616038816SMartin Matuska.Sh ENVIRONMENT VARIABLES 28716038816SMartin Matuska.Bl -tag -width "ZF" 28816038816SMartin Matuska.It Ev ZFS_HOSTID 28916038816SMartin MatuskaRun 29016038816SMartin Matuska.Nm 29116038816SMartin Matuskain debug mode. 29216038816SMartin Matuska.El 29316038816SMartin Matuska. 29416038816SMartin Matuska.Sh SEE ALSO 29516038816SMartin Matuska.Xr zfs 8 , 29616038816SMartin Matuska.Xr zpool 8 297