From 65e083ed36c6b2c8baa5d2b5957ba8ec5f7ee29e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 26 Feb 2021 14:57:00 +0100 Subject: [PATCH] Revert "Ext2FS: Don't reload already-cached block list when freeing inode" This reverts commit 1e737a5c50837a9746bcbf8762f9f45caa332787. The cached block list does not include meta-blocks, so we'd end up leaking those. There's definitely a nice way to avoid work here, but it turns out it wasn't quite this trivial. Reverting for now. --- Kernel/FileSystem/Ext2FileSystem.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index c9247eb731..4fcca1d199 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -543,10 +543,8 @@ void Ext2FS::free_inode(Ext2FSInode& inode) dbgln_if(EXT2_DEBUG, "Ext2FS: Inode {} has no more links, time to delete!", inode.index()); // Mark all blocks used by this inode as free. - if (inode.m_block_list.is_empty()) - inode.m_block_list = block_list_for_inode(inode.m_raw_inode, true); - - for (auto block_index : inode.m_block_list) { + auto block_list = block_list_for_inode(inode.m_raw_inode, true); + for (auto block_index : block_list) { VERIFY(block_index <= super_block().s_blocks_count); if (block_index.value()) { auto result = set_block_allocation_state(block_index, false);