[NTFS]
[reactos.git] / reactos / drivers / filesystems / ntfs / cleanup.c
index 4ac09f3..b822711 100644 (file)
@@ -106,7 +106,16 @@ NtfsCleanup(PNTFS_IRP_CONTEXT IrpContext)
     FileObject = IrpContext->FileObject;
     DeviceExtension = DeviceObject->DeviceExtension;
 
+    if (!ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource,
+                                        BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
+    {
+        return NtfsMarkIrpContextForQueue(IrpContext);
+    }
+
     Status = NtfsCleanupFile(DeviceExtension, FileObject, BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT));
+
+    ExReleaseResourceLite(&DeviceExtension->DirResource);
+
     if (Status == STATUS_PENDING)
     {
         return NtfsMarkIrpContextForQueue(IrpContext);