mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
Kernel: Make Inode::lookup() return a RefPtr<Inode>
Previously this API would return an InodeIdentifier, which meant that there was a race in path resolution where an inode could be unlinked in between finding the InodeIdentifier for a path component, and actually resolving that to an Inode object. Attaching a test that would quickly trip an assertion before. Test: Kernel/path-resolution-race.cpp
This commit is contained in:
parent
5aa37f6f5c
commit
c44b4d61f3
11 changed files with 50 additions and 36 deletions
|
@ -99,7 +99,7 @@ private:
|
|||
virtual ssize_t read_bytes(off_t, ssize_t, u8* buffer, FileDescription*) const override;
|
||||
virtual InodeMetadata metadata() const override;
|
||||
virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) const override;
|
||||
virtual InodeIdentifier lookup(StringView name) override;
|
||||
virtual RefPtr<Inode> lookup(StringView name) override;
|
||||
virtual void flush_metadata() override;
|
||||
virtual ssize_t write_bytes(off_t, ssize_t, const u8* buffer, FileDescription*) override;
|
||||
virtual KResult add_child(InodeIdentifier child_id, const StringView& name, mode_t) override;
|
||||
|
@ -125,7 +125,7 @@ private:
|
|||
virtual ssize_t read_bytes(off_t, ssize_t, u8*, FileDescription*) const override { ASSERT_NOT_REACHED(); }
|
||||
virtual InodeMetadata metadata() const override;
|
||||
virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) const override { ASSERT_NOT_REACHED(); }
|
||||
virtual InodeIdentifier lookup(StringView name) override;
|
||||
virtual RefPtr<Inode> lookup(StringView name) override;
|
||||
virtual void flush_metadata() override {};
|
||||
virtual ssize_t write_bytes(off_t, ssize_t, const u8*, FileDescription*) override { ASSERT_NOT_REACHED(); }
|
||||
virtual KResult add_child(InodeIdentifier child_id, const StringView& name, mode_t) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue