Index: openafs/src/WINNT/afsd/afsd_init.c diff -c openafs/src/WINNT/afsd/afsd_init.c:1.79.2.1 openafs/src/WINNT/afsd/afsd_init.c:1.79.2.3 *** openafs/src/WINNT/afsd/afsd_init.c:1.79.2.1 Thu Jun 22 17:54:40 2006 --- openafs/src/WINNT/afsd/afsd_init.c Wed Aug 9 19:29:23 2006 *************** *** 270,276 **** HKEY hkMSV10; HKEY hkClient; DWORD dwType; ! DWORD dwSize; DWORD dwValue; PBYTE pHostNames = NULL, pName = NULL; BOOL bNameFound = FALSE; --- 270,276 ---- HKEY hkMSV10; HKEY hkClient; DWORD dwType; ! DWORD dwSize, dwAllocSize; DWORD dwValue; PBYTE pHostNames = NULL, pName = NULL; BOOL bNameFound = FALSE; *************** *** 283,293 **** { if (RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS) { ! dwSize += strlen(cm_NetbiosName) + 1; ! pHostNames = malloc(dwSize); if (RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, &dwType, pHostNames, &dwSize) == ERROR_SUCCESS) { ! for (pName = pHostNames; *pName ; pName += strlen(pName) + 1) { if ( !stricmp(pName, cm_NetbiosName) ) { bNameFound = TRUE; --- 283,297 ---- { if (RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, &dwType, NULL, &dwSize) == ERROR_SUCCESS) { ! dwAllocSize += 1 /* in case the source string is not nul terminated */ ! + strlen(cm_NetbiosName) + 2; ! pHostNames = malloc(dwAllocSize); ! dwSize = dwAllocSize; if (RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, &dwType, pHostNames, &dwSize) == ERROR_SUCCESS) { ! for (pName = pHostNames; ! (pName - pHostNames < dwSize) && *pName ; ! pName += strlen(pName) + 1) { if ( !stricmp(pName, cm_NetbiosName) ) { bNameFound = TRUE; *************** *** 301,307 **** size_t size = strlen(cm_NetbiosName) + 2; if ( !pHostNames ) { pHostNames = malloc(size); - dwSize = size; pName = pHostNames; } StringCbCopyA(pName, size, cm_NetbiosName); --- 305,310 ---- *************** *** 309,314 **** --- 312,318 ---- *pName = '\0'; /* add a second nul terminator */ dwType = REG_MULTI_SZ; + dwSize = pName - pHostNames + 1; RegSetValueEx( hkMSV10, "BackConnectionHostNames", 0, dwType, pHostNames, dwSize); if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, *************** *** 997,1012 **** if (rx_enable_process_stats) afsi_log("RX Process Statistics gathering is enabled"); - dummyLen = sizeof(ConnDeadtimeout); - code = RegQueryValueEx(parmKey, "ConnDeadTimeout", NULL, NULL, - (BYTE *) &ConnDeadtimeout, &dummyLen); - afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout); - - dummyLen = sizeof(HardDeadtimeout); - code = RegQueryValueEx(parmKey, "HardDeadTimeout", NULL, NULL, - (BYTE *) &HardDeadtimeout, &dummyLen); - afsi_log("HardDeadTimeout is %d", HardDeadtimeout); - dummyLen = sizeof(DWORD); code = RegQueryValueEx(parmKey, "daemonCheckDownInterval", NULL, NULL, (BYTE *) &dwValue, &dummyLen); --- 1001,1006 ---- Index: openafs/src/WINNT/afsd/afsd_service.c diff -c openafs/src/WINNT/afsd/afsd_service.c:1.52.4.3 openafs/src/WINNT/afsd/afsd_service.c:1.52.4.4 *** openafs/src/WINNT/afsd/afsd_service.c:1.52.4.3 Thu Jul 20 17:46:18 2006 --- openafs/src/WINNT/afsd/afsd_service.c Mon Aug 7 17:19:05 2006 *************** *** 372,379 **** * Mount a drive into AFS if there global mapping */ /* DEE Could check first if we are run as SYSTEM */ ! #define MAX_RETRIES 30 ! static void MountGlobalDrives(void) { #ifndef AFSIFS char szAfsPath[_MAX_PATH]; --- 372,380 ---- * Mount a drive into AFS if there global mapping */ /* DEE Could check first if we are run as SYSTEM */ ! #define MAX_RETRIES 10 ! #define MAX_DRIVES 23 ! static DWORD __stdcall MountGlobalDrivesThread(void * notUsed) { #ifndef AFSIFS char szAfsPath[_MAX_PATH]; *************** *** 394,400 **** if (dwResult != ERROR_SUCCESS) return; ! while (dwRetry < MAX_RETRIES) { dwDriveSize = sizeof(szDriveToMapTo); dwSubMountSize = sizeof(szSubMount); dwResult = RegEnumValue(hKey, dwIndex++, szDriveToMapTo, &dwDriveSize, 0, &dwType, szSubMount, &dwSubMountSize); --- 395,401 ---- if (dwResult != ERROR_SUCCESS) return; ! while (dwIndex < MAX_DRIVES) { dwDriveSize = sizeof(szDriveToMapTo); dwSubMountSize = sizeof(szSubMount); dwResult = RegEnumValue(hKey, dwIndex++, szDriveToMapTo, &dwDriveSize, 0, &dwType, szSubMount, &dwSubMountSize); *************** *** 407,413 **** } #ifndef AFSIFS ! for ( ; dwRetry < MAX_RETRIES; dwRetry++) { NETRESOURCE nr; memset (&nr, 0x00, sizeof(NETRESOURCE)); --- 408,414 ---- } #ifndef AFSIFS ! for (dwRetry = 0 ; dwRetry < MAX_RETRIES; dwRetry++) { NETRESOURCE nr; memset (&nr, 0x00, sizeof(NETRESOURCE)); *************** *** 435,444 **** --- 436,467 ---- } #else /* FIXFIX: implement */ + afsi_log("GlobalAutoMap of %s to %s not implemented", szDriveToMapTo, szSubMount); #endif } RegCloseKey(hKey); + return 0; + } + + static HANDLE hThreadMountGlobalDrives = NULL; + + static void MountGlobalDrives() + { + DWORD tid; + + hThreadMountGlobalDrives = CreateThread(NULL, 0, MountGlobalDrivesThread, 0, 0, &tid); + + if ( hThreadMountGlobalDrives ) { + DWORD rc = WaitForSingleObject( hThreadMountGlobalDrives, 15000 ); + if (rc == WAIT_TIMEOUT) { + afsi_log("GlobalAutoMap thread failed to complete after 15 seconds"); + } else if (rc == WAIT_OBJECT_0) { + afsi_log("GlobalAutoMap thread completed"); + CloseHandle( hThreadMountGlobalDrives ); + hThreadMountGlobalDrives = NULL; + } + } } static void DismountGlobalDrives() *************** *** 456,461 **** --- 479,497 ---- HKEY hKey; DWORD dwIndex = 0; + if ( hThreadMountGlobalDrives ) { + DWORD rc = WaitForSingleObject(hThreadMountGlobalDrives, 0); + + if (rc == WAIT_TIMEOUT) { + afsi_log("GlobalAutoMap thread failed to complete before service shutdown"); + } + else if (rc == WAIT_OBJECT_0) { + afsi_log("GlobalAutoMap thread completed"); + CloseHandle( hThreadMountGlobalDrives ); + hThreadMountGlobalDrives = NULL; + } + } + sprintf(szKeyName, "%s\\GlobalAutoMapper", AFSREG_CLT_SVC_PARAM_SUBKEY); dwResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_QUERY_VALUE, &hKey); *************** *** 465,471 **** #ifdef AFSIFS /* FIXFIX: implement */ #else ! while (1) { dwDriveSize = sizeof(szDriveToMapTo); dwSubMountSize = sizeof(szSubMount); dwResult = RegEnumValue(hKey, dwIndex++, szDriveToMapTo, &dwDriveSize, 0, &dwType, szSubMount, &dwSubMountSize); --- 501,507 ---- #ifdef AFSIFS /* FIXFIX: implement */ #else ! while (dwIndex < MAX_DRIVES) { dwDriveSize = sizeof(szDriveToMapTo); dwSubMountSize = sizeof(szSubMount); dwResult = RegEnumValue(hKey, dwIndex++, szDriveToMapTo, &dwDriveSize, 0, &dwType, szSubMount, &dwSubMountSize); Index: openafs/src/WINNT/afsd/afslogon.c diff -c openafs/src/WINNT/afsd/afslogon.c:1.45.2.3 openafs/src/WINNT/afsd/afslogon.c:1.45.2.4 *** openafs/src/WINNT/afsd/afslogon.c:1.45.2.3 Wed Jul 26 08:51:21 2006 --- openafs/src/WINNT/afsd/afslogon.c Thu Aug 3 17:55:06 2006 *************** *** 398,404 **** hkDoms = NULL; } } else ! DebugEvent("Not opening domain key for [%s]", effDomain); /* Each individual can either be specified on the domain key, the domains key or in the net provider key. They fail over in that order. If none is found, we just use the --- 398,404 ---- hkDoms = NULL; } } else ! DebugEvent("Not opening domain key"); /* Each individual can either be specified on the domain key, the domains key or in the net provider key. They fail over in that order. If none is found, we just use the Index: openafs/src/WINNT/afsd/cm_buf.c diff -c openafs/src/WINNT/afsd/cm_buf.c:1.31.2.1 openafs/src/WINNT/afsd/cm_buf.c:1.31.2.2 *** openafs/src/WINNT/afsd/cm_buf.c:1.31.2.1 Thu Jun 1 11:40:04 2006 --- openafs/src/WINNT/afsd/cm_buf.c Thu Aug 3 23:46:39 2006 *************** *** 89,100 **** /* set this to 1 when we are terminating to prevent access attempts */ static int buf_ShutdownFlag = 0; /* hold a reference to an already held buffer */ void buf_Hold(cm_buf_t *bp) { osi_assert(bp->magic == CM_BUF_MAGIC); lock_ObtainWrite(&buf_globalLock); ! bp->refCount++; lock_ReleaseWrite(&buf_globalLock); } --- 89,131 ---- /* set this to 1 when we are terminating to prevent access attempts */ static int buf_ShutdownFlag = 0; + void buf_HoldLocked(cm_buf_t *bp) + { + osi_assert(bp->magic == CM_BUF_MAGIC); + bp->refCount++; + } + /* hold a reference to an already held buffer */ void buf_Hold(cm_buf_t *bp) { + lock_ObtainWrite(&buf_globalLock); + buf_HoldLocked(bp); + lock_ReleaseWrite(&buf_globalLock); + } + + /* code to drop reference count while holding buf_globalLock */ + void buf_ReleaseLocked(cm_buf_t *bp) + { + /* ensure that we're in the LRU queue if our ref count is 0 */ osi_assert(bp->magic == CM_BUF_MAGIC); + osi_assert(bp->refCount > 0); + if (--bp->refCount == 0) { + if (!(bp->flags & CM_BUF_INLRU)) { + osi_QAdd((osi_queue_t **) &cm_data.buf_freeListp, &bp->q); + + /* watch for transition from empty to one element */ + if (!cm_data.buf_freeListEndp) + cm_data.buf_freeListEndp = cm_data.buf_freeListp; + bp->flags |= CM_BUF_INLRU; + } + } + } + + /* release a buffer. Buffer must be referenced, but unlocked. */ + void buf_Release(cm_buf_t *bp) + { lock_ObtainWrite(&buf_globalLock); ! buf_ReleaseLocked(bp); lock_ReleaseWrite(&buf_globalLock); } *************** *** 108,114 **** lock_ObtainWrite(&buf_globalLock); bp = cm_data.buf_allp; ! bp->refCount++; lock_ReleaseWrite(&buf_globalLock); nAtOnce = (long)sqrt((double)cm_data.buf_nbuffers); while (buf_ShutdownFlag == 0) { --- 139,145 ---- lock_ObtainWrite(&buf_globalLock); bp = cm_data.buf_allp; ! buf_HoldLocked(bp); lock_ReleaseWrite(&buf_globalLock); nAtOnce = (long)sqrt((double)cm_data.buf_nbuffers); while (buf_ShutdownFlag == 0) { *************** *** 141,151 **** * and so can be followed even when holding no locks. */ lock_ObtainWrite(&buf_globalLock); ! buf_LockedRelease(bp); bp = bp->allp; if (!bp) bp = cm_data.buf_allp; ! bp->refCount++; lock_ReleaseWrite(&buf_globalLock); } /* for loop over a bunch of buffers */ } /* whole daemon's while loop */ --- 172,182 ---- * and so can be followed even when holding no locks. */ lock_ObtainWrite(&buf_globalLock); ! buf_ReleaseLocked(bp); bp = bp->allp; if (!bp) bp = cm_data.buf_allp; ! buf_HoldLocked(bp); lock_ReleaseWrite(&buf_globalLock); } /* for loop over a bunch of buffers */ } /* whole daemon's while loop */ *************** *** 426,439 **** return CM_ERROR_INVAL; } - /* release a buffer. Buffer must be referenced, but unlocked. */ - void buf_Release(cm_buf_t *bp) - { - lock_ObtainWrite(&buf_globalLock); - buf_LockedRelease(bp); - lock_ReleaseWrite(&buf_globalLock); - } - /* wait for reading or writing to clear; called with write-locked * buffer and unlocked scp and returns with locked buffer. */ --- 457,462 ---- *************** *** 497,523 **** osi_Log1(afsd_logp, "WaitIO finished wait for bp 0x%p", bp); } - /* code to drop reference count while holding buf_globalLock */ - void buf_LockedRelease(cm_buf_t *bp) - { - /* ensure that we're in the LRU queue if our ref count is 0 */ - osi_assert(bp->refCount > 0); - if (--bp->refCount == 0) { - if (!(bp->flags & CM_BUF_INLRU)) { - osi_QAdd((osi_queue_t **) &cm_data.buf_freeListp, &bp->q); - - /* watch for transition from empty to one element */ - if (!cm_data.buf_freeListEndp) - cm_data.buf_freeListEndp = cm_data.buf_freeListp; - bp->flags |= CM_BUF_INLRU; - } - } - } - /* find a buffer, if any, for a particular file ID and offset. Assumes * that buf_globalLock is write locked when called. */ ! cm_buf_t *buf_LockedFind(struct cm_scache *scp, osi_hyper_t *offsetp) { long i; cm_buf_t *bp; --- 520,529 ---- osi_Log1(afsd_logp, "WaitIO finished wait for bp 0x%p", bp); } /* find a buffer, if any, for a particular file ID and offset. Assumes * that buf_globalLock is write locked when called. */ ! cm_buf_t *buf_FindLocked(struct cm_scache *scp, osi_hyper_t *offsetp) { long i; cm_buf_t *bp; *************** *** 527,533 **** if (cm_FidCmp(&scp->fid, &bp->fid) == 0 && offsetp->LowPart == bp->offset.LowPart && offsetp->HighPart == bp->offset.HighPart) { ! bp->refCount++; break; } } --- 533,539 ---- if (cm_FidCmp(&scp->fid, &bp->fid) == 0 && offsetp->LowPart == bp->offset.LowPart && offsetp->HighPart == bp->offset.HighPart) { ! buf_HoldLocked(bp); break; } } *************** *** 544,550 **** cm_buf_t *bp; lock_ObtainWrite(&buf_globalLock); ! bp = buf_LockedFind(scp, offsetp); lock_ReleaseWrite(&buf_globalLock); return bp; --- 550,556 ---- cm_buf_t *bp; lock_ObtainWrite(&buf_globalLock); ! bp = buf_FindLocked(scp, offsetp); lock_ReleaseWrite(&buf_globalLock); return bp; *************** *** 557,563 **** * at any given time, and also ensures that the log is forced sufficiently far, * if this buffer contains logged data. */ ! void buf_LockedCleanAsync(cm_buf_t *bp, cm_req_t *reqp) { long code = 0; --- 563,569 ---- * at any given time, and also ensures that the log is forced sufficiently far, * if this buffer contains logged data. */ ! void buf_CleanAsyncLocked(cm_buf_t *bp, cm_req_t *reqp) { long code = 0; *************** *** 566,576 **** while ((bp->flags & CM_BUF_DIRTY) == CM_BUF_DIRTY) { lock_ReleaseMutex(&bp->mx); ! osi_Log1(afsd_logp, "buf_LockedCleanAsync starts I/O on 0x%p", bp); code = (*cm_buf_opsp->Writep)(&bp->fid, &bp->offset, cm_data.buf_blockSize, 0, bp->userp, reqp); ! osi_Log2(afsd_logp, "buf_LockedCleanAsync I/O on 0x%p, done=%d", bp, code); lock_ObtainMutex(&bp->mx); if (code) --- 572,582 ---- while ((bp->flags & CM_BUF_DIRTY) == CM_BUF_DIRTY) { lock_ReleaseMutex(&bp->mx); ! osi_Log1(afsd_logp, "buf_CleanAsyncLocked starts I/O on 0x%p", bp); code = (*cm_buf_opsp->Writep)(&bp->fid, &bp->offset, cm_data.buf_blockSize, 0, bp->userp, reqp); ! osi_Log2(afsd_logp, "buf_CleanAsyncLocked I/O on 0x%p, done=%d", bp, code); lock_ObtainMutex(&bp->mx); if (code) *************** *** 690,696 **** lock_ObtainWrite(&buf_globalLock); /* check to see if we lost the race */ if (scp) { ! if (bp = buf_LockedFind(scp, offsetp)) { bp->refCount--; lock_ReleaseWrite(&buf_globalLock); return CM_BUF_EXISTS; --- 696,706 ---- lock_ObtainWrite(&buf_globalLock); /* check to see if we lost the race */ if (scp) { ! if (bp = buf_FindLocked(scp, offsetp)) { ! /* Do not call buf_ReleaseLocked() because we ! * do not want to allow the buffer to be added ! * to the free list. ! */ bp->refCount--; lock_ReleaseWrite(&buf_globalLock); return CM_BUF_EXISTS; *************** *** 754,760 **** * just the lock required to minimize contention * on the big lock. */ ! bp->refCount++; lock_ReleaseWrite(&buf_globalLock); /* grab required lock and clean; this only --- 764,770 ---- * just the lock required to minimize contention * on the big lock. */ ! buf_HoldLocked(bp); lock_ReleaseWrite(&buf_globalLock); /* grab required lock and clean; this only *************** *** 1073,1079 **** osi_assert(bp->magic == CM_BUF_MAGIC); lock_ObtainMutex(&bp->mx); ! buf_LockedCleanAsync(bp, reqp); lock_ReleaseMutex(&bp->mx); } --- 1083,1089 ---- osi_assert(bp->magic == CM_BUF_MAGIC); lock_ObtainMutex(&bp->mx); ! buf_CleanAsyncLocked(bp, reqp); lock_ReleaseMutex(&bp->mx); } *************** *** 1138,1144 **** for(i=0; ihashp) { if ((bp->flags & CM_BUF_DIRTY) == CM_BUF_DIRTY) { ! bp->refCount++; lock_ReleaseWrite(&buf_globalLock); /* now no locks are held; clean buffer and go on */ --- 1148,1154 ---- for(i=0; ihashp) { if ((bp->flags & CM_BUF_DIRTY) == CM_BUF_DIRTY) { ! buf_HoldLocked(bp); lock_ReleaseWrite(&buf_globalLock); /* now no locks are held; clean buffer and go on */ *************** *** 1148,1154 **** /* relock and release buffer */ lock_ObtainWrite(&buf_globalLock); ! buf_LockedRelease(bp); } /* dirty */ } /* over one bucket */ } /* for loop over all hash buckets */ --- 1158,1164 ---- /* relock and release buffer */ lock_ObtainWrite(&buf_globalLock); ! buf_ReleaseLocked(bp); } /* dirty */ } /* over one bucket */ } /* for loop over all hash buckets */ *************** *** 1228,1234 **** osi_hyper_t bufEnd; long code; long bufferPos; - int didRelease; long i; /* assert that cm_bufCreateLock is held in write mode */ --- 1238,1243 ---- *************** *** 1243,1252 **** return 0; } ! bufp->refCount++; lock_ReleaseWrite(&buf_globalLock); for(; bufp; bufp = nbufp) { - didRelease = 0; lock_ObtainMutex(&bufp->mx); bufEnd.HighPart = 0; --- 1252,1260 ---- return 0; } ! buf_HoldLocked(bufp); lock_ReleaseWrite(&buf_globalLock); for(; bufp; bufp = nbufp) { lock_ObtainMutex(&bufp->mx); bufEnd.HighPart = 0; *************** *** 1267,1280 **** | CM_SCACHESYNC_GETSTATUS | CM_SCACHESYNC_SETSIZE | CM_SCACHESYNC_BUFLOCKED); ! /* if we succeeded in our locking, and this applies to the right * file, and the truncate request overlaps the buffer either * totally or partially, then do something. */ if (code == 0 && cm_FidCmp(&bufp->fid, &scp->fid) == 0 && LargeIntegerLessThan(*sizep, bufEnd)) { - lock_ObtainWrite(&buf_globalLock); /* destroy the buffer, turning off its dirty bit, if * we're truncating the whole buffer. Otherwise, set --- 1275,1290 ---- | CM_SCACHESYNC_GETSTATUS | CM_SCACHESYNC_SETSIZE | CM_SCACHESYNC_BUFLOCKED); ! ! ! lock_ObtainWrite(&buf_globalLock); ! /* if we succeeded in our locking, and this applies to the right * file, and the truncate request overlaps the buffer either * totally or partially, then do something. */ if (code == 0 && cm_FidCmp(&bufp->fid, &scp->fid) == 0 && LargeIntegerLessThan(*sizep, bufEnd)) { /* destroy the buffer, turning off its dirty bit, if * we're truncating the whole buffer. Otherwise, set *************** *** 1301,1342 **** memset(bufp->datap + bufferPos, 0, cm_data.buf_blockSize - bufferPos); } - - lock_ReleaseWrite(&buf_globalLock); } lock_ReleaseMutex(&scp->mx); lock_ReleaseMutex(&bufp->mx); ! if (!didRelease) { ! lock_ObtainWrite(&buf_globalLock); ! nbufp = bufp->fileHashp; ! if (nbufp) nbufp->refCount++; ! buf_LockedRelease(bufp); ! lock_ReleaseWrite(&buf_globalLock); ! } ! ! /* bail out early if we fail */ ! if (code) { ! /* at this point, nbufp is held; bufp has already been ! * released. ! */ ! if (nbufp) ! buf_Release(nbufp); ! ! #ifdef TESTING ! buf_ValidateBufQueues(); ! #endif /* TESTING */ ! ! return code; ! } } #ifdef TESTING buf_ValidateBufQueues(); #endif /* TESTING */ ! /* success */ ! return 0; } long buf_FlushCleanPages(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp) --- 1311,1340 ---- memset(bufp->datap + bufferPos, 0, cm_data.buf_blockSize - bufferPos); } } lock_ReleaseMutex(&scp->mx); lock_ReleaseMutex(&bufp->mx); ! ! if (!code) { ! nbufp = bufp->fileHashp; ! if (nbufp) ! buf_HoldLocked(nbufp); ! } else { ! /* This forces the loop to end and the error code ! * to be returned. */ ! nbufp = NULL; ! } ! buf_ReleaseLocked(bufp); ! lock_ReleaseWrite(&buf_globalLock); } #ifdef TESTING buf_ValidateBufQueues(); #endif /* TESTING */ ! /* done */ ! return code; } long buf_FlushCleanPages(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp) *************** *** 1353,1360 **** lock_ObtainWrite(&buf_globalLock); bp = cm_data.buf_fileHashTablepp[i]; if (bp) ! bp->refCount++; lock_ReleaseWrite(&buf_globalLock); for (; bp; bp = nbp) { didRelease = 0; /* haven't released this buffer yet */ --- 1351,1359 ---- lock_ObtainWrite(&buf_globalLock); bp = cm_data.buf_fileHashTablepp[i]; if (bp) ! buf_HoldLocked(bp); lock_ReleaseWrite(&buf_globalLock); + for (; bp; bp = nbp) { didRelease = 0; /* haven't released this buffer yet */ *************** *** 1363,1369 **** lock_ObtainMutex(&bp->mx); /* start cleaning the buffer, and wait for it to finish */ ! buf_LockedCleanAsync(bp, reqp); buf_WaitIO(scp, bp); lock_ReleaseMutex(&bp->mx); --- 1362,1368 ---- lock_ObtainMutex(&bp->mx); /* start cleaning the buffer, and wait for it to finish */ ! buf_CleanAsyncLocked(bp, reqp); buf_WaitIO(scp, bp); lock_ReleaseMutex(&bp->mx); *************** *** 1377,1386 **** */ if (!(bp->flags & CM_BUF_DIRTY)) { if (bp->refCount == 1) { /* bp is held above */ - buf_LockedRelease(bp); nbp = bp->fileHashp; if (nbp) ! nbp->refCount++; didRelease = 1; buf_Recycle(bp); } --- 1376,1385 ---- */ if (!(bp->flags & CM_BUF_DIRTY)) { if (bp->refCount == 1) { /* bp is held above */ nbp = bp->fileHashp; if (nbp) ! buf_HoldLocked(nbp); ! buf_ReleaseLocked(bp); didRelease = 1; buf_Recycle(bp); } *************** *** 1393,1407 **** skip: if (!didRelease) { lock_ObtainWrite(&buf_globalLock); ! if (nbp = bp->fileHashp) ! nbp->refCount++; ! buf_LockedRelease(bp); lock_ReleaseWrite(&buf_globalLock); } } /* for loop over a bunch of buffers */ #ifdef TESTING ! buf_ValidateBufQueues(); #endif /* TESTING */ /* done */ --- 1392,1407 ---- skip: if (!didRelease) { lock_ObtainWrite(&buf_globalLock); ! nbp = bp->fileHashp; ! if (nbp) ! buf_HoldLocked(nbp); ! buf_ReleaseLocked(bp); lock_ReleaseWrite(&buf_globalLock); } } /* for loop over a bunch of buffers */ #ifdef TESTING ! buf_ValidateBufQueues(); #endif /* TESTING */ /* done */ *************** *** 1421,1427 **** lock_ObtainWrite(&buf_globalLock); bp = cm_data.buf_fileHashTablepp[i]; if (bp) ! bp->refCount++; lock_ReleaseWrite(&buf_globalLock); for (; bp; bp = nbp) { /* clean buffer synchronously */ --- 1421,1427 ---- lock_ObtainWrite(&buf_globalLock); bp = cm_data.buf_fileHashTablepp[i]; if (bp) ! buf_HoldLocked(bp); lock_ReleaseWrite(&buf_globalLock); for (; bp; bp = nbp) { /* clean buffer synchronously */ *************** *** 1447,1456 **** } lock_ObtainWrite(&buf_globalLock); - buf_LockedRelease(bp); nbp = bp->fileHashp; if (nbp) ! nbp->refCount++; lock_ReleaseWrite(&buf_globalLock); } /* for loop over a bunch of buffers */ --- 1447,1456 ---- } lock_ObtainWrite(&buf_globalLock); nbp = bp->fileHashp; if (nbp) ! buf_HoldLocked(nbp); ! buf_ReleaseLocked(bp); lock_ReleaseWrite(&buf_globalLock); } /* for loop over a bunch of buffers */ Index: openafs/src/WINNT/afsd/cm_buf.h diff -c openafs/src/WINNT/afsd/cm_buf.h:1.12 openafs/src/WINNT/afsd/cm_buf.h:1.12.4.1 *** openafs/src/WINNT/afsd/cm_buf.h:1.12 Fri Nov 18 18:45:02 2005 --- openafs/src/WINNT/afsd/cm_buf.h Thu Aug 3 23:46:39 2006 *************** *** 146,154 **** extern void buf_WaitIO(cm_scache_t *, cm_buf_t *); ! extern void buf_LockedRelease(cm_buf_t *); ! extern cm_buf_t *buf_LockedFind(struct cm_scache *, osi_hyper_t *); extern cm_buf_t *buf_Find(struct cm_scache *, osi_hyper_t *); --- 146,156 ---- extern void buf_WaitIO(cm_scache_t *, cm_buf_t *); ! extern void buf_ReleaseLocked(cm_buf_t *); ! extern void buf_HoldLocked(cm_buf_t *); ! ! extern cm_buf_t *buf_FindLocked(struct cm_scache *, osi_hyper_t *); extern cm_buf_t *buf_Find(struct cm_scache *, osi_hyper_t *); *************** *** 156,169 **** extern HANDLE buf_GetFileHandle(long); #endif /* !DJGPP */ - extern void buf_LockedCleanAsync(cm_buf_t *, cm_req_t *); - extern long buf_GetNewLocked(struct cm_scache *, osi_hyper_t *, cm_buf_t **); extern long buf_Get(struct cm_scache *, osi_hyper_t *, cm_buf_t **); extern long buf_GetNew(struct cm_scache *, osi_hyper_t *, cm_buf_t **); extern void buf_CleanAsync(cm_buf_t *, cm_req_t *); extern void buf_CleanWait(cm_scache_t *, cm_buf_t *); --- 158,171 ---- extern HANDLE buf_GetFileHandle(long); #endif /* !DJGPP */ extern long buf_GetNewLocked(struct cm_scache *, osi_hyper_t *, cm_buf_t **); extern long buf_Get(struct cm_scache *, osi_hyper_t *, cm_buf_t **); extern long buf_GetNew(struct cm_scache *, osi_hyper_t *, cm_buf_t **); + extern void buf_CleanAsyncLocked(cm_buf_t *, cm_req_t *); + extern void buf_CleanAsync(cm_buf_t *, cm_req_t *); extern void buf_CleanWait(cm_scache_t *, cm_buf_t *); Index: openafs/src/WINNT/afsd/cm_conn.c diff -c openafs/src/WINNT/afsd/cm_conn.c:1.49.2.4 openafs/src/WINNT/afsd/cm_conn.c:1.49.2.5 *** openafs/src/WINNT/afsd/cm_conn.c:1.49.2.4 Mon Jul 10 15:27:30 2006 --- openafs/src/WINNT/afsd/cm_conn.c Tue Aug 8 12:39:17 2006 *************** *** 20,25 **** --- 20,26 ---- #include #include #include + #include osi_rwlock_t cm_connLock; *************** *** 41,50 **** void cm_InitConn(void) { ! static osi_once_t once; ! long code; ! DWORD sessTimeout; ! HKEY parmKey; if (osi_Once(&once)) { lock_InitializeRWLock(&cm_connLock, "connection global lock"); --- 42,52 ---- void cm_InitConn(void) { ! static osi_once_t once; ! long code; ! DWORD dwValue; ! DWORD dummyLen; ! HKEY parmKey; if (osi_Once(&once)) { lock_InitializeRWLock(&cm_connLock, "connection global lock"); *************** *** 60,84 **** 0, KEY_QUERY_VALUE, &parmKey); if (code == ERROR_SUCCESS) { ! DWORD dummyLen = sizeof(sessTimeout); code = RegQueryValueEx(parmKey, LANMAN_WKS_SESSION_TIMEOUT, NULL, NULL, ! (BYTE *) &sessTimeout, &dummyLen); if (code == ERROR_SUCCESS) ! { ! RDRtimeout = sessTimeout; ! } } ! afsi_log("lanmanworkstation : SessTimeout %d", sessTimeout); ! if ( ConnDeadtimeout < RDRtimeout + 15 ) { ! ConnDeadtimeout = RDRtimeout + 15; ! afsi_log("ConnDeadTimeout increased to %d", ConnDeadtimeout); ! } ! if ( HardDeadtimeout < 2 * ConnDeadtimeout ) { ! HardDeadtimeout = 2 * ConnDeadtimeout; ! afsi_log("HardDeadTimeout increased to %d", HardDeadtimeout); } osi_EndOnce(&once); } } --- 62,101 ---- 0, KEY_QUERY_VALUE, &parmKey); if (code == ERROR_SUCCESS) { ! dummyLen = sizeof(DWORD); code = RegQueryValueEx(parmKey, LANMAN_WKS_SESSION_TIMEOUT, NULL, NULL, ! (BYTE *) &dwValue, &dummyLen); if (code == ERROR_SUCCESS) ! RDRtimeout = dwValue; ! RegCloseKey(parmKey); } ! code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, ! 0, KEY_QUERY_VALUE, &parmKey); ! if (code == ERROR_SUCCESS) { ! dummyLen = sizeof(DWORD); ! code = RegQueryValueEx(parmKey, "ConnDeadTimeout", NULL, NULL, ! (BYTE *) &dwValue, &dummyLen); ! if (code == ERROR_SUCCESS) ! ConnDeadtimeout = dwValue; ! ! dummyLen = sizeof(DWORD); ! code = RegQueryValueEx(parmKey, "HardDeadTimeout", NULL, NULL, ! (BYTE *) &dwValue, &dummyLen); ! if (code == ERROR_SUCCESS) ! HardDeadtimeout = dwValue; ! afsi_log("HardDeadTimeout is %d", HardDeadtimeout); ! RegCloseKey(parmKey); } + afsi_log("lanmanworkstation : SessTimeout %d", RDRtimeout); + if (ConnDeadtimeout == 0) + ConnDeadtimeout = RDRtimeout / 2; + afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout); + if (HardDeadtimeout == 0) + HardDeadtimeout = RDRtimeout; + afsi_log("HardDeadTimeout is %d", HardDeadtimeout); + osi_EndOnce(&once); } } Index: openafs/src/WINNT/afsd/cm_conn.h diff -c openafs/src/WINNT/afsd/cm_conn.h:1.13.4.2 openafs/src/WINNT/afsd/cm_conn.h:1.13.4.3 *** openafs/src/WINNT/afsd/cm_conn.h:1.13.4.2 Wed Jun 28 01:34:50 2006 --- openafs/src/WINNT/afsd/cm_conn.h Tue Aug 8 12:39:17 2006 *************** *** 11,18 **** #define __CM_CONN_H_ENV__ 1 #define CM_CONN_DEFAULTRDRTIMEOUT 45 ! #define CM_CONN_CONNDEADTIME 60 ! #define CM_CONN_HARDDEADTIME 120 extern unsigned short ConnDeadtimeout; extern unsigned short HardDeadtimeout; --- 11,18 ---- #define __CM_CONN_H_ENV__ 1 #define CM_CONN_DEFAULTRDRTIMEOUT 45 ! #define CM_CONN_CONNDEADTIME 0 ! #define CM_CONN_HARDDEADTIME 0 extern unsigned short ConnDeadtimeout; extern unsigned short HardDeadtimeout; Index: openafs/src/WINNT/afsd/cm_dcache.c diff -c openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.1 openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.2 *** openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.1 Sat Jun 24 16:41:54 2006 --- openafs/src/WINNT/afsd/cm_dcache.c Wed Aug 9 19:49:41 2006 *************** *** 1060,1067 **** /* add the buffer to the list */ qdp = osi_QDAlloc(); osi_SetQData(qdp, tbp); ! osi_QAdd((osi_queue_t **)&heldBufListp, &qdp->q); ! if (!heldBufListEndp) heldBufListEndp = qdp; /* leave tbp held (from buf_Get) */ if (!reserving) --- 1060,1068 ---- /* add the buffer to the list */ qdp = osi_QDAlloc(); osi_SetQData(qdp, tbp); ! osi_QAddH((osi_queue_t **)&heldBufListp, ! (osi_queue_t **)&heldBufListEndp, ! &qdp->q); /* leave tbp held (from buf_Get) */ if (!reserving) *************** *** 1129,1137 **** /* add the buffer to the list */ qdp = osi_QDAlloc(); osi_SetQData(qdp, tbp); ! osi_QAdd((osi_queue_t **)&biop->bufListp, &qdp->q); ! if (!biop->bufListEndp) ! biop->bufListEndp = qdp; buf_Hold(tbp); /* from now on, a failure just stops our collection process, but --- 1130,1138 ---- /* add the buffer to the list */ qdp = osi_QDAlloc(); osi_SetQData(qdp, tbp); ! osi_QAddH((osi_queue_t **)&biop->bufListp, ! (osi_queue_t **)&biop->bufListEndp, ! &qdp->q); buf_Hold(tbp); /* from now on, a failure just stops our collection process, but *************** *** 1148,1153 **** --- 1149,1157 ---- for (qdp = heldBufListp; qdp; qdp = tqdp) { tqdp = (osi_queueData_t *) osi_QNext(&qdp->q); tbp = osi_GetQData(qdp); + osi_QRemoveHT((osi_queue_t **) &heldBufListp, + (osi_queue_t **) &heldBufListEndp, + &qdp->q); osi_QDFree(qdp); buf_Release(tbp); } *************** *** 1200,1205 **** --- 1204,1212 ---- /* extract buffer and free queue data */ bufp = osi_GetQData(qdp); + osi_QRemoveHT((osi_queue_t **) &biop->bufListp, + (osi_queue_t **) &biop->bufListEndp, + &qdp->q); osi_QDFree(qdp); /* now, mark I/O as done, unlock the buffer and release it */ Index: openafs/src/WINNT/afsd/smb.c diff -c openafs/src/WINNT/afsd/smb.c:1.118.2.16 openafs/src/WINNT/afsd/smb.c:1.118.2.17 *** openafs/src/WINNT/afsd/smb.c:1.118.2.16 Mon Jul 31 11:51:38 2006 --- openafs/src/WINNT/afsd/smb.c Thu Aug 3 19:30:28 2006 *************** *** 141,147 **** int smb_useV3; /* try to negotiate V3 */ #ifndef DJGPP ! static showErrors = 1; /* MessageBox or something like it */ int (_stdcall *smb_MBfunc)(HWND, LPCTSTR, LPCTSTR, UINT) = NULL; #endif /* DJGPP */ --- 141,147 ---- int smb_useV3; /* try to negotiate V3 */ #ifndef DJGPP ! static showErrors = 0; /* MessageBox or something like it */ int (_stdcall *smb_MBfunc)(HWND, LPCTSTR, LPCTSTR, UINT) = NULL; #endif /* DJGPP */ *************** *** 8177,8184 **** if (showErrors) code = (*smb_MBfunc)(NULL, tbuffer, "AFS Client Service: Fatal Error", MB_OK|MB_SERVICE_NOTIFICATION); ! osi_assert(tbuffer); ! ExitThread(1); #else fprintf(stderr, "NCBLISTEN lana=%d failed with code %d\n", ncbp->ncb_lana_num, code); --- 8177,8183 ---- if (showErrors) code = (*smb_MBfunc)(NULL, tbuffer, "AFS Client Service: Fatal Error", MB_OK|MB_SERVICE_NOTIFICATION); ! osi_panic(tbuffer, __FILE__, __LINE__); #else fprintf(stderr, "NCBLISTEN lana=%d failed with code %d\n", ncbp->ncb_lana_num, code); Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.2 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.3 *** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.2 Wed Jul 19 00:15:17 2006 --- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm Thu Aug 10 00:07:04 2006 *************** *** 3,9 **** ! OpenAFS for Windows 1.5.3 Release Notes