Skip to content

Commit

Permalink
fix(board): stop other VCPUs before returning errors
Browse files Browse the repository at this point in the history
Signed-off-by: Changyuan Lyu <[email protected]>
  • Loading branch information
Lencerf committed Jan 13, 2025
1 parent db11aab commit c015432
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions alioth/src/board/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,12 @@ where
self.sync_vcpus(&vcpus)?;
drop(vcpus);

let reboot = self.vcpu_loop(vcpu, id)?;
let maybe_reboot = self.vcpu_loop(vcpu, id);

let vcpus = self.vcpus.read();
let mut mp_sync = self.mp_sync.lock();
if mp_sync.state == BoardState::Running {
mp_sync.state = if reboot {
mp_sync.state = if !matches!(maybe_reboot, Ok(true)) {
BoardState::RebootPending
} else {
BoardState::Shutdown
Expand All @@ -359,6 +359,11 @@ where
}
}
}

if let Err(e) = maybe_reboot {
break Err(e);
}

self.sync_vcpus(&vcpus)?;

if id == 0 {
Expand Down

0 comments on commit c015432

Please sign in to comment.