mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 07:20:11 +00:00
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:
parent
639ca379e4
commit
0e3bfa033e
@ -351,6 +351,12 @@ _afsconf_UpToDate(struct afsconf_dir *adir)
|
|||||||
char *cellservDB;
|
char *cellservDB;
|
||||||
struct stat tstat;
|
struct stat tstat;
|
||||||
int code;
|
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);
|
_afsconf_CellServDBPath(adir, &cellservDB);
|
||||||
if (cellservDB == NULL)
|
if (cellservDB == NULL)
|
||||||
@ -403,6 +409,7 @@ _afsconf_Touch(struct afsconf_dir *adir)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
adir->timeRead = 0; /* just in case */
|
adir->timeRead = 0; /* just in case */
|
||||||
|
adir->timeCheck = 0;
|
||||||
|
|
||||||
_afsconf_CellServDBPath(adir, &cellservDB);
|
_afsconf_CellServDBPath(adir, &cellservDB);
|
||||||
if (cellservDB == NULL)
|
if (cellservDB == NULL)
|
||||||
|
@ -94,6 +94,7 @@ struct afsconf_dir {
|
|||||||
struct afsconf_entry *entries; /* list of cell entries */
|
struct afsconf_entry *entries; /* list of cell entries */
|
||||||
struct opr_queue keyList; /* list of keys */
|
struct opr_queue keyList; /* list of keys */
|
||||||
afs_int32 timeRead; /* time stamp of file last read */
|
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 */
|
struct afsconf_aliasentry *alias_entries; /* cell aliases */
|
||||||
afsconf_secflags securityFlags;
|
afsconf_secflags securityFlags;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user