From: Michael Meffie Date: Thu, 16 Apr 2020 20:29:09 +0000 (-0400) Subject: vlserver: fix missing read-only entries from ListAttributesN2 X-Git-Tag: openafs-devel-1_9_0~16 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=904f5bd398db248c11b30ef7e360ce5141dcd1f3;hp=13a49aaf0d5c43bce08135edaabb65587e1a8031 vlserver: fix missing read-only entries from ListAttributesN2 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 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/src/vlserver/vlprocs.c b/src/vlserver/vlprocs.c index 45905fc..89f8760 100644 --- a/src/vlserver/vlprocs.c +++ b/src/vlserver/vlprocs.c @@ -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 =