Skip to content

Commit

Permalink
FIXME: data corruption issue, introduced by last commit (Win8 BSOD)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-wu committed Aug 26, 2014
1 parent 6229c50 commit d22b46e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Ext3Fsd/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ Ext2ReadWriteBlockAsyncCompletionRoutine (
ExReleaseResourceForThread(pContext->Resource, pContext->ThreadId);
}

/* mark MasterIrp pending */
IoMarkIrpPending(pContext->MasterIrp);

Ext2FreePool(pContext, EXT2_RWC_MAGIC);
DEC_MEM_COUNT(PS_RW_CONTEXT, pContext, sizeof(EXT2_RW_CONTEXT));
}
Expand Down Expand Up @@ -288,7 +285,7 @@ Ext2ReadWriteBlocks(
}


if (NULL == Chain->Next) {
if (NULL == Chain->Next && 0 == Chain->Offset) {

/* we get only 1 extent to dispatch, then don't bother allocating new irps */

Expand All @@ -307,8 +304,8 @@ Ext2ReadWriteBlocks(
IoSetCompletionRoutine(
MasterIrp,
IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) ?
&Ext2ReadWriteBlockSyncCompletionRoutine :
&Ext2ReadWriteBlockAsyncCompletionRoutine,
Ext2ReadWriteBlockSyncCompletionRoutine :
Ext2ReadWriteBlockAsyncCompletionRoutine,
(PVOID) pContext,
TRUE,
TRUE,
Expand Down Expand Up @@ -359,8 +356,8 @@ Ext2ReadWriteBlocks(
IoSetCompletionRoutine(
Irp,
IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) ?
&Ext2ReadWriteBlockSyncCompletionRoutine :
&Ext2ReadWriteBlockAsyncCompletionRoutine,
Ext2ReadWriteBlockSyncCompletionRoutine :
Ext2ReadWriteBlockAsyncCompletionRoutine,
(PVOID) pContext,
TRUE,
TRUE,
Expand Down Expand Up @@ -392,6 +389,11 @@ Ext2ReadWriteBlocks(
}
}

if (!IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) {
/* mark MasterIrp pending */
IoMarkIrpPending(pContext->MasterIrp);
}

bBugCheck = TRUE;

for (Extent = Chain; Extent != NULL; Extent = Extent->Next) {
Expand All @@ -404,7 +406,6 @@ Ext2ReadWriteBlocks(
if (IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) {
KeWaitForSingleObject( &(pContext->Event),
Executive, KernelMode, FALSE, NULL );

KeClearEvent( &(pContext->Event) );
}

Expand Down

0 comments on commit d22b46e

Please sign in to comment.