[B<-disable-dynamic-vcaches>]
S<<< [B<-volumes> <I<number of volume entries>>] >>>
[B<-waitclose>] [B<-rxmaxfrags> <I<max # of fragments>>]
+ S<<< [B<-volume-ttl> <I<vldb cache timeout>>] >>>
=for html
</div>
writes to the File Server, is now the default behavior. To perform
asynchronous writes in certain cases, use the B<fs storebehind> command.
+=item B<-volume-ttl>
+
+Specifies the maximum amount of time the Cache Manager will cache volume
+information retrieved from VL Servers.
+
+By default, the Cache Manager will cache read-only volume information as long
+as a volume callback is held for a read-only volume. The callback may be held
+as long as files in the read-only volume are being accessed. The Cache Manager
+will cache read/write volume information as long as volume level errors are not
+returned from fileservers while accessing files within the volume.
+
+Use the B<-volume-ttl> to specify the maximum amount of time in seconds
+volume information will be cached, regardless of connectivity to the
+fileserers. The minimum valid value is 600 seconds (10 minutes).
+
=back
=head1 EXAMPLES
#define AFS_VOLCHECK_MTPTS 0x4 /* mount point invalidation also */
#define AFS_VOLCHECK_FORCE 0x8 /* do all forcibly */
+/* For volume ttl expiry checks. */
+#define AFS_MIN_VOLUME_TTL 600
+#define AFS_MAX_VOLUME_TTL MAX_AFS_INT32
+
#endif /* KERNEL */
#define AFS_FSPORT ((unsigned short) htons(7000))
static int afscall_set_rxpck_received = 0;
+extern afs_int32 afs_volume_ttl;
+
/* From afs_util.c */
extern afs_int32 afs_md5inum;
default:
code = EINVAL;
}
+ } else if (parm == AFSOP_SET_VOLUME_TTL) {
+ if ((parm2 < AFS_MIN_VOLUME_TTL) || (parm2 > AFS_MAX_VOLUME_TTL)) {
+ code = EINVAL;
+ } else {
+ afs_volume_ttl = parm2;
+ code = 0;
+ }
} else {
code = EINVAL;
}
#endif /* vlserver error base define */
/* Exported variables */
+afs_int32 afs_volume_ttl = 0;
afs_dcache_id_t volumeInode; /* Inode for VolumeItems file */
afs_rwlock_t afs_xvolume; /** allocation lock for volumes */
struct volume *afs_freeVolList;
* Dynroot volumes are not setup from vldb queries, so never expire.
* Read-only volume expiry is tied to the volume callback.
*
+ * Optionally, invalidate volume information after a fixed timeout.
+ * The vlservers will be periodically probed for volume information.
+ * This avoids a situation where the vldb information is cached
+ * indefinitely as long as files in the volume are accessed (and are
+ * not in the vcache) before the callback expires.
+ *
* \param tv volume to check
* \param now current time
*
static int
IsExpired(struct volume *tv, afs_int32 now)
{
- return (tv->expireTime < (now + 10)) && (tv->states & VRO)
- && !afs_IsDynrootVolume(tv);
+ if (afs_IsDynrootVolume(tv)) {
+ return 0;
+ }
+ if ((tv->states & VRO) && (tv->expireTime < (now + 10))) {
+ return 1;
+ }
+ if ((afs_volume_ttl != 0) && ((tv->setupTime + afs_volume_ttl) < now)) {
+ return 1;
+ }
+ return 0;
}
/**
* -splitcache RW/RO ratio for cache.
* -rxmaxfrags Max number of UDP fragments per rx packet.
* -inumcalc inode number calculation method; 0=compat, 1=MD5 digest
+ * -volume-ttl vldb cache timeout in seconds
*---------------------------------------------------------------------------*/
#include <afsconfig.h>
static int afsd_CloseSynch = 0; /*Are closes synchronous or not? */
static int rxmaxmtu = 0; /* Are we forcing a limit on the mtu? */
static int rxmaxfrags = 0; /* Are we forcing a limit on frags? */
+static int volume_ttl = 0; /* enable vldb cache timeout support */
#ifdef AFS_SGI62_ENV
#define AFSD_INO_T ino64_t
OPT_dynrootsparse,
OPT_rxmaxfrags,
OPT_inumcalc,
+ OPT_volume_ttl,
};
#ifdef MACOS_EVENT_HANDLING
if (cmd_OptionPresent(as, OPT_inumcalc)) {
cmd_OptionAsString(as, OPT_inumcalc, &inumcalc);
}
+ cmd_OptionAsInt(as, OPT_volume_ttl, &volume_ttl);
/* parse cacheinfo file if this is a diskcache */
if (ParseCacheInfoFile()) {
afsd_syscall(AFSOP_ROOTVOLUME, rootVolume);
}
+ if (volume_ttl != 0) {
+ if (afsd_verbose)
+ printf("%s: Calling AFSOP_SET_VOLUME_TTL with '%d'\n", rn, volume_ttl);
+ code = afsd_syscall(AFSOP_SET_VOLUME_TTL, volume_ttl);
+ if (code != 0)
+ printf("%s: Error setting volume ttl to %d seconds; code=%d.\n", rn, volume_ttl, code);
+ }
+
/*
* Pass the kernel the name of the workstation cache file holding the
* volume information.
"send/receive per Rx packet");
cmd_AddParmAtOffset(ts, OPT_inumcalc, "-inumcalc", CMD_SINGLE, CMD_OPTIONAL,
"Set inode number calculation method");
+ cmd_AddParmAtOffset(ts, OPT_volume_ttl, "-volume-ttl", CMD_SINGLE,
+ CMD_OPTIONAL,
+ "Set the vldb cache timeout value in seconds.");
}
/**
case AFSOP_GO:
case AFSOP_SET_RMTSYS_FLAG:
case AFSOP_SET_INUMCALC:
+ case AFSOP_SET_VOLUME_TTL:
params[0] = CAST_SYSCALL_PARAM((va_arg(ap, int)));
break;
case AFSOP_SET_THISCELL:
#define AFSOP_SET_RMTSYS_FLAG 44 /* set flag if rmtsys is enabled */
#define AFSOP_SEED_ENTROPY 45 /* Give the kernel hcrypto entropy */
#define AFSOP_SET_INUMCALC 46 /* set inode number calculation method */
+#define AFSOP_SET_VOLUME_TTL 47 /* set the vldb cache timeout */
#define AFSOP_RXLISTENER_DAEMON 48 /* starts kernel RX listener */