vlserver: fix missing read-only entries from ListAttributesN2 54/14154/7
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 16 Apr 2020 20:29:09 +0000 (16:29 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 21 Aug 2020 16:48:58 +0000 (12:48 -0400)
The ListAttributesN2() RPC can fail to list read-only entries under
certain circumstances. This RPC is used by the `vos listvldb` command to
retrieve vldb entries (unless the -name option is given). The `vos
listvldb` command fails to list volume entries when run with the
'-server' option for volumes that have read-only replicas, but have not
been released.

Consider the following example volume:

    $ vos create fs1.example.com a test
    $ vos addsite fs1.example.com a test
    $ vos addsite fs2.example.com a test
    $ vos listvldb
    ...
    test
        RWrite: 536870921
        number of sites -> 3
           server fs1.example.com partition /vicepa RW Site
           server fs1.example.com partition /vicepa RO Site  -- Not released
           server fs2.example.com partition /vicepa RO Site  -- Not released

`vos listvldb` fails to find the volume when the search is limited to
server 'fs2':

    $ vos listvldb -server fs2.example.com
    VLDB entries for server fs2.example.com
    Total entries: 0

Instead of the expected results:

    $ vos listvldb -server fs2.example.com
    test
        RWrite: 536870921
        number of sites -> 3
           server fs1.example.com partition /vicepa RW Site
           server fs1.example.com partition /vicepa RO Site  -- Not released
           server fs2.example.com partition /vicepa RO Site  -- Not released

This situation makes it difficult to remove old server addresses from
the vldb.  In this situation, 'vos remaddrs' and 'vos changeaddr
-remove' commands will complain the server addresses are still in use by
volume entries, however running 'vos listvldb -server' will not show
which volumes entries are in use.

The entries are not listed for unreleased volumes because the
ListAttributesN2() RPC is currently checking the volume VLF_ROEXISTS
flag, instead of the server site flags (serverFlags) to determine when
the entry is a read-only site. The volume VLF_ROEXISTS flag is set when
a volume is released.

To fix this, make ListAttributesN2 check for the VLSF_ROVOL site flag,
instead of the VLF_ROEXISTS entry flag.

Change-Id: Ib636fbe016d1d2f5b117624d9930dba83ebcef8a
Reviewed-on: https://gerrit.openafs.org/14154
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/vlserver/vlprocs.c

index 45905fc..89f8760 100644 (file)
@@ -1841,7 +1841,7 @@ ListAttributesN2(struct rx_call *rxcall,
                 * pick up entries marked NEWREPSITEs and DONTUSE.
                 */
                else {
-                   if (tentry.flags & VLF_ROEXISTS) {
+                   if ((tentry.serverFlags[k] & VLSF_ROVOL) != 0) {
                        if (findname) {
                            if (namematchRO) {
                                thismatch =