1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

Kernel/FileSystem: Enforce locking of m_inode_lock when truncating Inode

Such operation is almost equivalent to writing on an Inode, so lock the
Inode m_inode_lock exclusively.
All FileSystem Inode implementations then override a new method called
truncate_locked which should implement the actual truncating.
This commit is contained in:
Liav A 2024-02-10 12:49:31 +02:00 committed by Andrew Kaster
parent 53dd04e219
commit b63a1dda63
13 changed files with 23 additions and 14 deletions

View file

@ -50,7 +50,7 @@ private:
virtual ErrorOr<void> chmod(mode_t) override { return EROFS; }
virtual ErrorOr<void> chown(UserID, GroupID) override { return EROFS; }
virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override { return EROFS; }
virtual ErrorOr<void> truncate(u64) override { return EROFS; }
virtual ErrorOr<void> truncate_locked(u64) override { return EROFS; }
// ^Inode (Silent ignore handling)
virtual ErrorOr<void> flush_metadata() override { return {}; }