https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1acb5a9fab662f65a3be4f...
commit 1acb5a9fab662f65a3be4fd319832edfe98cff6e Author: Pierre Schweitzer pierre@reactos.org AuthorDate: Fri Oct 12 08:20:32 2018 +0200 Commit: Pierre Schweitzer pierre@reactos.org CommitDate: Fri Oct 12 08:20:32 2018 +0200
[NTOSKRNL] Don't keep the spin lock hold too long when we lost the BCB race
This will avoid a deadlock on unpin. --- ntoskrnl/cc/pin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c index bba87960c3..b3906a9321 100644 --- a/ntoskrnl/cc/pin.c +++ b/ntoskrnl/cc/pin.c @@ -385,6 +385,8 @@ CcPinRead ( iBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, TRUE); if (iBcb != NULL) { + KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql); + /* Free our now unused BCB */ CcUnpinData(*Bcb);
@@ -414,8 +416,8 @@ CcPinRead (
/* Insert ourselves in the linked list */ InsertTailList(&SharedCacheMap->BcbList, &iBcb->BcbEntry); + KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql); } - KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql); } /* We found a BCB, lock it and return it */ else