mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 21:15:14 +00:00
Ext2FS: Zero out inode metadata when deleting them
This isn't strictly necessary but it seems like a reasonable thing to be doing. Note that we still populate the dtime field with the time of deletion.
This commit is contained in:
parent
bab24ce34c
commit
1da828b8bf
Notes:
sideshowbarker
2024-07-19 01:31:46 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/1da828b8bf9
1 changed files with 6 additions and 5 deletions
|
@ -522,11 +522,6 @@ void Ext2FS::free_inode(Ext2FSInode& inode)
|
|||
dbg() << "Ext2FS: Inode " << inode.identifier() << " has no more links, time to delete!";
|
||||
#endif
|
||||
|
||||
struct timeval now;
|
||||
kgettimeofday(now);
|
||||
inode.m_raw_inode.i_dtime = now.tv_sec;
|
||||
write_ext2_inode(inode.index(), inode.m_raw_inode);
|
||||
|
||||
auto block_list = block_list_for_inode(inode.m_raw_inode, true);
|
||||
|
||||
for (auto block_index : block_list) {
|
||||
|
@ -535,6 +530,12 @@ void Ext2FS::free_inode(Ext2FSInode& inode)
|
|||
set_block_allocation_state(block_index, false);
|
||||
}
|
||||
|
||||
struct timeval now;
|
||||
kgettimeofday(now);
|
||||
memset(&inode.m_raw_inode, 0, sizeof(ext2_inode));
|
||||
inode.m_raw_inode.i_dtime = now.tv_sec;
|
||||
write_ext2_inode(inode.index(), inode.m_raw_inode);
|
||||
|
||||
set_inode_allocation_state(inode.index(), false);
|
||||
|
||||
if (inode.is_directory()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue