← Documents Documentation/admin-guide/device-mapper/dm-flakey.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / Device Mapper

dm-flakey target

정상·failure interval을 반복하며 read/write error, silent drop과 fixed/random bio corruption을 주입하는 dm-flakey target입니다.

Source pathDocumentation/admin-guide/device-mapper/dm-flakey.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

주기적 failure injection

dm-flakey.rst:1-36

Linear mapping 위에 up/down interval과 optional feature를 구성하는 table 형식을 설명합니다.

Error와 corruption feature

dm-flakey.rst:37-88

Read/write failure·drop, fixed byte와 random corruption 및 bio flag 예제를 정리합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 =========
2 dm-flakey
3 =========
4
5 This target is the same as the linear target except that it exhibits
6 unreliable behaviour periodically. It's been found useful in simulating
7 failing devices for testing purposes.
8
9 Starting from the time the table is loaded, the device is available for
10 <up interval> seconds, then exhibits unreliable behaviour for <down
11 interval> seconds, and then this cycle repeats.
12
13 Also, consider using this in combination with the dm-delay target too,
14 which can delay reads and writes and/or send them to different
15 underlying devices.
16
17 Table parameters
18 ----------------
19
20 ::
21
22 <dev path> <offset> <up interval> <down interval> \
23 [<num_features> [<feature arguments>]]
24
25 Mandatory 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
37 Optional 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
80 Examples:
81
82 Replaces the 32nd byte of READ bios with the value 1::
83
84 corrupt_bio_byte 32 r 1 0
85
86 Replaces the 224th byte of REQ_META (=32) bios with the value 0::
87
88 corrupt_bio_byte 224 w 0 32
89

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

주기적으로 unreliable한 linear mapping

1-16

`dm-flakey` target은 linear target과 같지만 주기적으로 unreliable behavior를 보입니다. Failure device를 simulation하는 test에 유용합니다.

Table을 load한 시점부터 device는 `<up interval>`초 동안 정상 사용 가능하고, 이어서 `<down interval>`초 동안 unreliable하게 동작합니다. 이 cycle을 계속 반복합니다.

Read와 write를 지연시키거나 서로 다른 underlying device로 보낼 수 있는 `dm-delay` target과 조합하는 방법도 고려할 수 있습니다.

dm-flakey 반복 cycle
Table loadedUp interval: normal I/ODown interval: configured unreliable behaviorRepeat cycle

Table load 시점을 기준으로 정상 구간과 failure injection 구간이 반복됩니다.

Table과 mandatory parameter

17-36

dm-flakey table 형식은 다음과 같습니다.

  <dev path> <offset> <up interval> <down interval> \
    [<num_features> [<feature arguments>]]
dm-flakey mandatory parameter
Parameter설명
`dev path`Underlying block device의 full pathname 또는 `major:minor` device number
`offset`Device 안의 시작 sector
`up interval`Device가 정상 사용 가능한 시간(초)
`down interval`Device가 error를 반환하는 시간(초)
`num_features`뒤따르는 optional feature argument 수

Backing mapping과 정상·failure 시간 구간을 지정합니다.

Failure와 data corruption feature

37-79

Feature parameter가 없으면 unreliable 구간에 모든 I/O가 error를 반환합니다.

기본 failure feature
FeatureReadWrite
없음ErrorError
`error_reads`Error정상 처리
`drop_writes`정상 처리조용히 무시
`error_writes`정상 처리Error

Read 또는 write만 선택적으로 실패시키거나 write를 조용히 버립니다.

`corrupt_bio_byte <Nth_byte> <direction> <value> <flags>`는 down interval 동안 조건에 맞는 bio data의 `<Nth_byte>`를 `<value>`로 바꿉니다.

corrupt_bio_byte argument
Argument설명
`Nth_byte`바꿀 byte offset; 첫 byte를 1로 세는 1-based 값
`direction`Read corruption은 `r`, write corruption은 `w`; `w`는 `drop_writes`와 호환되지 않음
`value`쓸 값, 0-255
`flags``bio->bi_opf`에 선택한 flag가 모두 설정된 bio에만 적용

Byte 위치, I/O 방향, 대체 값과 bio flag 조건을 지정합니다.

`random_read_corrupt <probability>`는 down interval의 read bio에서 임의 byte를 임의 값으로 바꿉니다. `random_write_corrupt <probability>`는 write bio에 같은 동작을 합니다.

두 random corruption option의 probability는 0에서 `1000000000` 사이 정수이며 각각 0%에서 100% corruption 확률을 뜻합니다.

Corruption option 적용
Enter down intervalMatch read/write directionCheck bio->bi_opf flags or probabilitySelect fixed or random byteReplace byte value

Down interval과 direction·flag 또는 probability 조건이 맞을 때 bio data를 변경합니다.

고정 byte corruption 예

80-88

첫 예는 READ bio의 32번째 byte를 값 1로 바꾸며 별도 flag 조건은 없습니다.

  corrupt_bio_byte 32 r 1 0

두 번째 예는 `REQ_META (=32)` flag가 있는 write bio의 224번째 byte를 값 0으로 바꿉니다.

  corrupt_bio_byte 224 w 0 32
corrupt_bio_byte 예
명령ByteDirectionValueFlags
`corrupt_bio_byte 32 r 1 0`32Read10
`corrupt_bio_byte 224 w 0 32`224Write0REQ_META=32

1-based byte 위치와 direction, replacement, required flag를 비교합니다.