auth: avoid excessive stat of cellservdb

The modified time resolution is one second, so only
stat the cellservdb file at most only once per second.

Change-Id: I7d9a58f9af72b8c36b50374e49c07b4db85285e0
Reviewed-on: http://gerrit.openafs.org/5743
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
This commit is contained in:
Michael Meffie 2011-10-27 17:53:47 -04:00 committed by Jeffrey Altman
parent 639ca379e4
commit 0e3bfa033e
2 changed files with 8 additions and 0 deletions

View File

@ -351,6 +351,12 @@ _afsconf_UpToDate(struct afsconf_dir *adir)
char *cellservDB;
struct stat tstat;
int code;
time_t now = time(0);
if (adir->timeCheck == now) {
return 1; /* stat no more than once a second */
}
adir->timeCheck = now;
_afsconf_CellServDBPath(adir, &cellservDB);
if (cellservDB == NULL)
@ -403,6 +409,7 @@ _afsconf_Touch(struct afsconf_dir *adir)
#endif
adir->timeRead = 0; /* just in case */
adir->timeCheck = 0;
_afsconf_CellServDBPath(adir, &cellservDB);
if (cellservDB == NULL)

View File

@ -94,6 +94,7 @@ struct afsconf_dir {
struct afsconf_entry *entries; /* list of cell entries */
struct opr_queue keyList; /* list of keys */
afs_int32 timeRead; /* time stamp of file last read */
afs_int32 timeCheck; /* time of last check for update */
struct afsconf_aliasentry *alias_entries; /* cell aliases */
afsconf_secflags securityFlags;
};