summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/VirtualFileSystem.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-08-06 04:22:20 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2022-09-16 14:55:45 +0300
commitc88cc8557f20668f575dc07d197b8189c94e46af (patch)
tree0906ecebd1b7db95154f730468170f08f54e1482 /Kernel/FileSystem/VirtualFileSystem.cpp
parent4f4717e3518e274012c77bd2143df00604e56db4 (diff)
downloadserenity-c88cc8557f20668f575dc07d197b8189c94e46af.zip
Kernel/FileSystem: Make Inode::{write,read}_bytes methods non-virtual
We make these methods non-virtual because we want to ensure we properly enforce locking of the m_inode_lock mutex. Also, for write operations, we want to call prepare_to_write_data before the actual write. The previous design required us to ensure the callers do that at various places which lead to hard-to-find bugs. By moving everything to a place where we call prepare_to_write_data only once, we eliminate a possibilty of forgeting to call it on some code path in the kernel.
Diffstat (limited to 'Kernel/FileSystem/VirtualFileSystem.cpp')
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index b10645d74c..1a120a9d1f 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -703,8 +703,6 @@ ErrorOr<void> VirtualFileSystem::symlink(Credentials const& credentials, StringV
auto inode = TRY(parent_inode.create_child(basename, S_IFLNK | 0644, 0, credentials.euid(), credentials.egid()));
auto target_buffer = UserOrKernelBuffer::for_kernel_buffer(const_cast<u8*>((u8 const*)target.characters_without_null_termination()));
- MutexLocker locker(inode->m_inode_lock);
- TRY(inode->prepare_to_write_data());
TRY(inode->write_bytes(0, target.length(), target_buffer, nullptr));
return {};
}