xref: /linux/Documentation/admin-guide/device-mapper/dm-flakey.rst (revision be239684b18e1cdcafcf8c7face4a2f562c745ad)
1=========
2dm-flakey
3=========
4
5This target is the same as the linear target except that it exhibits
6unreliable behaviour periodically.  It's been found useful in simulating
7failing devices for testing purposes.
8
9Starting from the time the table is loaded, the device is available for
10<up interval> seconds, then exhibits unreliable behaviour for <down
11interval> seconds, and then this cycle repeats.
12
13Also, consider using this in combination with the dm-delay target too,
14which can delay reads and writes and/or send them to different
15underlying devices.
16
17Table parameters
18----------------
19
20::
21
22  <dev path> <offset> <up interval> <down interval> \
23    [<num_features> [<feature arguments>]]
24
25Mandatory parameters:
26
27    <dev path>:
28        Full pathname to the underlying block-device, or a
29        "major:minor" device-number.
30    <offset>:
31        Starting sector within the device.
32    <up interval>:
33        Number of seconds device is available.
34    <down interval>:
35        Number of seconds device returns errors.
36
37Optional feature parameters:
38
39  If no feature parameters are present, during the periods of
40  unreliability, all I/O returns errors.
41
42  error_reads:
43	All read I/O is failed with an error signalled.
44	Write I/O is handled correctly.
45
46  drop_writes:
47	All write I/O is silently ignored.
48	Read I/O is handled correctly.
49
50  error_writes:
51	All write I/O is failed with an error signalled.
52	Read I/O is handled correctly.
53
54  corrupt_bio_byte <Nth_byte> <direction> <value> <flags>:
55	During <down interval>, replace <Nth_byte> of the data of
56	each matching bio with <value>.
57
58    <Nth_byte>:
59	The offset of the byte to replace.
60	Counting starts at 1, to replace the first byte.
61    <direction>:
62	Either 'r' to corrupt reads or 'w' to corrupt writes.
63	'w' is incompatible with drop_writes.
64    <value>:
65	The value (from 0-255) to write.
66    <flags>:
67	Perform the replacement only if bio->bi_opf has all the
68	selected flags set.
69
70  random_read_corrupt <probability>
71	During <down interval>, replace random byte in a read bio
72	with a random value. probability is an integer between
73	0 and 1000000000 meaning 0% to 100% probability of corruption.
74
75  random_write_corrupt <probability>
76	During <down interval>, replace random byte in a write bio
77	with a random value. probability is an integer between
78	0 and 1000000000 meaning 0% to 100% probability of corruption.
79
80Examples:
81
82Replaces the 32nd byte of READ bios with the value 1::
83
84  corrupt_bio_byte 32 r 1 0
85
86Replaces the 224th byte of REQ_META (=32) bios with the value 0::
87
88  corrupt_bio_byte 224 w 0 32
89