diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index ebe0c01b7c..cb05a6fa35 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -1234,6 +1234,13 @@ int afsd_InitCM(char **reasonP) return 0; } +int afsd_ShutdownCM(void) +{ + cm_ReleaseSCache(&cm_data.rootSCachep); + + return 0; +} + int afsd_InitDaemons(char **reasonP) { long code; diff --git a/src/WINNT/afsd/afsd_init.h b/src/WINNT/afsd/afsd_init.h index b22dada6f9..c022b5dc13 100644 --- a/src/WINNT/afsd/afsd_init.h +++ b/src/WINNT/afsd/afsd_init.h @@ -14,6 +14,7 @@ int afsd_InitSMB(char **reasonP, void *aMBfunc); void GenerateMiniDump(PEXCEPTION_POINTERS ep); int afsd_InitDaemons(char **reasonP); +int afsd_ShutdownCM(void); void afsd_ForceTrace(BOOL flush); void afsd_SetUnhandledExceptionFilter(); diff --git a/src/WINNT/afsd/afsd_service.c b/src/WINNT/afsd/afsd_service.c index 7b444d919d..ac9826f763 100644 --- a/src/WINNT/afsd/afsd_service.c +++ b/src/WINNT/afsd/afsd_service.c @@ -1401,7 +1401,9 @@ afsd_Main(DWORD argc, LPTSTR *argv) cm_DaemonShutdown(); afsi_log("Daemon shutdown complete"); - + + afsd_ShutdownCM(); + buf_Shutdown(); afsi_log("Buffer shutdown complete"); @@ -1409,7 +1411,7 @@ afsd_Main(DWORD argc, LPTSTR *argv) afsi_log("rx finalization complete"); #ifndef AFSIFS - smb_Shutdown(); + smb_Shutdown(); afsi_log("smb shutdown complete"); #endif diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index dd27ea0f2c..0bbe4d8f65 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -199,7 +199,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, { long code; #ifndef AFSIFS - cm_scache_t *substRootp; + cm_scache_t *substRootp = NULL; #endif char * relativePath = ioctlp->inDatap; @@ -223,8 +223,10 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, "", reqp, scpp); - if (code) - return code; + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath code 0x%x", code); + return code; + } #else /* AFSIFS */ if (relativePath[0] == relativePath[1] && relativePath[1] == '\\' && @@ -257,13 +259,17 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, sharePath, reqp, &substRootp); free(sharePath); - if (code) + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath [1] code 0x%x", code); return code; + } code = cm_NameI(substRootp, p, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, NULL, reqp, scpp); - if (code) + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath [2] code 0x%x", code); return code; + } } else { /* otherwise, treat the name as a cellname mounted off the afs root. * This requires that we reconstruct the shareName string with @@ -285,25 +291,35 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, code = cm_NameI(cm_data.rootSCachep, ioctlp->prefix->data, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, shareName, reqp, &substRootp); - if (code) + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath [3] code 0x%x", code); return code; + } code = cm_NameI(substRootp, p, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, NULL, reqp, scpp); - if (code) + if (code) { + cm_ReleaseSCache(substRootp); + osi_Log1(afsd_logp,"cm_ParseIoctlPath code [4] 0x%x", code); return code; + } } } else { code = cm_NameI(cm_data.rootSCachep, ioctlp->prefix->data, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, ioctlp->tidPathp, reqp, &substRootp); - if (code) + if (code) { + osi_Log1(afsd_logp,"cm_ParseIoctlPath [6] code 0x%x", code); return code; + } code = cm_NameI(substRootp, relativePath, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW, userp, NULL, reqp, scpp); - if (code) + if (code) { + cm_ReleaseSCache(substRootp); + osi_Log1(afsd_logp,"cm_ParseIoctlPath [7] code 0x%x", code); return code; + } } #endif /* AFSIFS */ @@ -314,7 +330,11 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp, /* This is usually nothing, but for StatMountPoint it is the file name. */ TranslateExtendedChars(ioctlp->inDatap); + if (substRootp) + cm_ReleaseSCache(substRootp); + /* and return success */ + osi_Log1(afsd_logp,"cm_ParseIoctlPath [8] code 0x%x", code); return 0; }