mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Collect leaked inode references in extfs.
This commit is contained in:
parent
01ee906d25
commit
52007a1793
2 changed files with 18 additions and 3 deletions
|
@ -781,12 +781,19 @@ int fsmarshall_main(const char* argv0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Garbage collect all open inode references.
|
||||||
|
while ( fs->mru_inode )
|
||||||
|
{
|
||||||
|
Inode* inode = fs->mru_inode;
|
||||||
|
if ( inode->remote_reference_count )
|
||||||
|
inode->RemoteUnref();
|
||||||
|
else if ( inode->reference_count )
|
||||||
|
inode->Unref();
|
||||||
|
}
|
||||||
|
|
||||||
// Sync the filesystem before shutting down.
|
// Sync the filesystem before shutting down.
|
||||||
if ( dev->write )
|
if ( dev->write )
|
||||||
{
|
|
||||||
// TODO: Need to close all open inodes here, and in the fuse backend too.
|
|
||||||
fs->Sync();
|
fs->Sync();
|
||||||
}
|
|
||||||
|
|
||||||
close(serverfd);
|
close(serverfd);
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,14 @@ void* ext2_fuse_init(struct fuse_conn_info* /*conn*/)
|
||||||
void ext2_fuse_destroy(void* fs_private)
|
void ext2_fuse_destroy(void* fs_private)
|
||||||
{
|
{
|
||||||
struct ext2_fuse_ctx* ext2_fuse_ctx = (struct ext2_fuse_ctx*) fs_private;
|
struct ext2_fuse_ctx* ext2_fuse_ctx = (struct ext2_fuse_ctx*) fs_private;
|
||||||
|
while ( ext2_fuse_ctx->fs->mru_inode )
|
||||||
|
{
|
||||||
|
Inode* inode = ext2_fuse_ctx->fs->mru_inode;
|
||||||
|
if ( inode->remote_reference_count )
|
||||||
|
inode->RemoteUnref();
|
||||||
|
else if ( inode->reference_count )
|
||||||
|
inode->Unref();
|
||||||
|
}
|
||||||
ext2_fuse_ctx->fs->Sync();
|
ext2_fuse_ctx->fs->Sync();
|
||||||
ext2_fuse_ctx->dev->Sync();
|
ext2_fuse_ctx->dev->Sync();
|
||||||
delete ext2_fuse_ctx->fs; ext2_fuse_ctx->fs = NULL;
|
delete ext2_fuse_ctx->fs; ext2_fuse_ctx->fs = NULL;
|
||||||
|
|
Loading…
Reference in a new issue