Skip to content

Commit 6e02a96

Browse files
john-sharratttheduke
authored andcommitted
Added a patch for corrupt freed FD lists after replaying journals
1 parent 9a7b33a commit 6e02a96

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/wasix/src/fs/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,11 @@ impl WasiFs {
566566
}
567567
}
568568

569+
pub fn clear_free_fd_list(&self) {
570+
let mut freed_fds = self.freed_fds.write().unwrap();
571+
freed_fds.clear();
572+
}
573+
569574
/// Closes all the file handles.
570575
#[allow(clippy::await_holding_lock)]
571576
pub async fn close_all(&self) {

lib/wasix/src/syscalls/journal/restore_snapshot.rs

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ pub unsafe fn restore_snapshot(
6262
.map_err(anyhow_err_to_runtime_err)?;
6363
}
6464

65+
// Reset the freed FD's so that none of them will be reused after
66+
// the journal resumes
67+
runner.ctx.data().state().fs.clear_free_fd_list();
68+
6569
// Once we get to this point we are no longer replaying the journal
6670
// and need to clear this flag, the reason is that restoring the
6771
// background threads may immediately process requests while this

0 commit comments

Comments
 (0)