Modules/Ext2 - Fixed not unlocking node lock for non-cached node (e.g. root)
authorJohn Hodge <[email protected]>
Wed, 15 Aug 2012 04:54:40 +0000 (12:54 +0800)
committerJohn Hodge <[email protected]>
Wed, 15 Aug 2012 04:54:40 +0000 (12:54 +0800)
KernelLand/Modules/Filesystems/Ext2/ext2.c

index 5c9f97a..460c4fb 100644 (file)
@@ -209,29 +209,40 @@ void Ext2_Unmount(tVFS_Node *Node)
 void Ext2_CloseFile(tVFS_Node *Node)\r
 {\r
        tExt2_Disk      *disk = Node->ImplPtr;\r
+       ENTER("pNode", Node);\r
 \r
        if( Mutex_Acquire(&Node->Lock) != 0 )\r
        {\r
+               LEAVE('-');\r
                return ;\r
        }\r
 \r
        if( Node->Flags & VFS_FFLAG_DIRTY )\r
        {\r
                // Commit changes\r
+               Log_Warning("Ext2", "TODO: Commit node changes");\r
        }\r
 \r
        int was_not_referenced = (Node->ImplInt == 0);\r
        tVFS_ACL        *acls = Node->ACLs;\r
-       if( Inode_UncacheNode(disk->CacheID, Node->Inode) )\r
+       if( Inode_UncacheNode(disk->CacheID, Node->Inode) == 1 )\r
        {\r
                if( was_not_referenced )\r
                {\r
+                       LOG("Removng inode");\r
                        // Remove inode\r
+                       Log_Warning("Ext2", "TODO: Remove inode when not deleted");\r
                }\r
                if( acls != &gVFS_ACL_EveryoneRW ) {\r
                        free(acls);\r
                }\r
+               LOG("Node cleaned");\r
        }\r
+       else {\r
+               LOG("Still referenced, releasing lock");\r
+               Mutex_Release(&Node->Lock);\r
+       }\r
+       LEAVE('-');\r
        return ;\r
 }\r
 \r

UCC git Repository :: git.ucc.asn.au