Commit ff98d6c
M9.R.42.1: characterise the sgdisk + udev race via REPRO_DISK_DIAG
PHASE A of M9.R.42 — per the M9.R.41.13 close-out + user's standing
"diagnose before speculating on fixes" principle: instrument
disk_apply.nim with a kernel-state snapshot hook before proposing
ANY fix shape.
When REPRO_DISK_DIAG=<path> is set, applyDiskLayout appends a
labelled snapshot block to <path> around every sgdisk + partprobe
call. Each block captures:
- /proc/partitions
- ls -la /dev/<diskBase>* (the partition device nodes)
- ls /sys/class/block
- ls /sys/block/<diskBase>/ + ../size
- ls /dev/disk/by-partuuid
- udevadm settle --timeout=10 + its exit code
The snapshots fire at six labelled boundaries per disk:
before-table-<diskName> / after-table-<diskName>
before-sgdisk-n-<partName> / after-sgdisk-n-<partName> (per part)
before-partprobe-<diskName> / after-partprobe-<diskName>
This gives the M9.R.41.13 evidence audit the time-series of
kernel state needed to determine whether sgdisk's exit-4 false
alarm is:
(a) udev hasn't drained when our validation runs → fix: udevadm settle
(b) sgdisk genuinely buggy in this kernel/virtio combo → fix: sfdisk swap
(c) intermittent BLKRRPART race → fix: bounded retry
3 unit tests in t_m9r42_1_disk_diag_hook.nim pin the behaviour:
1. diag OFF (env unset) → no file IO, hot path stays clean
2. snapshotKernelState renders the label/device header + each
"$ <cmd>" probe line
3. diag ON wires through applyDiskLayout: every labelled
before/after pair lands in the diag file (verified against
a 2-partition fixture)
Existing t_m9r22b_1 + t_m9r22b_3 tests still pass. This is
purely additive: no behavior change when REPRO_DISK_DIAG is
unset.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9a5ec1b commit ff98d6c
2 files changed
Lines changed: 229 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
23 | 31 | | |
24 | | - | |
| 32 | + | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
| |||
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
64 | 148 | | |
65 | 149 | | |
66 | 150 | | |
| |||
124 | 208 | | |
125 | 209 | | |
126 | 210 | | |
| 211 | + | |
127 | 212 | | |
128 | 213 | | |
129 | 214 | | |
| |||
133 | 218 | | |
134 | 219 | | |
135 | 220 | | |
| 221 | + | |
136 | 222 | | |
137 | 223 | | |
138 | 224 | | |
| |||
148 | 234 | | |
149 | 235 | | |
150 | 236 | | |
| 237 | + | |
151 | 238 | | |
152 | 239 | | |
| 240 | + | |
153 | 241 | | |
154 | 242 | | |
155 | 243 | | |
156 | 244 | | |
157 | 245 | | |
158 | 246 | | |
| 247 | + | |
159 | 248 | | |
160 | 249 | | |
| 250 | + | |
161 | 251 | | |
162 | 252 | | |
163 | 253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
0 commit comments