- Do CmpShutdownWorkers only when the registry was actually initialized.

- Guard HvSyncHive with a flusher lock in CmpDoFlushAll.
- Misc typo fixes / spaces cleanup in cmlazy.c.

svn path=/trunk/; revision=31430
This commit is contained in:
Aleksey Bragin 2007-12-25 12:35:15 +00:00
parent c60950760b
commit 13db85781b
3 changed files with 16 additions and 8 deletions

View file

@ -38,9 +38,15 @@ CmpDoFlushAll(IN BOOLEAN ForceFlush)
Hive = CONTAINING_RECORD(NextEntry, CMHIVE, HiveList); Hive = CONTAINING_RECORD(NextEntry, CMHIVE, HiveList);
if (!(Hive->Hive.HiveFlags & HIVE_NOLAZYFLUSH)) if (!(Hive->Hive.HiveFlags & HIVE_NOLAZYFLUSH))
{ {
/* Acquire the flusher lock */
ExAcquirePushLockExclusive((PVOID)&Hive->FlusherLock);
/* Do the sync */ /* Do the sync */
Status = HvSyncHive(&Hive->Hive); Status = HvSyncHive(&Hive->Hive);
if (!NT_SUCCESS(Status)) Result = FALSE; if (!NT_SUCCESS(Status)) Result = FALSE;
/* Release the flusher lock */
ExReleasePushLock((PVOID)&Hive->FlusherLock);
} }
/* Try the next entry */ /* Try the next entry */

View file

@ -187,7 +187,7 @@ CmpLazyFlushWorker(IN PVOID Parameter)
} }
/* Flush the next hive */ /* Flush the next hive */
MoreWork = CmpDoFlushNextHive(ForceFlush, &Result, &DirtyCount); MoreWork = CmpDoFlushNextHive(ForceFlush, &Result, &DirtyCount);
if (!MoreWork) if (!MoreWork)
{ {
/* We're done */ /* We're done */
@ -232,7 +232,7 @@ CmpCmdInit(IN BOOLEAN SetupBoot)
KeSetTimer(&CmpEnableLazyFlushTimer, DueTime, &CmpEnableLazyFlushDpc); KeSetTimer(&CmpEnableLazyFlushTimer, DueTime, &CmpEnableLazyFlushDpc);
/* Setup flush variables */ /* Setup flush variables */
CmpNoWrite = CmpMiniNTBoot; CmpNoWrite = CmpMiniNTBoot;
CmpWasSetupBoot = SetupBoot; CmpWasSetupBoot = SetupBoot;
/* Testing: Force Lazy Flushing */ /* Testing: Force Lazy Flushing */
@ -260,7 +260,7 @@ CmpCmdHiveOpen(IN POBJECT_ATTRIBUTES FileAttributes,
0, 0,
NewHive, NewHive,
Allocate, Allocate,
CheckFlags); CheckFlags);
if (((Status == STATUS_ACCESS_DENIED) || if (((Status == STATUS_ACCESS_DENIED) ||
(Status == STATUS_NO_SUCH_USER) || (Status == STATUS_NO_SUCH_USER) ||
(Status == STATUS_WRONG_PASSWORD) || (Status == STATUS_WRONG_PASSWORD) ||
@ -278,8 +278,8 @@ CmpCmdHiveOpen(IN POBJECT_ATTRIBUTES FileAttributes,
0, 0,
NewHive, NewHive,
Allocate, Allocate,
CheckFlags); CheckFlags);
/* Restore impersonation token */ /* Restore impersonation token */
PsRevertToSelf(); PsRevertToSelf();
} }

View file

@ -30,6 +30,8 @@ BOOLEAN CmpNoWrite;
BOOLEAN CmpForceForceFlush; BOOLEAN CmpForceForceFlush;
BOOLEAN CmpWasSetupBoot; BOOLEAN CmpWasSetupBoot;
extern BOOLEAN CmFirstTime;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
@ -1637,7 +1639,7 @@ CmpReleaseTwoKcbLockByKey(IN ULONG ConvKey1,
{ {
ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey1).Owner == KeGetCurrentThread()) || ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey1).Owner == KeGetCurrentThread()) ||
(CmpTestRegistryLockExclusive())); (CmpTestRegistryLockExclusive()));
CmpReleaseKcbLockByKey(ConvKey1); CmpReleaseKcbLockByKey(ConvKey1);
} }
CmpReleaseKcbLockByKey(ConvKey2); CmpReleaseKcbLockByKey(ConvKey2);
} }
@ -1647,7 +1649,7 @@ VOID
NTAPI NTAPI
CmShutdownSystem(VOID) CmShutdownSystem(VOID)
{ {
/* Kill the workers and fush all hives */ /* Kill the workers and flush all hives */
CmpShutdownWorkers(); if (!CmFirstTime) CmpShutdownWorkers();
CmpDoFlushAll(TRUE); CmpDoFlushAll(TRUE);
} }