]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: avoid extra VL_GetEntryByName for .readonly's
authorMarcio Barbosa <mbarbosa@sinenomine.net>
Thu, 20 Sep 2018 12:44:59 +0000 (08:44 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Sun, 9 Feb 2020 17:43:10 +0000 (12:43 -0500)
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.

Reviewed-on: https://gerrit.openafs.org/13334
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 747afb94aa214217a749471679082c6ed8e81e92)

Change-Id: Ieb0bccc359fc8ebc0ad2747dbfb329d232e5e436
Reviewed-on: https://gerrit.openafs.org/13968
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/VNOPS/afs_vnop_lookup.c

index a8564672c0733df3483efeac51e9cd817e3e3f96..439661b17200c48aa603e83f961e5fdb01704ef2 100644 (file)
@@ -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 = ':';