1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:48:14 +00:00

Kernel: Guard the all processes list with a Spinlock rather than a Mutex

There are callers of processes().with or processes().for_each that
require interrupts to be disabled. Taking a Mutexe with interrupts
disabled is a recipe for deadlock, so convert this to a Spinlock.
This commit is contained in:
Andrew Kaster 2021-08-22 21:53:26 -06:00 committed by Andreas Kling
parent 70518e69f4
commit dea62fe93c
4 changed files with 13 additions and 13 deletions

View file

@ -916,7 +916,7 @@ KResult ProcFSRootDirectory::traverse_as_directory(unsigned fsid, Function<bool(
InodeIdentifier identifier = { fsid, component.component_index() };
callback({ component.name(), identifier, 0 });
}
processes().for_each_shared([&](Process& process) {
processes().for_each([&](Process& process) {
VERIFY(!(process.pid() < 0));
u64 process_id = (u64)process.pid().value();
InodeIdentifier identifier = { fsid, static_cast<InodeIndex>(process_id << 36) };