Commit c193457
fix(satellite,rest): close last-UpToDate-delete race on Secondary SyncSource (BUG-045) (#159)
* fix(satellite): stamp diskState=UpToDate for Secondary SyncSource (BUG-045)
A diskful replica that is Secondary and acts as the SyncSource for a
freshly-added SyncTarget peer could end up with a blank
.status.volumes[].diskState in the CRD projection. On a Secondary
SyncSource drbd-9 does not re-emit a local `device` frame carrying
`disk:UpToDate` (the local disk-state did not transition), so when the
volume-cache entry is (re)created by the peer-device `replication:
SyncSource` frame it carries an empty DiskState and the projection
leaves diskState blank.
That blank diskState is the load-bearing input the U130 last-copy
delete guard reads, so it could false-allow deleting the only UpToDate
source while a peer is mid-sync, stranding the SyncTarget with no source
(a data-availability loss).
Fix: when the observer sees a peer-device `replication:SyncSource`
frame, stamp the local volume's DiskState=UpToDate. A SyncSource feeds
a peer's resync only from an UpToDate local disk, so this is a hard DRBD
invariant. The stamp is idempotent and never downgrades a richer
local-frame observation (mergeVolumeInto only upgrades to a non-empty
value, and UpToDate is the terminal disk-state).
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
* fix(rest): make U130 last-copy delete guard fail safe (BUG-045)
The U130 guard decided whether deleting the last UpToDate diskful
replica would strand a mid-sync peer solely from the CRD `diskState`
projection. When the satellite observer left a live source's diskState
blank (the Secondary SyncSource race), the guard concluded the target
was "not a source" and allowed the destructive delete, stranding the
SyncTarget with no UpToDate source.
Harden the guard to fail safe — when it cannot positively confirm that
another UpToDate copy would survive, it refuses:
- Treat a SyncSource replication-state as kernel ground truth that a
replica holds an UpToDate copy (a SyncSource only feeds a resync from
an UpToDate local disk), so a lagging/blank diskState no longer hides
a real source. This applies to both the target (do not conclude
"not a source") and the siblings (a SyncSource sibling counts as a
surviving source, avoiding over-refusal of legitimate deletes).
- Treat an empty/unknown diskState on a diskful target conservatively:
while a peer is mid-sync, refuse the last-copy delete rather than
trust an unstamped projection. A false refusal only asks the operator
to wait or pass `?force=true`; a false allow is unrecoverable.
Legitimate last-copy deletes (no peer mid-sync) and the `?force=true`
override are unaffected.
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
---------
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>1 parent d1d583f commit c193457
4 files changed
Lines changed: 458 additions & 12 deletions
File tree
- pkg
- rest
- satellite/controllers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
68 | 85 | | |
69 | 86 | | |
70 | 87 | | |
71 | 88 | | |
72 | 89 | | |
73 | 90 | | |
74 | 91 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
78 | 102 | | |
79 | 103 | | |
80 | 104 | | |
81 | | - | |
| 105 | + | |
82 | 106 | | |
83 | 107 | | |
84 | 108 | | |
| |||
92 | 116 | | |
93 | 117 | | |
94 | 118 | | |
95 | | - | |
96 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
97 | 124 | | |
98 | 125 | | |
99 | 126 | | |
100 | 127 | | |
101 | 128 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
106 | 133 | | |
107 | 134 | | |
108 | 135 | | |
109 | | - | |
110 | | - | |
| 136 | + | |
| 137 | + | |
111 | 138 | | |
112 | 139 | | |
113 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
114 | 204 | | |
115 | 205 | | |
116 | 206 | | |
| |||
169 | 259 | | |
170 | 260 | | |
171 | 261 | | |
| 262 | + | |
172 | 263 | | |
173 | 264 | | |
174 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
68 | 91 | | |
69 | 92 | | |
70 | 93 | | |
| |||
161 | 184 | | |
162 | 185 | | |
163 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
164 | 300 | | |
165 | 301 | | |
166 | 302 | | |
| |||
346 | 482 | | |
347 | 483 | | |
348 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
349 | 530 | | |
350 | 531 | | |
351 | 532 | | |
| |||
0 commit comments