From: Michael Meffie Date: Fri, 5 Jun 2015 14:09:54 +0000 (-0400) Subject: libafs: avoid resetting the dynroot volume every 10 minutes X-Git-Tag: upstream/1.8.0_pre1^2~73 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=43a66de66c40171fedcf0450e9fa93b47c0d9f2e;p=packages%2Fo%2Fopenafs.git libafs: avoid resetting the dynroot volume every 10 minutes The dynroot volumes are synthetic, so do not need to be reset every time the background daemon checks the volumes. The results of osi_Time() is a signed 32-bit integer, and the volume expireTime is an signed 32-bit integer, so use signed 32-bit integers for the expiry check. Change-Id: Ib92157686c1d8b84a63d409cb148155705953b6d Reviewed-on: https://gerrit.openafs.org/11895 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- diff --git a/src/afs/afs_dynroot.c b/src/afs/afs_dynroot.c index 144a2d498..83dc1aab0 100644 --- a/src/afs/afs_dynroot.c +++ b/src/afs/afs_dynroot.c @@ -107,6 +107,17 @@ afs_dynrootCellInit(void) return 0; } +/*! + * Returns non-zero if the volume is the dynroot volume. + */ +int +afs_IsDynrootVolume(struct volume *v) +{ + return (afs_dynrootEnable + && v->cell == afs_dynrootCell + && v->volume == AFS_DYNROOT_VOLUME); +} + /* * Returns non-zero iff fid corresponds to the top of the dynroot volume. */ diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 440567a18..945954e77 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -294,6 +294,7 @@ extern void afs_PopulateDCache(struct vcache *avc, afs_size_t apos, /* afs_dynroot.c */ extern afs_rwlock_t afs_dynrootDirLock; extern afs_rwlock_t afs_dynSymlinkLock; +extern int afs_IsDynrootVolume(struct volume *v); extern int afs_IsDynrootFid(struct VenusFid *fid); extern int afs_IsDynrootMountFid(struct VenusFid *fid); extern int afs_IsDynrootAnyFid(struct VenusFid *fid); diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index 2fd8a9ed2..3aa64b837 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -409,6 +409,24 @@ afs_ResetVolumes(struct server *srvp, struct volume *tv) } } +/*! + * Returns non-zero if the volume information is expired. + * + * Dynroot volumes are not setup from vldb queries, so never expire. + * Read-only volume expiry is tied to the volume callback. + * + * \param tv volume to check + * \param now current time + * + * \return non-zero if the volume should be reset + */ +static int +IsExpired(struct volume *tv, afs_int32 now) +{ + return (tv->expireTime < (now + 10)) && (tv->states & VRO) + && !afs_IsDynrootVolume(tv); +} + /** * Reset volume name to volume id mapping cache. * @param flags @@ -418,7 +436,7 @@ afs_CheckVolumeNames(int flags) { afs_int32 i, j; struct volume *tv; - unsigned int now; + afs_int32 now; struct vcache *tvc; afs_int32 *volumeID, *cellID, vsize, nvols; #ifdef AFS_DARWIN80_ENV @@ -447,8 +465,7 @@ afs_CheckVolumeNames(int flags) for (i = 0; i < NVOLS; i++) { for (tv = afs_volumes[i]; tv; tv = tv->next) { if (flags & AFS_VOLCHECK_EXPIRED) { - if (((tv->expireTime < (now + 10)) && (tv->states & VRO)) - || (flags & AFS_VOLCHECK_FORCE)) { + if (IsExpired(tv, now) || (flags & AFS_VOLCHECK_FORCE)) { afs_ResetVolumeInfo(tv); /* also resets status */ if (volumeID) { volumeID[nvols] = tv->volume;