From 8e54c94fa54a975f1eea55e4dda475251d5445b6 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 15 Aug 2012 12:54:40 +0800 Subject: [PATCH] Modules/Ext2 - Fixed not unlocking node lock for non-cached node (e.g. root) --- KernelLand/Modules/Filesystems/Ext2/ext2.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/KernelLand/Modules/Filesystems/Ext2/ext2.c b/KernelLand/Modules/Filesystems/Ext2/ext2.c index 5c9f97a5..460c4fbb 100644 --- a/KernelLand/Modules/Filesystems/Ext2/ext2.c +++ b/KernelLand/Modules/Filesystems/Ext2/ext2.c @@ -209,29 +209,40 @@ void Ext2_Unmount(tVFS_Node *Node) void Ext2_CloseFile(tVFS_Node *Node) { tExt2_Disk *disk = Node->ImplPtr; + ENTER("pNode", Node); if( Mutex_Acquire(&Node->Lock) != 0 ) { + LEAVE('-'); return ; } if( Node->Flags & VFS_FFLAG_DIRTY ) { // Commit changes + Log_Warning("Ext2", "TODO: Commit node changes"); } int was_not_referenced = (Node->ImplInt == 0); tVFS_ACL *acls = Node->ACLs; - if( Inode_UncacheNode(disk->CacheID, Node->Inode) ) + if( Inode_UncacheNode(disk->CacheID, Node->Inode) == 1 ) { if( was_not_referenced ) { + LOG("Removng inode"); // Remove inode + Log_Warning("Ext2", "TODO: Remove inode when not deleted"); } if( acls != &gVFS_ACL_EveryoneRW ) { free(acls); } + LOG("Node cleaned"); } + else { + LOG("Still referenced, releasing lock"); + Mutex_Release(&Node->Lock); + } + LEAVE('-'); return ; } -- 2.20.1