branch update for HEAD-2003021201
[reactos.git] / drivers / fs / vfat / close.c
index 6dffc5c..7fae9a7 100644 (file)
@@ -56,26 +56,18 @@ VfatCloseFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject)
       if (pFcb->Flags & FCB_DELETE_PENDING)
       {
         delEntry (DeviceExt, FileObject);
-       pFcb->Flags &= ~FCB_UPDATE_DIRENTRY;
       }
       else
        Status = STATUS_DELETE_PENDING;
     }
-    if (pFcb->Flags & FCB_UPDATE_DIRENTRY)
-    {
-       VfatUpdateEntry (DeviceExt, FileObject);
-       pFcb->Flags &= ~FCB_UPDATE_DIRENTRY;
-    }
     FileObject->FsContext2 = NULL;
     vfatReleaseFCB (DeviceExt, pFcb);
   }
   else
     FileObject->FsContext2 = NULL;
 
-  if (pCcb->DirectorySearchPattern)
-    ExFreePool(pCcb->DirectorySearchPattern);
-  ExFreePool (pCcb);
-
+  vfatDestroyCCB(pCcb);
+  
   return  Status;
 }
 
@@ -94,8 +86,13 @@ NTSTATUS VfatClose (PVFAT_IRP_CONTEXT IrpContext)
       Status = STATUS_SUCCESS;
       goto ByeBye;
     }
-
+#if 0
+  /* There occurs a dead look at the call to CcRosDeleteFileCache/ObDereferenceObject/VfatClose 
+     in CmLazyCloseThreadMain if VfatClose is execute asynchronous in a worker thread. */
   if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
+#else
+  if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, TRUE))
+#endif
   {
      return VfatQueueRequest (IrpContext);
   }