Skip to content

Commit ba95374

Browse files
authored
Handle final live-repair flush being skipped on all downstairs (#1783)
If live-repair submits its final flush while all downstairs are faulted, then the flush is skipped on every downstairs. This means that it's immediately retired from `ds_active`, so subsequent calls to `check_and_continue_live_repair` will never see it as complete. The live-repair state is stuck at `Some(LiveRepairState::FinalFlush { .. })` forever. This PR adds a check for this special case!
1 parent d597617 commit ba95374

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

upstairs/src/downstairs.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,11 +1269,26 @@ impl Downstairs {
12691269
info!(self.log, "LiveRepair final flush submitted");
12701270
cdt::up__to__ds__flush__start!(|| flush_id.0);
12711271

1272+
// If all downstairs are inactive, then the flush will be
1273+
// immediately skipped by `submit_flush`. We have to
1274+
// manually set that result in the `PendingJob`; otherwise,
1275+
// the live-repair will never be resolved. We detect this
1276+
// case when the flush is absent from `ds_active` (because
1277+
// it immediately retired itself upon submission).
1278+
let mut flush_job = PendingJob::new(flush_id);
1279+
if self.ds_active.get(&flush_id).is_none() {
1280+
info!(
1281+
self.log,
1282+
"LiveRepair final flush was skipped everywhere"
1283+
);
1284+
flush_job.result = Some(Err(CrucibleError::IoError(
1285+
"job was skipped on all downstairs".to_owned(),
1286+
)));
1287+
}
1288+
12721289
// The borrow was dropped earlier, so reborrow `self.repair`
12731290
self.repair.as_mut().unwrap().state =
1274-
LiveRepairState::FinalFlush {
1275-
flush_job: PendingJob::new(flush_id),
1276-
}
1291+
LiveRepairState::FinalFlush { flush_job }
12771292
} else {
12781293
let repair_id = repair.id;
12791294
self.notify_live_repair_progress(repair_id, next_extent);

0 commit comments

Comments
 (0)