diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 70e37e754e..f7bfa45112 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -1230,9 +1230,9 @@ afs_shutdown(void) return; afs_shuttingdown = 1; if (afs_cold_shutdown) - afs_warn("COLD "); + afs_warn("afs: COLD "); else - afs_warn("WARM "); + afs_warn("afs: WARM "); afs_warn("shutting down of: CB... "); afs_termState = AFSOP_STOP_RXCALLBACK; @@ -1240,7 +1240,7 @@ afs_shutdown(void) #ifdef AFS_AIX51_ENV shutdown_rxkernel(); #endif - /* shutdown_rxkernel(); */ + /* close rx server connections here? */ while (afs_termState == AFSOP_STOP_RXCALLBACK) afs_osi_Sleep(&afs_termState); @@ -1292,20 +1292,11 @@ afs_shutdown(void) #else afs_termState = AFSOP_STOP_COMPLETE; #endif - afs_warn("\n"); #ifdef AFS_AIX51_ENV shutdown_daemons(); #endif - -#ifdef notdef shutdown_CB(); - shutdown_AFS(); - shutdown_rxkernel(); - shutdown_rxevent(); - shutdown_rx(); - afs_shutdown_BKG(); -#endif shutdown_bufferpackage(); shutdown_cache(); shutdown_osi(); @@ -1333,15 +1324,15 @@ afs_shutdown(void) shutdown_nfsclnt(); #endif shutdown_afstest(); + shutdown_AFS(); /* The following hold the cm stats */ -/* memset(&afs_cmstats, 0, sizeof(struct afs_CMStats)); memset(&afs_stats_cmperf, 0, sizeof(struct afs_stats_CMPerf)); memset(&afs_stats_cmfullperf, 0, sizeof(struct afs_stats_CMFullPerf)); -*/ - afs_warn(" ALL allocated tables\n"); + afs_warn(" ALL allocated tables... "); afs_shuttingdown = 0; + afs_warn("done\n"); return; /* Just kill daemons for now */ } @@ -1357,11 +1348,3 @@ shutdown_afstest(void) *afs_rootVolumeName = 0; } } - - -/* In case there is a bunch of dynamically build bkg daemons to free */ -void -afs_shutdown_BKG(void) -{ - AFS_STATCNT(shutdown_BKG); -} diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index 37f508b02f..0c190c9721 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -742,30 +742,91 @@ shutdown_vnodeops(void) } +static void +shutdown_server(void) +{ + int i; + struct afs_conn *tc, *ntc; + struct afs_cbr *tcbrp, *tbrp; + struct srvAddr *sa; + + for (i = 0; i < NSERVERS; i++) { + struct server *ts, *next; + + ts = afs_servers[i]; + while(ts) { + next = ts->next; + for (sa = ts->addr; sa; sa = sa->next_sa) { + if (sa->conns) { + /* + * Free all server's connection structs + */ + tc = sa->conns; + while (tc) { + ntc = tc->next; +#if 0 + /* we should destroy all connections + when shutting down Rx, not here */ + AFS_GUNLOCK(); + rx_DestroyConnection(tc->id); + AFS_GLOCK(); +#endif + afs_osi_Free(tc, sizeof(struct afs_conn)); + tc = ntc; + } + } + } + for (tcbrp = ts->cbrs; tcbrp; tcbrp = tbrp) { + /* + * Free all server's callback structs + */ + tbrp = tcbrp->next; + afs_FreeCBR(tcbrp); + } + afs_osi_Free(ts, sizeof(struct server)); + ts = next; + } + } + + for (i = 0; i < NSERVERS; i++) { + struct srvAddr *sa, *next; + + sa = afs_srvAddrs[i]; + while(sa) { + next = sa->next_bkt; + afs_osi_Free(sa, sizeof(struct srvAddr)); + sa = next; + } + } +} + +static void +shutdown_volume(void) +{ + struct volume *tv; + int i; + + for (i = 0; i < NVOLS; i++) { + for (tv = afs_volumes[i]; tv; tv = tv->next) { + if (tv->name) { + afs_osi_Free(tv->name, strlen(tv->name) + 1); + tv->name = 0; + } + } + afs_volumes[i] = 0; + } +} + void shutdown_AFS(void) { int i; - register struct srvAddr *sa; AFS_STATCNT(shutdown_AFS); if (afs_cold_shutdown) { afs_resourceinit_flag = 0; - /* - * Free Volumes table allocations - */ - { - struct volume *tv; - for (i = 0; i < NVOLS; i++) { - for (tv = afs_volumes[i]; tv; tv = tv->next) { - if (tv->name) { - afs_osi_Free(tv->name, strlen(tv->name) + 1); - tv->name = 0; - } - } - afs_volumes[i] = 0; - } - } + + shutdown_volume(); /* * Free FreeVolList allocations @@ -774,14 +835,12 @@ shutdown_AFS(void) afs_memvolumes * sizeof(struct volume)); afs_freeVolList = Initialafs_freeVolList = 0; - /* XXX HACK fort MEM systems XXX + /* XXX HACK for MEM systems XXX * * For -memcache cache managers when we run out of free in memory volumes * we simply malloc more; we won't be able to free those additional volumes. */ - - /* * Free Users table allocation */ @@ -800,45 +859,6 @@ shutdown_AFS(void) } } - /* - * Free Servers table allocation - */ - { - struct server *ts, *nts; - struct afs_conn *tc, *ntc; - register struct afs_cbr *tcbrp, *tbrp; - - for (i = 0; i < NSERVERS; i++) { - for (ts = afs_servers[i]; ts; ts = nts) { - nts = ts->next; - for (sa = ts->addr; sa; sa = sa->next_sa) { - if (sa->conns) { - /* - * Free all server's connection structs - */ - tc = sa->conns; - while (tc) { - ntc = tc->next; - AFS_GUNLOCK(); - rx_DestroyConnection(tc->id); - AFS_GLOCK(); - afs_osi_Free(tc, sizeof(struct afs_conn)); - tc = ntc; - } - } - } - for (tcbrp = ts->cbrs; tcbrp; tcbrp = tbrp) { - /* - * Free all server's callback structs - */ - tbrp = tcbrp->next; - afs_FreeCBR(tcbrp); - } - afs_osi_Free(ts, sizeof(struct server)); - } - afs_servers[i] = 0; - } - } for (i = 0; i < NFENTRIES; i++) fvTable[i] = 0; /* Reinitialize local globals to defaults */ diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 97a8708336..2e37ef7da5 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -43,7 +43,6 @@ extern void afs_FlushCBs(void); extern int afs_CheckInit(void); extern void afs_shutdown(void); extern void shutdown_afstest(void); -extern void afs_shutdown_BKG(void); extern int afs_syscall_call(long parm, long parm2, long parm3, long parm4, long parm5, long parm6); #if defined(AFS_DARWIN100_ENV) @@ -843,7 +842,6 @@ void afsi_SetServerIPRank(struct srvAddr *sa, struct in_ifaddr *ifa); #endif #endif extern int afs_HaveCallBacksFrom(struct server *aserver); -extern void shutdown_server(void); extern void afs_RemoveAllConns(void); extern void afs_MarkAllServersUp(void); @@ -1306,7 +1304,6 @@ extern struct volume *afs_GetVolumeByName(register char *aname, extern struct volume *afs_UFSGetVolSlot(void); extern void afs_CheckVolumeNames(int flags); - /* Prototypes for generated files that aren't really in src/afs/ */ /* afs_uuid.c */ diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index 6a8705e83d..b9f177fcc9 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -1907,30 +1907,3 @@ void afs_MarkAllServersUp(void) ReleaseWriteLock(&afs_xsrvAddr); ReleaseWriteLock(&afs_xserver); } - -void shutdown_server(void) -{ - int i; - - for (i = 0; i < NSERVERS; i++) { - struct server *ts, *next; - - ts = afs_servers[i]; - while(ts) { - next = ts->next; - afs_osi_Free(ts, sizeof(struct server)); - ts = next; - } - } - - for (i = 0; i < NSERVERS; i++) { - struct srvAddr *sa, *next; - - sa = afs_srvAddrs[i]; - while(sa) { - next = sa->next_bkt; - afs_osi_Free(sa, sizeof(struct srvAddr)); - sa = next; - } - } -}