mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[FASTFAT] When extending a file, also lock the DirResource.
This avoids race conditions under high IOs and thus corruption on the FS, or assertions failures in the kernel. Easily triggered by building ReactOS on ReactOS ;-).
This commit is contained in:
parent
0fbaea843e
commit
30b836bf3f
1 changed files with 9 additions and 0 deletions
|
@ -1064,9 +1064,18 @@ VfatWrite(
|
||||||
ByteOffset.u.LowPart + Length > Fcb->RFCB.FileSize.u.LowPart)
|
ByteOffset.u.LowPart + Length > Fcb->RFCB.FileSize.u.LowPart)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER AllocationSize;
|
LARGE_INTEGER AllocationSize;
|
||||||
|
|
||||||
|
if (!ExAcquireResourceExclusiveLite(&IrpContext->DeviceExt->DirResource, CanWait))
|
||||||
|
{
|
||||||
|
goto ByeBye;
|
||||||
|
}
|
||||||
|
|
||||||
AllocationSize.QuadPart = ByteOffset.u.LowPart + Length;
|
AllocationSize.QuadPart = ByteOffset.u.LowPart + Length;
|
||||||
Status = VfatSetAllocationSizeInformation(IrpContext->FileObject, Fcb,
|
Status = VfatSetAllocationSizeInformation(IrpContext->FileObject, Fcb,
|
||||||
IrpContext->DeviceExt, &AllocationSize);
|
IrpContext->DeviceExt, &AllocationSize);
|
||||||
|
|
||||||
|
ExReleaseResourceLite(&IrpContext->DeviceExt->DirResource);
|
||||||
|
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
{
|
{
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
|
|
Loading…
Reference in a new issue