mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
Kernel/Ext2FS: Uncache unknown inode indices when flushing writes
Ext2FS::get_inode() will remember unknown inode indices that it has been asked about and put them into the inode cache as null inodes. flush_writes() was not null-checking these while iterating, which was a bug I finally managed to hit. Flushing also seemed like a good time to drop unknown inodes from the cache, since there's no good reason to hold to them indefinitely.
This commit is contained in:
parent
a7d193951f
commit
98c230b370
Notes:
sideshowbarker
2024-07-18 08:57:06 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/98c230b3704
1 changed files with 7 additions and 0 deletions
|
@ -718,6 +718,13 @@ void Ext2FS::flush_writes()
|
|||
// for their (child name lookup) and (block list) caches.
|
||||
Vector<InodeIndex> unused_inodes;
|
||||
for (auto& it : m_inode_cache) {
|
||||
// NOTE: If we're asked to look up an inode by number (via get_inode) and it turns out
|
||||
// to not exist, we remember the fact that it doesn't exist by caching a nullptr.
|
||||
// This seems like a reasonable time to uncache ideas about unknown inodes, so do that.
|
||||
if (!it.value) {
|
||||
unused_inodes.append(it.key);
|
||||
continue;
|
||||
}
|
||||
if (it.value->ref_count() != 1)
|
||||
continue;
|
||||
if (it.value->has_watchers())
|
||||
|
|
Loading…
Add table
Reference in a new issue