Possible fix to race condition to EBADF

This commit is contained in:
Wildan M
2026-05-15 22:46:03 +07:00
parent 8c9def2d73
commit 7c653c5182
+4 -1
View File
@@ -71,8 +71,11 @@ impl UnmapResult {
return Ok(());
};
/// TODO: This is not ideal, the lock must be held until try_close(), however that would break borrowing rules.
/// Proper unmap operation would be a recursive operation, since closing a file can trigger another unmap().
/// We should refactor Result of munmap() to handle unmap and closing files recursively.
let (scheme_id, number) = {
let desc = description.read(token.token());
let desc = description.write(token.token());
(desc.scheme, desc.number)
};