libafs: stop bkg first

because background daemons can have dependence on other subsystems, but
are not needed for other operations, stop them first.

Change-Id: If65cf922b84cfca7b8c5d7b7a2d571bfe1e5ff12
Reviewed-on: http://gerrit.openafs.org/7246
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Derrick Brashear 2012-04-18 11:58:52 -04:00
parent a08f9baa76
commit e3c93b87b7
3 changed files with 19 additions and 10 deletions

View File

@ -65,7 +65,9 @@ static int AFS_Running = 0;
static int afs_CacheInit_Done = 0;
static int afs_Go_Done = 0;
extern struct interfaceAddr afs_cb_interface;
#ifdef RXK_LISTENER_ENV
static int afs_RX_Running = 0;
#endif
static int afs_InitSetup_done = 0;
afs_int32 afs_numcachefiles = -1;
afs_int32 afs_numfilesperdir = -1;
@ -1376,6 +1378,15 @@ afs_shutdown(void)
afs_FlushAllVCaches();
#endif
afs_termState = AFSOP_STOP_BKG;
afs_warn("BkG... ");
/* Wake-up afs_brsDaemons so that we don't have to wait for a bkg job! */
while (afs_termState == AFSOP_STOP_BKG) {
afs_osi_Wakeup(&afs_brsDaemons);
afs_osi_Sleep(&afs_termState);
}
afs_warn("CB... ");
afs_termState = AFSOP_STOP_RXCALLBACK;
@ -1398,12 +1409,6 @@ afs_shutdown(void)
afs_osi_Sleep(&afs_termState);
}
}
afs_warn("BkG... ");
/* Wake-up afs_brsDaemons so that we don't have to wait for a bkg job! */
while (afs_termState == AFSOP_STOP_BKG) {
afs_osi_Wakeup(&afs_brsDaemons);
afs_osi_Sleep(&afs_termState);
}
afs_warn("CTrunc... ");
/* Cancel cache truncate daemon. */
while (afs_termState == AFSOP_STOP_TRUNCDAEMON) {

View File

@ -57,7 +57,11 @@ afs_StopAFSDB(void)
afs_osi_Wakeup(&afsdb_req);
} else {
afsdb_handler_shutdown = 1;
#if defined(AFS_SUN5_ENV) || defined(RXK_LISTENER_ENV) || defined(RXK_UPCALL_ENV)
afs_termState = AFSOP_STOP_RXEVENT;
#else
afs_termState = AFSOP_STOP_COMPLETE;
#endif
afs_osi_Wakeup(&afs_termState);
}
}

View File

@ -90,7 +90,7 @@ afs_CheckServerDaemon(void)
last10MinCheck = lastCheck = osi_Time();
while (1) {
if (afs_termState == AFSOP_STOP_CS) {
afs_termState = AFSOP_STOP_BKG;
afs_termState = AFSOP_STOP_TRUNCDAEMON;
afs_osi_Wakeup(&afs_termState);
break;
}
@ -108,7 +108,7 @@ afs_CheckServerDaemon(void)
}
/* shutdown check. */
if (afs_termState == AFSOP_STOP_CS) {
afs_termState = AFSOP_STOP_BKG;
afs_termState = AFSOP_STOP_TRUNCDAEMON;
afs_osi_Wakeup(&afs_termState);
break;
}
@ -309,7 +309,7 @@ afs_Daemon(void)
if (afs_CheckServerDaemonStarted)
afs_termState = AFSOP_STOP_CS;
else
afs_termState = AFSOP_STOP_BKG;
afs_termState = AFSOP_STOP_TRUNCDAEMON;
afs_osi_Wakeup(&afs_termState);
return;
}
@ -1046,7 +1046,7 @@ afs_BackgroundDaemon(void)
if (afs_termState == AFSOP_STOP_BKG) {
if (--afs_nbrs <= 0)
afs_termState = AFSOP_STOP_TRUNCDAEMON;
afs_termState = AFSOP_STOP_RXCALLBACK;
ReleaseWriteLock(&afs_xbrs);
afs_osi_Wakeup(&afs_termState);
#ifdef AFS_NEW_BKG