[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Tue, 23 Feb 2016 20:45:11 +0000 (20:45 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Tue, 23 Feb 2016 20:45:11 +0000 (20:45 +0000)
Moar locking
Any resemblance to previous commit, living or dead, is purely coincidental

svn path=/trunk/; revision=70778

reactos/drivers/filesystems/ntfs/close.c

index 79ef82c..008f453 100644 (file)
@@ -101,8 +101,21 @@ NtfsClose(PNTFS_IRP_CONTEXT IrpContext)
     FileObject = IrpContext->FileObject;
     DeviceExtension = DeviceObject->DeviceExtension;
 
     FileObject = IrpContext->FileObject;
     DeviceExtension = DeviceObject->DeviceExtension;
 
+    if (!ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource,
+                                        BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
+    {
+        return NtfsMarkIrpContextForQueue(IrpContext);
+    }
+
     Status = NtfsCloseFile(DeviceExtension, FileObject);
 
     Status = NtfsCloseFile(DeviceExtension, FileObject);
 
+    ExReleaseResourceLite(&DeviceExtension->DirResource);
+
+    if (Status == STATUS_PENDING)
+    {
+        return NtfsMarkIrpContextForQueue(IrpContext);
+    }
+
     IrpContext->Irp->IoStatus.Information = 0;
     return Status;
 }
     IrpContext->Irp->IoStatus.Information = 0;
     return Status;
 }