summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-02-04 13:53:37 +0000
committerAndreas Kling <kling@serenityos.org>2023-02-06 20:36:53 +0100
commitb26ecca970e49dd974fb1b620ab6bec80f5f6670 (patch)
tree4c1ed7ad6c9f2c88de2e1cb9804bef92572b5702
parentcc558d95f0c5fc673b7cc4cf1caa3b279211cf66 (diff)
downloadserenity-b26ecca970e49dd974fb1b620ab6bec80f5f6670.zip
Kernel: Remove create_inode_watcher syscall from the big lock
-rw-r--r--Kernel/API/Syscall.h2
-rw-r--r--Kernel/Syscalls/inode_watcher.cpp4
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<FlatPtr> 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<FlatPtr> Process::sys$create_inode_watcher(u32 flags)
description->set_blocking(false);
return m_fds.with_exclusive([&](auto& fds) -> ErrorOr<FlatPtr> {
+ auto fd_allocation = TRY(fds.allocate());
fds[fd_allocation.fd].set(move(description));
if (flags & static_cast<unsigned>(InodeWatcherFlags::CloseOnExec))