Commit 3e3436c
Vlad Tudose
trimwrite: do not terminate between a trim and its paired write
In trimwrite mode each block is trimmed and then written back by two
consecutive io_us, paired via the per-file last_start markers in
set_rw_ddir(). The do_io() termination checks (runtime_exceeded and
the bytes_issued budget) run once per io_u with no awareness of the
pairing, so a time_based or byte-bounded run can stop after issuing a
trim but before its paired write: the final block is left deallocated
("dangling trim") and replay-based verification of the write_iolog
false-fails with "bad magic" on that range. Reproduces on effectively
every time_based trimwrite run.
Defer termination while a pair is open so the loop issues exactly one
more io_u (the paired write) and terminates on the next iteration.
Validated on a loop device: 10/10 time_based runs ended on a dangling
trim (trims == writes+1, iolog replay failing "bad magic") before,
0/10 after with replay passing; loops-bounded runs issue identical op
counts (already pair-complete), so their behavior is unchanged.
Fixes: #2122
Signed-off-by: Vlad Tudose <tudosevt@amazon.com>1 parent c76c61b commit 3e3436c
1 file changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1150 | 1150 | | |
1151 | 1151 | | |
1152 | 1152 | | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
1153 | 1164 | | |
1154 | 1165 | | |
1155 | 1166 | | |
| |||
1211 | 1222 | | |
1212 | 1223 | | |
1213 | 1224 | | |
1214 | | - | |
| 1225 | + | |
| 1226 | + | |
1215 | 1227 | | |
1216 | 1228 | | |
1217 | 1229 | | |
| |||
1228 | 1240 | | |
1229 | 1241 | | |
1230 | 1242 | | |
| 1243 | + | |
1231 | 1244 | | |
1232 | 1245 | | |
1233 | 1246 | | |
| |||
0 commit comments