]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
auth: avoid excessive stat of cellservdb
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 27 Oct 2011 21:53:47 +0000 (17:53 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Tue, 3 Sep 2013 12:43:21 +0000 (05:43 -0700)
The modified time resolution is one second, so only
stat the cellservdb file at most only once per second.

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>
(cherry picked from commit 0e3bfa033ed230fcb46ad8e3c26c8b7aae6e00af)

Change-Id: Ia533d037cc772c085cfaad47035e2a29df64952e
Reviewed-on: http://gerrit.openafs.org/9435
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/auth/cellconfig.c
src/auth/cellconfig.p.h

index 7b21740c759574a4b2387a203558e8e00cfb7fba..50de1084a9d24ad5592b2bf78a3ddce2f6d40c0c 100644 (file)
@@ -347,6 +347,12 @@ afsconf_Check(struct afsconf_dir *adir)
 #endif
     struct stat tstat;
     afs_int32 code;
+    time_t now = time(0);
+
+    if (adir->timeCheck == now) {
+       return 0; /* stat no more than once a second */
+    }
+    adir->timeCheck = now;
 
 #ifdef AFS_NT40_ENV
     /* NT client CellServDB has different file name than NT server or Unix */
@@ -398,6 +404,7 @@ afsconf_Touch(struct afsconf_dir *adir)
 #endif
 
     adir->timeRead = 0;                /* just in case */
+    adir->timeCheck = 0;
 
 #ifdef AFS_NT40_ENV
     /* NT client CellServDB has different file name than NT server or Unix */
index 67750ee2f9110c669e775493e5160f9fc531cab8..7b488b8364f0a5c65329782b03b87cdeb590a62d 100644 (file)
@@ -83,6 +83,7 @@ struct afsconf_dir {
     struct afsconf_entry *entries;     /* list of cell entries */
     struct afsconf_keys *keystr;       /* structure containing 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 */
 };