Changeset 769 for Whitix/branches

Show
Ignore:
Timestamp:
07/09/08 18:46:34 (5 months ago)
Author:
mwhitworth
Message:

Fix vNode locking behaviour to avoid races.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/fs/fs/vfs/vcache.c

    r700 r769  
    9898        ListAddTail(&newNode->next,&superBlock->vNodeList); 
    9999 
     100        VNodeLock(newNode); 
     101 
    100102        return newNode; 
    101103} 
     
    208210                return -EFAULT; 
    209211 
    210         VNodeLock(vNode); 
    211  
    212212        if (vNode->superBlock && vNode->superBlock->sbOps && vNode->superBlock->sbOps->readVNode) 
    213213                ret=vNode->superBlock->sbOps->readVNode(vNode); 
     
    224224        if (!vNode) 
    225225                return -EFAULT; 
    226                  
    227         VNodeLock(vNode); 
    228226         
    229227        if (vNode->superBlock && vNode->superBlock->sbOps && vNode->superBlock->sbOps->readVNodeWithData) 
    230228                ret=vNode->superBlock->sbOps->readVNodeWithData(vNode, data); 
    231                  
     229 
    232230        VNodeUnlock(vNode); 
    233231         
     
    280278void VNodeSyncAll() 
    281279{ 
    282         struct VNode* curr; 
     280        struct VNode* curr, *curr2; 
    283281        struct VfsSuperBlock* superBlock; 
    284282 
    285283        ListForEachEntry(superBlock,&sbList,sbList) 
    286284                /* Cycle through all vNodes. */ 
    287                 ListForEachEntry(curr,&superBlock->vNodeList,next) 
     285                ListForEachEntrySafe(curr, curr2, &superBlock->vNodeList, next) 
    288286                        if (curr->flags & VNODE_DIRTY) 
    289287                                VNodeWrite(curr); 
     
    345343                free(vNode->extraInfo); 
    346344 
     345        PreemptDisable(); 
    347346        ListRemove(&vNode->next); 
     347        PreemptEnable(); 
    348348 
    349349        if (vNode->superBlock)