diff --git a/lib/wasix/src/fs/mod.rs b/lib/wasix/src/fs/mod.rs index 9b254206ae5..a1fe86e05d0 100644 --- a/lib/wasix/src/fs/mod.rs +++ b/lib/wasix/src/fs/mod.rs @@ -566,7 +566,13 @@ impl WasiFs { } } - pub fn clear_free_fd_list(&self) { + /// We need to clear the freed FD list when the journal is replayed as it + /// will close lots of file descriptors which will fill the list. We clear + /// the list and allocate new FD's instead. + /// + /// This should only be used when the file descriptors are being managed + /// externally (e.g. journals) + pub(crate) fn clear_freed_fd_list(&self) { let mut freed_fds = self.freed_fds.write().unwrap(); freed_fds.clear(); } diff --git a/lib/wasix/src/syscalls/journal/restore_snapshot.rs b/lib/wasix/src/syscalls/journal/restore_snapshot.rs index 930447349e6..2f2699194bc 100644 --- a/lib/wasix/src/syscalls/journal/restore_snapshot.rs +++ b/lib/wasix/src/syscalls/journal/restore_snapshot.rs @@ -64,7 +64,7 @@ pub unsafe fn restore_snapshot( // Reset the freed FD's so that none of them will be reused after // the journal resumes - runner.ctx.data().state().fs.clear_free_fd_list(); + runner.ctx.data().state().fs.clear_freed_fd_list(); // Once we get to this point we are no longer replaying the journal // and need to clear this flag, the reason is that restoring the