From b26ecca970e49dd974fb1b620ab6bec80f5f6670 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Sat, 4 Feb 2023 13:53:37 +0000 Subject: [PATCH] Kernel: Remove create_inode_watcher syscall from the big lock --- Kernel/API/Syscall.h | 2 +- Kernel/Syscalls/inode_watcher.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Kernel/API/Syscall.h b/Kernel/API/Syscall.h index 22dd954d53..2de0b8f337 100644 --- a/Kernel/API/Syscall.h +++ b/Kernel/API/Syscall.h @@ -59,7 +59,7 @@ enum class NeedsBigProcessLock { S(clock_settime, NeedsBigProcessLock::No) \ S(close, NeedsBigProcessLock::No) \ S(connect, NeedsBigProcessLock::No) \ - S(create_inode_watcher, NeedsBigProcessLock::Yes) \ + S(create_inode_watcher, NeedsBigProcessLock::No) \ S(create_thread, NeedsBigProcessLock::Yes) \ S(dbgputstr, NeedsBigProcessLock::No) \ S(detach_thread, NeedsBigProcessLock::Yes) \ diff --git a/Kernel/Syscalls/inode_watcher.cpp b/Kernel/Syscalls/inode_watcher.cpp index 8e27d33796..2cbbe24ebc 100644 --- a/Kernel/Syscalls/inode_watcher.cpp +++ b/Kernel/Syscalls/inode_watcher.cpp @@ -16,10 +16,9 @@ namespace Kernel { ErrorOr Process::sys$create_inode_watcher(u32 flags) { - VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this); + VERIFY_NO_PROCESS_BIG_LOCK(this); TRY(require_promise(Pledge::rpath)); - auto fd_allocation = TRY(allocate_fd()); auto watcher = TRY(InodeWatcher::try_create()); auto description = TRY(OpenFileDescription::try_create(move(watcher))); @@ -28,6 +27,7 @@ ErrorOr Process::sys$create_inode_watcher(u32 flags) description->set_blocking(false); return m_fds.with_exclusive([&](auto& fds) -> ErrorOr { + auto fd_allocation = TRY(fds.allocate()); fds[fd_allocation.fd].set(move(description)); if (flags & static_cast(InodeWatcherFlags::CloseOnExec))