From: John Hodge Date: Wed, 15 Aug 2012 04:54:40 +0000 (+0800) Subject: Modules/Ext2 - Fixed not unlocking node lock for non-cached node (e.g. root) X-Git-Tag: rel0.15~706^2~42 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=8e54c94fa54a975f1eea55e4dda475251d5445b6;p=tpg%2Facess2.git Modules/Ext2 - Fixed not unlocking node lock for non-cached node (e.g. root) --- 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 ; }