Index: /trunk/src/kWorker/Makefile.kmk
===================================================================
--- /trunk/src/kWorker/Makefile.kmk	(revision 2947)
+++ /trunk/src/kWorker/Makefile.kmk	(revision 2948)
@@ -31,4 +31,5 @@
 PROGRAMS += kWorker
 kWorker_TEMPLATE = BIN-STATIC-THREADED
+kWorker_DEFS := KWORKER
 kWorker_DEFS.debug = K_STRICT
 kWorker_DEFS.release = NASSERT
@@ -60,4 +61,5 @@
 kWorkerLib_DEFPATH = ../lib # Need fix from r2837.
 kWorkerLib_DEFPATH := $(PATH_SUB_CURRENT)/../lib
+kWorkerLib_DEFS := KWORKER
 kWorkerLib_SOURCES = \
 	crc32.c \
Index: /trunk/src/kWorker/kWorker.c
===================================================================
--- /trunk/src/kWorker/kWorker.c	(revision 2947)
+++ /trunk/src/kWorker/kWorker.c	(revision 2948)
@@ -47,6 +47,4 @@
 #include "nt/ntstat.h"
 #include "kbuild_version.h"
-/* lib/nt_fullpath.c */
-extern void nt_fullpath(const char *pszPath, char *pszFull, size_t cchFull);
 
 #include "nt/ntstuff.h"
@@ -54,4 +52,5 @@
 
 #include "nt/kFsCache.h"
+#include "nt_fullpath.h"
 #include "quote_argv.h"
 #include "md5.h"
@@ -2800,4 +2799,74 @@
  */
 
+
+/**
+ * This is for kDep.
+ */
+int kwFsPathExists(const char *pszPath)
+{
+    BirdTimeSpec_T  TsIgnored;
+    KFSLOOKUPERROR  enmError;
+    PKFSOBJ         pFsObj = kFsCacheLookupNoMissingA(g_pFsCache, pszPath, &enmError);
+    if (pFsObj)
+    {
+        kFsCacheObjRelease(g_pFsCache, pFsObj);
+        return 1;
+    }
+    return birdStatModTimeOnly(pszPath, &TsIgnored, 1) == 0;
+}
+
+
+/* duplicated in dir-nt-bird.c */
+void nt_fullpath_cached(const char *pszPath, char *pszFull, size_t cbFull)
+{
+    KFSLOOKUPERROR  enmError;
+    PKFSOBJ         pPathObj = kFsCacheLookupA(g_pFsCache, pszPath, &enmError);
+    if (pPathObj)
+    {
+        KSIZE off = pPathObj->cchParent;
+        if (off > 0)
+        {
+            KSIZE offEnd = off + pPathObj->cchName;
+            if (offEnd < cbFull)
+            {
+                PKFSDIR pAncestor;
+
+                pszFull[off + pPathObj->cchName] = '\0';
+                memcpy(&pszFull[off], pPathObj->pszName, pPathObj->cchName);
+
+                for (pAncestor = pPathObj->pParent; off > 0; pAncestor = pAncestor->Obj.pParent)
+                {
+                    kHlpAssert(off > 1);
+                    kHlpAssert(pAncestor != NULL);
+                    kHlpAssert(pAncestor->Obj.cchName > 0);
+                    pszFull[--off] = '/';
+                    off -= pAncestor->Obj.cchName;
+                    kHlpAssert(pAncestor->Obj.cchParent == off);
+                    memcpy(&pszFull[off], pAncestor->Obj.pszName, pAncestor->Obj.cchName);
+                }
+                kFsCacheObjRelease(g_pFsCache, pPathObj);
+                return;
+            }
+        }
+        else
+        {
+            if ((size_t)pPathObj->cchName + 1 < cbFull)
+            {
+                memcpy(pszFull, pPathObj->pszName, pPathObj->cchName);
+                pszFull[pPathObj->cchName] = '/';
+                pszFull[pPathObj->cchName + 1] = '\0';
+
+                kFsCacheObjRelease(g_pFsCache, pPathObj);
+                return;
+            }
+        }
+
+        /* do fallback. */
+        kHlpAssertFailed();
+        kFsCacheObjRelease(g_pFsCache, pPathObj);
+    }
+
+    nt_fullpath(pszPath, pszFull, cbFull);
+}
 
 
Index: /trunk/src/kmk/dir-nt-bird.c
===================================================================
--- /trunk/src/kmk/dir-nt-bird.c	(revision 2947)
+++ /trunk/src/kmk/dir-nt-bird.c	(revision 2948)
@@ -456,5 +456,5 @@
 
 
-
+/* duplicated in kWorker.c */
 void nt_fullpath_cached(const char *pszPath, char *pszFull, size_t cbFull)
 {
@@ -478,5 +478,5 @@
                     kHlpAssert(off > 1);
                     kHlpAssert(pAncestor != NULL);
-                    kHlpAssert(pAncestor->ObjcchName > 0);
+                    kHlpAssert(pAncestor->Obj.cchName > 0);
                     pszFull[--off] = '/';
                     off -= pAncestor->Obj.cchName;
Index: /trunk/src/lib/kDep.c
===================================================================
--- /trunk/src/lib/kDep.c	(revision 2947)
+++ /trunk/src/lib/kDep.c	(revision 2948)
@@ -59,4 +59,8 @@
 #include "kDep.h"
 
+#ifdef KWORKER
+extern int kwFsPathExists(const char *pszPath);
+#endif
+
 
 /*******************************************************************************
@@ -239,5 +243,7 @@
          * Check that the file exists before we start depending on it.
          */
-#ifdef KMK
+#ifdef KWORKER
+        if (kwFsPathExists(pszFilename))
+#elif defined(KMK)
         if (!file_exists_p(pszFilename))
 #elif K_OS == K_OS_WINDOWS
Index: /trunk/src/lib/nt/kFsCache.c
===================================================================
--- /trunk/src/lib/nt/kFsCache.c	(revision 2947)
+++ /trunk/src/lib/nt/kFsCache.c	(revision 2948)
@@ -89,4 +89,9 @@
 
 
+
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
+static KBOOL kFsCacheRefreshObj(PKFSCACHE pCache, PKFSOBJ pObj, KFSLOOKUPERROR *penmError);
 
 
@@ -1257,6 +1262,21 @@
     else if (pDir->fPopulated)
     {
-        KU32  cAllocated = K_ALIGN_Z(pDir->cChildren, 16);
-        void *pvNew      = kHlpAlloc(sizeof(pDir->papChildren[0]) * cAllocated);
+        KU32  cAllocated;
+        void *pvNew;
+
+        /* Make sure we really need to do this first. */
+        if (!pDir->fNeedRePopulating)
+        {
+            if (   pDir->Obj.uCacheGen == KFSOBJ_CACHE_GEN_IGNORE
+                || pDir->Obj.uCacheGen == pCache->auGenerations[pDir->Obj.fFlags & KFSOBJ_F_USE_CUSTOM_GEN])
+                return K_TRUE;
+            if (   kFsCacheRefreshObj(pCache, &pDir->Obj, penmError)
+                && !pDir->fNeedRePopulating)
+                return K_TRUE;
+        }
+
+        /* Yes we do need to. */
+        cAllocated = K_ALIGN_Z(pDir->cChildren, 16);
+        pvNew      = kHlpAlloc(sizeof(pDir->papChildren[0]) * cAllocated);
         if (pvNew)
         {
@@ -1608,14 +1628,24 @@
         && (pDir->Obj.fFlags & KFSOBJ_F_WORKING_DIR_MTIME) )
     {
-        MY_IO_STATUS_BLOCK          Ios;
-        MY_FILE_BASIC_INFORMATION   BasicInfo;
-        MY_NTSTATUS                 rcNt;
-
-        Ios.Information = -1;
-        Ios.u.Status    = -1;
-
-        rcNt = g_pfnNtQueryInformationFile(pDir->hDir, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation);
-        if (MY_NT_SUCCESS(rcNt))
-            return BasicInfo.LastWriteTime.QuadPart != pDir->iLastWrite;
+        if (!pDir->fNeedRePopulating)
+        {
+            MY_IO_STATUS_BLOCK          Ios;
+            MY_FILE_BASIC_INFORMATION   BasicInfo;
+            MY_NTSTATUS                 rcNt;
+
+            Ios.Information = -1;
+            Ios.u.Status    = -1;
+
+            rcNt = g_pfnNtQueryInformationFile(pDir->hDir, &Ios, &BasicInfo, sizeof(BasicInfo), MyFileBasicInformation);
+            if (MY_NT_SUCCESS(rcNt))
+            {
+                if (BasicInfo.LastWriteTime.QuadPart != pDir->iLastWrite)
+                {
+                    pDir->fNeedRePopulating = K_TRUE;
+                    return K_TRUE;
+                }
+                return K_FALSE;
+            }
+        }
     }
     /* The cache root never changes. */
