xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/device-mapper/dm-flakey.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun=========
2*4882a593Smuzhiyundm-flakey
3*4882a593Smuzhiyun=========
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThis target is the same as the linear target except that it exhibits
6*4882a593Smuzhiyununreliable behaviour periodically.  It's been found useful in simulating
7*4882a593Smuzhiyunfailing devices for testing purposes.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunStarting from the time the table is loaded, the device is available for
10*4882a593Smuzhiyun<up interval> seconds, then exhibits unreliable behaviour for <down
11*4882a593Smuzhiyuninterval> seconds, and then this cycle repeats.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunAlso, consider using this in combination with the dm-delay target too,
14*4882a593Smuzhiyunwhich can delay reads and writes and/or send them to different
15*4882a593Smuzhiyununderlying devices.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunTable parameters
18*4882a593Smuzhiyun----------------
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun::
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun  <dev path> <offset> <up interval> <down interval> \
23*4882a593Smuzhiyun    [<num_features> [<feature arguments>]]
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunMandatory parameters:
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun    <dev path>:
28*4882a593Smuzhiyun        Full pathname to the underlying block-device, or a
29*4882a593Smuzhiyun        "major:minor" device-number.
30*4882a593Smuzhiyun    <offset>:
31*4882a593Smuzhiyun        Starting sector within the device.
32*4882a593Smuzhiyun    <up interval>:
33*4882a593Smuzhiyun        Number of seconds device is available.
34*4882a593Smuzhiyun    <down interval>:
35*4882a593Smuzhiyun        Number of seconds device returns errors.
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunOptional feature parameters:
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun  If no feature parameters are present, during the periods of
40*4882a593Smuzhiyun  unreliability, all I/O returns errors.
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun  drop_writes:
43*4882a593Smuzhiyun	All write I/O is silently ignored.
44*4882a593Smuzhiyun	Read I/O is handled correctly.
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun  error_writes:
47*4882a593Smuzhiyun	All write I/O is failed with an error signalled.
48*4882a593Smuzhiyun	Read I/O is handled correctly.
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun  corrupt_bio_byte <Nth_byte> <direction> <value> <flags>:
51*4882a593Smuzhiyun	During <down interval>, replace <Nth_byte> of the data of
52*4882a593Smuzhiyun	each matching bio with <value>.
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun    <Nth_byte>:
55*4882a593Smuzhiyun	The offset of the byte to replace.
56*4882a593Smuzhiyun	Counting starts at 1, to replace the first byte.
57*4882a593Smuzhiyun    <direction>:
58*4882a593Smuzhiyun	Either 'r' to corrupt reads or 'w' to corrupt writes.
59*4882a593Smuzhiyun	'w' is incompatible with drop_writes.
60*4882a593Smuzhiyun    <value>:
61*4882a593Smuzhiyun	The value (from 0-255) to write.
62*4882a593Smuzhiyun    <flags>:
63*4882a593Smuzhiyun	Perform the replacement only if bio->bi_opf has all the
64*4882a593Smuzhiyun	selected flags set.
65*4882a593Smuzhiyun
66*4882a593SmuzhiyunExamples:
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunReplaces the 32nd byte of READ bios with the value 1::
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun  corrupt_bio_byte 32 r 1 0
71*4882a593Smuzhiyun
72*4882a593SmuzhiyunReplaces the 224th byte of REQ_META (=32) bios with the value 0::
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun  corrupt_bio_byte 224 w 0 32
75