mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +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
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!";
|
dbg() << "Ext2FS: Inode " << inode.identifier() << " has no more links, time to delete!";
|
||||||
#endif
|
#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);
|
auto block_list = block_list_for_inode(inode.m_raw_inode, true);
|
||||||
|
|
||||||
for (auto block_index : block_list) {
|
for (auto block_index : block_list) {
|
||||||
|
@ -535,6 +530,12 @@ void Ext2FS::free_inode(Ext2FSInode& inode)
|
||||||
set_block_allocation_state(block_index, false);
|
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);
|
set_inode_allocation_state(inode.index(), false);
|
||||||
|
|
||||||
if (inode.is_directory()) {
|
if (inode.is_directory()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue