Go to file
Andrew Deason 7e41ee0bd5 vlserver: Correctly pad nvlentry for "O" RPCs
For our old-style "O" RPCs (e.g. VL_CreateEntry, instead of
VL_CreateEntryN), vlserver calls vldbentry_to_vlentry to convert to
the internal 'struct nvlentry' format. After all of the sites have
been copied to the internal format, we fill the remaining sites by
setting the serverNumber to BADSERVERID. For nvldbentry_to_vlentry, we
do this for NMAXNSERVERS sites, but for vldbentry_to_vlentry, we do
this for OMAXNSERVERS.

The thing is, both functions are filling in entries for a 'struct
nvlentry', which has NMAXNSERVERS 'serverNumber' entries. So for
vldbentry_to_vlentry, we are skipping setting the last few sites
(specifically, NMAXNSERVERS-OMAXNSERVERS = 13-8 = 5).

This can easily cause our O-style RPCs to write out entries to disk
that have uninitialized sites at the end of the array. For example, an
entry with one site should have server numbers that look like this:

    serverNumber = {1, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}

That is, one real serverid (a '1' here), followed by twelve
BADSERVERIDs.

But for a VL_CreateEntry call, the 'struct nvlentry' is zeroed out
before vldbentry_to_vlentry is called, and so the server numbers in
the written entry look like this:

    serverNumber = {1, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0}

That is, one real serverid (a '1' here), followed by seven
BADSERVERIDs, followed by five '0's.

Most of the time, this is not noticeable, since our code that reads in
entries from disk stops processing sites when we encounter the first
BADSERVERID site (see vlentry_to_nvldbentry). However, if the entry
has 8 sites, then none of the entries will contain BADSERVERID, and so
we will actually process the trailing 5 bogus sites. This would appear
as 5 extra volume sites for a volume, most likely all for the same
server.

For VL_CreateEntry, the vlentry struct is always zeroed before we use
it, so the trailing sites will always be filled with 0. For
VL_ReplaceEntry, the trailing sites will be unchanged from whatever
was read in from the existing disk entry.

To fix this, just change the relevant loop to go through NMAXNSERVERS
entries, so we actually go to the end of the serverNumber (et al)
array.

This may appear similar to commit ddf7d2a7 (vlserver: initialize
nvlentry elements after read). However, that commit fixed a case
involving the old vldb database format (which hopefully is not being
used). This commit fixes a case where we are using the new vldb
database format, but with the old RPCs, which may still be used by old
tools.

Change-Id: Ic6882d1452963ca93403748917c313068acfdaab
Reviewed-on: https://gerrit.openafs.org/14139
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2020-04-10 11:44:48 -04:00
build-tools regen.sh: Use libtoolize -i, and .gitignore generated build-tools 2016-11-06 00:36:18 -04:00
doc Cleanup vestiges of old shared library build directories 2020-03-05 21:53:26 -05:00
src vlserver: Correctly pad nvlentry for "O" RPCs 2020-04-10 11:44:48 -04:00
tests opr: Allow non-2^x for n_buckets in opr_cache_init 2020-04-10 09:55:35 -04:00
.gitignore Remove alpha_dux/alpha_osf references 2018-09-22 17:05:26 -04:00
.gitreview Add .gitreview 2018-02-04 15:34:55 -05:00
.mailmap git: add a mailmap file 2016-09-25 21:05:23 -04:00
.splintrc
acinclude.m4 autoconf: remove unnecessary mkdir during configure 2018-10-19 00:16:48 -04:00
CODING rxkad: v5der.c format truncation warnings 2019-07-26 09:05:29 -04:00
configure-libafs.ac autoconf: updates and cleanup 2018-08-11 12:22:56 -04:00
configure.ac build: remove unused LINUX_PKGREL from configure.ac 2020-04-03 11:39:41 -04:00
CONTRIBUTING openafs: add a contributor code of conduct 2015-09-18 20:38:28 -04:00
INSTALL FBSD: Remove support for 8.x and 9.x 2020-01-10 16:10:57 -05:00
libafsdep Move build support files into build-tools 2010-07-14 20:40:36 -07:00
LICENSE autoconf: import gcc function attribute check macro 2018-08-10 07:55:00 -04:00
Makefile-libafs.in
Makefile.in tests: Explicitly build target 'all' by default 2020-01-10 16:10:49 -05:00
NEWS Default to crypt mode for unix clients 2017-08-05 18:47:04 -04:00
NTMakefile rxgk: Add NTMakefile to install headers 2019-08-28 02:50:58 -04:00
README Tweak grammar in README 2015-12-28 19:32:17 -05:00
README-WINDOWS Update windows build documentation 2013-07-02 15:14:09 -07:00
regen.sh regen.sh: Use libtoolize -i, and .gitignore generated build-tools 2016-11-06 00:36:18 -04:00

AFS is a distributed file system that enables users to share and
access all of the files stored in a network of computers as easily as
they access the files stored on their local machines. The file system is
called distributed for this exact reason: files can reside on many
different machines, but are available to users on every machine.

OpenAFS 1.0 was originally released by IBM under the terms of the
IBM Public License 1.0 (IPL10).  For details on IPL10 see the LICENSE
file in this directory.  The current OpenAFS distribution is licensed
under a combination of the IPL10 and many other licenses as granted by
the relevant copyright holders.  The LICENSE file in this directory
contains more details, thought it is not a comprehensive statement.

See INSTALL for information about building and installing OpenAFS
on various platforms.

See CODING for developer information and guidelines.

See NEWS for recent changes to OpenAFS.