mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[FASTFAT] Lock DirResource when modifying an entry on disk.
Likely not optimal, but fixes some races conditions where the directory is uninit in the middle of the write.
This commit is contained in:
parent
cca1a3f47f
commit
fc788cf2fd
1 changed files with 11 additions and 3 deletions
|
@ -1552,6 +1552,7 @@ VfatSetInformation(
|
||||||
PVFATFCB FCB;
|
PVFATFCB FCB;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PVOID SystemBuffer;
|
PVOID SystemBuffer;
|
||||||
|
BOOLEAN LockDir;
|
||||||
|
|
||||||
/* PRECONDITION */
|
/* PRECONDITION */
|
||||||
ASSERT(IrpContext);
|
ASSERT(IrpContext);
|
||||||
|
@ -1593,7 +1594,14 @@ VfatSetInformation(
|
||||||
DPRINT("Can set file size\n");
|
DPRINT("Can set file size\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileInformationClass == FileRenameInformation)
|
LockDir = FALSE;
|
||||||
|
if (FileInformationClass == FileRenameInformation || FileInformationClass == FileAllocationInformation ||
|
||||||
|
FileInformationClass == FileEndOfFileInformation || FileInformationClass == FileBasicInformation)
|
||||||
|
{
|
||||||
|
LockDir = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LockDir)
|
||||||
{
|
{
|
||||||
if (!ExAcquireResourceExclusiveLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource,
|
if (!ExAcquireResourceExclusiveLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource,
|
||||||
BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
|
BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
|
||||||
|
@ -1607,7 +1615,7 @@ VfatSetInformation(
|
||||||
if (!ExAcquireResourceExclusiveLite(&FCB->MainResource,
|
if (!ExAcquireResourceExclusiveLite(&FCB->MainResource,
|
||||||
BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
|
BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
|
||||||
{
|
{
|
||||||
if (FileInformationClass == FileRenameInformation)
|
if (LockDir)
|
||||||
{
|
{
|
||||||
ExReleaseResourceLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource);
|
ExReleaseResourceLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource);
|
||||||
}
|
}
|
||||||
|
@ -1662,7 +1670,7 @@ VfatSetInformation(
|
||||||
ExReleaseResourceLite(&FCB->MainResource);
|
ExReleaseResourceLite(&FCB->MainResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileInformationClass == FileRenameInformation)
|
if (LockDir)
|
||||||
{
|
{
|
||||||
ExReleaseResourceLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource);
|
ExReleaseResourceLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue