mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
[0.4.9] cherry-pick [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 ;-).
(cherry picked from commit 30b836bf3f
)
This commit is contained in:
parent
a04d7c300e
commit
4af12f40ca
|
@ -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