From 747afb94aa214217a749471679082c6ed8e81e92 Mon Sep 17 00:00:00 2001 From: Marcio Barbosa Date: Thu, 20 Sep 2018 08:44:59 -0400 Subject: [PATCH] afs: avoid extra VL_GetEntryByName for .readonly's In the VLDB, there's only one logical entry for a volume and its associated clones; there are not separate entries for the RW volume "avol", the RO volume "avol.readonly", and the BK volume "avol.backup". And so, when looking up a volume in the VLDB by name, the vlserver ignores any trailing ".readonly" or ".backup" in the given name. More concretely, the result of calling VL_GetEntryByName*("avol") is identical to that from calling VL_GetEntryByName*("avol.readonly"). Accordingly, if afs_GetVolumeByName(name) failed because the volume was not found in the VLDB, afs_GetVolumeByName(name.readonly) will fail as well (barring a change in external circumstances, such as the volume being created or a network connection coming back up). Therefore, the extra call in EvalMountData() is not necessary and can be removed. Remove the extra call, to slightly improve the response time of the client if the volume in question does not exist, and to reduce vlserver load when patched clients are looking up nonexistent volumes. Change-Id: I4f2f668107281565ae72a563a263121bd9bb7e3c Reviewed-on: https://gerrit.openafs.org/13334 Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk --- src/afs/VNOPS/afs_vnop_lookup.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index c38b3cb..c53360a 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -58,7 +58,7 @@ EvalMountData(char type, char *data, afs_uint32 states, afs_uint32 cellnum, struct VenusFid tfid; struct cell *tcell; char *cpos, *volnamep = NULL; - char *buf, *endptr; + char *endptr; afs_int32 prefetch; /* 1=>None 2=>RO 3=>BK */ afs_int32 mtptCell, assocCell = 0, hac = 0; afs_int32 samecell, roname, len; @@ -200,24 +200,6 @@ EvalMountData(char type, char *data, afs_uint32 states, afs_uint32 cellnum, WRITE_LOCK); } - /* Still not found. If we are looking for the RO, then perhaps the RW - * doesn't exist? Try adding ".readonly" to volname and look for that. - * Don't know why we do this. Would have still found it in above call - jpm. - */ - if (!tvp && (prefetch == 2) && len < AFS_SMALLOCSIZ - 10) { - buf = osi_AllocSmallSpace(len + 10); - - strcpy(buf, volnamep); - afs_strcat(buf, ".readonly"); - - tvp = afs_GetVolumeByName(buf, mtptCell, 1, areq, WRITE_LOCK); - - /* Try the associated linked cell if failed */ - if (!tvp && hac && areq->volumeError) { - tvp = afs_GetVolumeByName(buf, assocCell, 1, areq, WRITE_LOCK); - } - osi_FreeSmallSpace(buf); - } /* done with volname */ if (cpos) *cpos = ':'; -- 1.9.4