Skip to content

Commit 244ede5

Browse files
committed
Kernel/SysFS: Remove unnecessary mutex lockers in SysFS metadata getters
SysFS inodes have immutable metadata once created.
1 parent 8ebf08b commit 244ede5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Kernel/FileSystem/SysFS.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ KResultOr<NonnullRefPtr<Inode>> SysFSInode::lookup(StringView)
113113

114114
InodeMetadata SysFSInode::metadata() const
115115
{
116-
MutexLocker locker(m_inode_lock);
116+
// NOTE: No locking required as m_associated_component or its component index will never change during our lifetime.
117117
InodeMetadata metadata;
118118
metadata.inode = { fsid(), m_associated_component->component_index() };
119119
metadata.mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
@@ -179,7 +179,7 @@ SysFSDirectoryInode::~SysFSDirectoryInode()
179179

180180
InodeMetadata SysFSDirectoryInode::metadata() const
181181
{
182-
MutexLocker locker(m_inode_lock);
182+
// NOTE: No locking required as m_associated_component or its component index will never change during our lifetime.
183183
InodeMetadata metadata;
184184
metadata.inode = { fsid(), m_associated_component->component_index() };
185185
metadata.mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IXOTH;

0 commit comments

Comments
 (0)