openafs.git
5 years agoman-pages: create the man3 subdirectory in prep-noistall 33/13533/2
Karl Behler [Fri, 22 Mar 2019 11:22:05 +0000]
man-pages: create the man3 subdirectory in prep-noistall

This should fix a build failure reported on the openafs-devel list
today.

Change-Id: I227922f78aaa614b73dd1f5c1c61116168fc0b69
Reviewed-on: https://gerrit.openafs.org/13533
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoafs: Cleanup state on rxfs_*Init errors 10/13510/2
Andrew Deason [Sat, 2 Mar 2019 21:58:00 +0000]
afs: Cleanup state on rxfs_*Init errors

Currently, rxfs_storeInit and rxfs_fetchInit return early if they
encounter an error while starting the relevant fetch/store RPC (e.g.
StartRXAFS_FetchData64). In this scenario, they osi_FreeSmallSpace
their rock before returning, but they never go through their
destructor to free the contents of the rock
(rxfs_storeDestroy/rxfs_fetchDestroy), leaking any resources inside
that have already been initialized.

The only thing that could have been initialized by this point is
v->call, so hitting this condition means we leak an Rx call, and means
we can report the wrong error code (since we never go through
rx_EndCall, we never look at the call's abort code). For
rxfs_fetchInit, most code paths call rx_EndCall explicitly, except for
the code path where StartRXAFS_FetchData64 itself fails.

For both fetches and stores, it's difficult to hit this condition,
because this requires that the StartRXAFS_* call fails, before we have
sent or received any data from the wire. However, this can be hit if
the call is already aborted before we use it, which can happen if the
underlying connection has already been aborted by a connection abort.

Before commit 0835d7c2 ("afs: make sure to call afs_Analyze after
afs_Conn"), this was most easily hit by trying to fetch data with a
bad security object (for example, with expired credentials). After the
first fetch failed due to a connection abort (e.g. RXKADEXPIRED),
afs_GetDCache would retry the fetch with the same connection, and
StartRXAFS_FetchData64 would fail because the connection and call were
already aborted. In this case, we'd leak the Rx call, and we would
throw an RXGEN_CC_MARSHAL error (-450), instead of the correct
RXKADEXPIRED error. This causes libafs to report that the target
server as unreachable, due to the negative error code.

With commit 0835d7c2, this doesn't happen because we call afs_Analyze
before retrying the fetch, which detects the invalid credentials and
forces creating a new connetion object. However, this situation should
still be possible if a different call on the same connection triggered
a connection-level abort before we called StartRXAFS_FetchData64.

To fix this and ensure that we don't leak Rx calls, explicitly call
rxfs_storeDestroy/rxfs_fetchDestroy in this error case, before
returning from rxfs_storeInit/rxfs_fetchInit.

Thanks to yadayada@in.ibm.com for reporting a related issue and
providing analysis.

Change-Id: I15e02f8c9e620c5861e3dcb03c42510528ce9a60
Reviewed-on: https://gerrit.openafs.org/13510
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRemove references to SunOS 4 06/13506/2
Andrew Deason [Mon, 25 Feb 2019 17:35:24 +0000]
Remove references to SunOS 4

We already removed support for Solaris versions before Solaris 8, in
commit e4c2810f ("Remove support for Solaris pre-8"), but there are
still some references to SunOS (meaning SunOS 4) in the tree. This is
even older than Solaris (aka SunOS 5), so get rid of these.

This commit removes most references to SunOS 4 regarding platform
support, and a few comments. This also removes a few comments that
were just wrong or nonsensical (e.g. CMAPPED in afs.h is used by
other platforms; some comments in platform-specific osi_file.c files
referenced SunOS for some reason).

Change-Id: I0dd3176c582409176fd898f9c9539fbd833ea789
Reviewed-on: https://gerrit.openafs.org/13506
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorx: Make rxi_Free(NULL, size) a no-op 14/13514/2
Andrew Deason [Thu, 7 Mar 2019 05:06:16 +0000]
rx: Make rxi_Free(NULL, size) a no-op

Commit 75233973 (afs: Make afs_osi_Free(NULL) a no-op) intended to
make some of our free abstractions behave like the userspace free, so
freeing NULL is a no-op. However, that commit still left rxi_Free such
that rxi_Free(NULL, size) would decrement the relevant allocation
counters.

So to make our free abstractions more consistent, just skip all of
rxi_Free when the given pointer is NULL.

Change-Id: I89047e1846eb3e2932d2a125676fb7ffec8972dc
Reviewed-on: https://gerrit.openafs.org/13514
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAdd rxgk_util.c 37/10937/18
Ben Kaduk [Tue, 10 Dec 2013 22:47:42 +0000]
Add rxgk_util.c

A few helper routines for the security class implementation.

Change-Id: I395802b6c3b2436df4b00906544fc797f3e12e9b
Reviewed-on: https://gerrit.openafs.org/10937
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoAdd rxgk_packet.c 71/10571/20
Ben Kaduk [Tue, 10 Dec 2013 04:07:17 +0000]
Add rxgk_packet.c

Routines to apply and verify encryption and MICs to the data in
rx packets.  Backend to the rxgk_crypto framework for the actual
crypto operations.

Change-Id: I724efacf7df1d688c0d61a327fa9ee9c8168d715
Reviewed-on: https://gerrit.openafs.org/10571
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorxgk: fix typo in make dest rule 89/13489/3
Mark Vitale [Mon, 11 Feb 2019 23:08:42 +0000]
rxgk: fix typo in make dest rule

make dest should create directories in DEST, not DESTDIR.

Fix the rule.

Change-Id: I355e35cc6902517956935d3d2970836494490e69
Reviewed-on: https://gerrit.openafs.org/13489
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agobos: remove smail-notifier 09/13509/4
Cheyenne Wills [Fri, 1 Mar 2019 15:46:32 +0000]
bos: remove smail-notifier

smail-notifier is a sample program that is undocumented and has not
been well maintained.  It produces copious compiler warnings, and
would require effort to bring the code up to decent coding practices.

The bosserver provides a -notifier feature that can be used for
notifications, but that feature does not depend on this sample program.

Removed the code, cleaned up the Makefiles and .gitignore.

Change-Id: I6bd56559121d12ad007acc571b6653aa934eb97f
Reviewed-on: https://gerrit.openafs.org/13509
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoscout: band-aid -Wformat-truncation 70/13470/2
Benjamin Kaduk [Sat, 2 Feb 2019 23:02:08 +0000]
scout: band-aid -Wformat-truncation

gcc8 gets pretty confused about the bounds on these things (presumably
due to our alignment options) and thinks this could potentially be a huge
string.  Check for truncation to appease the compiler, instead of trying
to ensure that the buffer is big enough.

Change-Id: I4c1e0e6a5a38ee67845cbb7791b280b965989bc8
Reviewed-on: https://gerrit.openafs.org/13470
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovol: check snprintf return values in namei_ops 63/13463/5
Benjamin Kaduk [Sat, 2 Feb 2019 18:49:07 +0000]
vol: check snprintf return values in namei_ops

gcc8 is more aggressive about parsing format strings and computing bounds
on the generated text from functions like snprintf.  In this case it seems best
to detect cases of truncation and error out, rather than trying to increase
stack buffer sizes or switch to asprintf.  These paths should be well-behaved
since they are local to the fileserver, so this is mostly about appeasing the
compiler's -Wformat-truncation checks to allow us to build with --enable-checking.

Change-Id: Id3f15e450c0f03143c0cc7e40186d5944a8fa3b4
Reviewed-on: https://gerrit.openafs.org/13463
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agolibadmin: appease clang -Wsometimes-uninitialized 76/13476/2
Benjamin Kaduk [Sun, 3 Feb 2019 01:52:26 +0000]
libadmin: appease clang -Wsometimes-uninitialized

clang thinks that 'time' can be used uninitialized:

bos.c:1472:9: error: variable 'time' is used uninitialized whenever 'if' condition is
      false [-Werror,-Wsometimes-uninitialized]
    if (as->parms[TIME].items) {
        ^~~~~~~~~~~~~~~~~~~~~
bos.c:1478:57: note: uninitialized use occurs here
    if (!bos_ExecutableRestartTimeSet(bos_server, type, time, &st)) {
                                                        ^~~~
bos.c:1472:5: note: remove the 'if' if its condition is always true
    if (as->parms[TIME].items) {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bos.c:1445:5: note: variable 'time' is declared here
    bos_RestartTime_t time;
    ^

but in this command description, the TIME argument is required.
Add a never-triggered error exit to appease the compiler when
--enable-checking is activated.

Change-Id: I38fac64fc5aba071f84f2f9e1b497df22df76f09
Reviewed-on: https://gerrit.openafs.org/13476
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agouss: signed/unsigned char fallout 75/13475/2
Benjamin Kaduk [Sun, 3 Feb 2019 01:48:20 +0000]
uss: signed/unsigned char fallout

When char is signed, assigning 255 to a variable of type char changes
the value, which causes clang to emit a warning and fail the
--enable-checking build.

Change-Id: Id02e2526a9a9dd6657dee55b9dc22da03d102d8c
Reviewed-on: https://gerrit.openafs.org/13475
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorework afs_random() yet again 74/13474/2
Benjamin Kaduk [Sun, 3 Feb 2019 01:45:31 +0000]
rework afs_random() yet again

clang 7 notes that ~0 is signed and that left-shifting into the sign
bit is undefined behvaior.  Use a new construction to clear the low
byte of tv_usec with only bitwise operations that are independent of
the width of tv_usec and stay within the realm of C's defined behavior.

Change-Id: I3e4f0fa4a8b8b72df23ef0c8ad7c4a229ac942f3
Reviewed-on: https://gerrit.openafs.org/13474
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAvoid incomplete function type in casts 73/13473/2
Benjamin Kaduk [Sun, 3 Feb 2019 00:39:53 +0000]
Avoid incomplete function type in casts

clang complains that these casts contain an incomplete function type
(since the function argument is omitted rather than declared to be
void).  Since we just need the cast to pointer type, let the compiler
do it implicitly and pass stock NULL, rather than trying to force a
cast to function-pointer type.

Change-Id: I7f19f2936fe5425573c68fdd727ea90de02defd7
Reviewed-on: https://gerrit.openafs.org/13473
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agodumpscan: appease gcc8 -Wformat-overflow 72/13472/2
Benjamin Kaduk [Sat, 2 Feb 2019 23:10:29 +0000]
dumpscan: appease gcc8 -Wformat-overflow

gcc does not benefit from our external knowledge that tm_year is
tightly bounded, and thinks it could still be in the range
[-21474817482147483647], which would overflow our string buffer.
The function in question does not have error handling in place, so
rather than adding some or trying to assert the proper bounds, just
use a slightly larger buffer for safety.

Change-Id: Iafcba5588b805347ddcc0102969bd0e2a3173dd0
Reviewed-on: https://gerrit.openafs.org/13472
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovenus: appease gcc8's -Wformat-string 71/13471/2
Benjamin Kaduk [Sat, 2 Feb 2019 23:09:36 +0000]
venus: appease gcc8's -Wformat-string

Interestingly, even before this commit, the buffer size was larger
than what the kernel would accept.  Since the kernel does its own
length checking, it's simplest to just allow slightly larger requests
here and have them fail later.

Change-Id: I9ed636e4ad025240cb27b3cc066a8f2a72959396
Reviewed-on: https://gerrit.openafs.org/13471
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agobutc: -Wformat-truncation fallout 68/13468/2
Benjamin Kaduk [Sat, 2 Feb 2019 21:44:54 +0000]
butc: -Wformat-truncation fallout

Increase some buffer sizes to appease gcc8.  While here, use snprintf
instead of plain sprintf(!).

Change-Id: I39d29522b92070ce2845ba3d392aaf2d97fc7b6e
Reviewed-on: https://gerrit.openafs.org/13468
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovlserver: use large enough buffer for rxinfo string 66/13466/2
Benjamin Kaduk [Sat, 2 Feb 2019 20:43:04 +0000]
vlserver: use large enough buffer for rxinfo string

The "[dotted-quad] rxkad:name.inst@cell" construct can be as large as
(3*4+3)+7+3*64+2+1 == 217 characters (including trailing NUL); size
our buffer accordingly to avoid the risk of truncation.

Change-Id: Iee635aa66f5f639dfb0572c559a87b5313c305a9
Reviewed-on: https://gerrit.openafs.org/13466
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovlserver: fix vlentryread() for old vldb formats 65/13465/2
Benjamin Kaduk [Sat, 2 Feb 2019 20:23:03 +0000]
vlserver: fix vlentryread() for old vldb formats

When we're using old format compatibility, use OMAXNSERVERS for the
array lengths instead of MAXNSERVERS.  Otherwise we'll try to copy more
data than we've read.

Detected by gcc8 as:

vlutils.c:183:2: error: ‘memcpy’ forming offset [149, 151] is out of the bounds [0, 148] of object ‘tentry’ with type ‘struct vlentry’ [-Werror=array-bounds]
  memcpy(nbufp->serverFlags, oep->serverFlags, NMAXNSERVERS);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vlutils.c:141:26: note: ‘tentry’ declared here
     struct vlentry *oep, tentry;
                          ^~~~~~

Change-Id: Ie720ca037c5a8bd6aaff5b6d5348161e0175b23b
Reviewed-on: https://gerrit.openafs.org/13465
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovol: avoid -Wformat-truncation issues in vol-salvage.c 64/13464/2
Benjamin Kaduk [Sat, 2 Feb 2019 18:56:26 +0000]
vol: avoid -Wformat-truncation issues in vol-salvage.c

Make some formerly-64-character buffers VMAXPATHLEN (plus a smidgeon)
to give them space to hold the composed paths.

Change-Id: I403c822a8b7376d08fb29f0127315ec439a5cf0d
Reviewed-on: https://gerrit.openafs.org/13464
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agouss: Allocate buffer space for trailing NUL 67/13467/2
Benjamin Kaduk [Sat, 2 Feb 2019 21:26:23 +0000]
uss: Allocate buffer space for trailing NUL

Appease gcc8's -Wformat-truncation engine.

Change-Id: I2113770f63357edf0f5ca273daf0c516a72034a8
Reviewed-on: https://gerrit.openafs.org/13467
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAdd rxgk_token.c 67/10567/22
Ben Kaduk [Mon, 9 Dec 2013 19:35:52 +0000]
Add rxgk_token.c

Routines for constructing tokens (both regular and printed), extracting
and decrypting tokens, and helpers therein.

Provide the ability to print a token using a given session key and
using a random session key; the former is useful for certain variants
of localauth wherein a dummy GSS negotiation is performed with the
same identity acting as initiator and acceptor.

Include a paranoid sanity-check that only the routines intended to
produce printed tokens can produce tokens with a zero-length identities
list.

Change-Id: I0cde7fd0cdf9a27777523cd502b21bdccef41dcc
Reviewed-on: https://gerrit.openafs.org/10567
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoptclient: enable pthreaded support 00/13500/2
Mark Vitale [Mon, 11 Feb 2019 07:54:31 +0000]
ptclient: enable pthreaded support

ptclient has been essentially disabled for pthreads since the ibm-1.0
release.  Remove the conditionals to make a functional pthreaded
ptclient.

Change-Id: Ib0f60b3ab395827b73e5646b014e28ab09607e0e
Reviewed-on: https://gerrit.openafs.org/13500
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoauth: refactor afsconf_Open 97/13397/10
Michael Meffie [Wed, 21 Nov 2018 12:39:24 +0000]
auth: refactor afsconf_Open

Move code to check the AFSCONF environment variable and read the
.AFSCONF files to separate functions.

Rename the internal functions afsconf_OpenInternal and
afsconf_CloseInternal to the more aptly named LoadConfig and
UnloadConfig in preparation for other changes. Add doxygen comments for
these functions.

Change-Id: Ie3361036c59c9e6ef99801891fff9fad63840344
Reviewed-on: https://gerrit.openafs.org/13397
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoSOLARIS: Switch non-embedded vnodes for Solaris 11 96/12696/3
Andrew Deason [Thu, 10 Aug 2017 01:06:05 +0000]
SOLARIS: Switch non-embedded vnodes for Solaris 11

Newer updates to Solaris 11 have been including several changes to the
vnode struct. Since we embed a vnode in our struct vcache, our kernel
module must be recompiled for any such change in order for the openafs
client to work at all.

To avoid the need for this, switch Solaris to using a non-embedded
vnode in our struct vcache. Follow a similar technique as is used in
DARWIN and XBSD, where we allocate a vnode in osi_AttachVnode, and
free it in afs_FlushVCache.

Change-Id: I85fd5d084a13bdea4353b5ad9840fddbc45ce8c0
Reviewed-on: https://gerrit.openafs.org/12696
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoSOLARIS: Fix vnode/vcache casts 95/12695/3
Andrew Deason [Thu, 10 Aug 2017 01:06:03 +0000]
SOLARIS: Fix vnode/vcache casts

A few places were using vnodes and vcaches interchangeably. This is
incorrect, since they may not always be the same thing if we stop
embedding vnodes directly in vcaches Fix these to properly go through
AFSTOV/VTOAFS to convert between vcaches and vnodes.

Change-Id: I8a2e42d7b83a5374d2b16b19c47417e7f44d4f27
Reviewed-on: https://gerrit.openafs.org/12695
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoSOLARIS: Accept vnodes in vnode ops 94/12694/3
Andrew Deason [Thu, 10 Aug 2017 01:06:00 +0000]
SOLARIS: Accept vnodes in vnode ops

Currently, our vnode op callbacks look like this:

    int gafs_fsync(struct vcache *avc, afs_ucred_t *acred);

And a pointer to gafs_fsync is given directly to Solaris. This cannot
be correct, since 'struct vcache' is an OpenAFS type, so Solaris
cannot possibly give us a 'struct vcache'. The actual correct
signature for such a function is something like this:

    int gafs_fsync(struct vnode *vp, afs_ucred_t *acred);

And then the 'gafs_fsync' function is supposed to translate 'vp' into
a vcache.

This works on Solaris right now because we embed the vnode as the
first member in our vcache, and so a pointer to a vnode is also a
pointer to a vcache. However, this would break if we ever change
Solaris vcaches to use a non-embedded vnode (like on some other
platforms). And even now, this causes a lot of warnings in
osi_vnodeops.c, since the function signatures are wrong for our vnode
callbacks.

So to fix this, change all of these functions to accept a 'struct
vnode', and translate to/from vnodes and vcaches appropriately.

Change-Id: Ic1c4bfdb7675037d947273ed987cacd05eddfc92
Reviewed-on: https://gerrit.openafs.org/12694
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoSOLARIS: Reorder definitions for vnode callbacks 93/12693/3
Andrew Deason [Thu, 10 Aug 2017 01:05:56 +0000]
SOLARIS: Reorder definitions for vnode callbacks

Currently, many of the functions for our vnode ops are
forward-declared, right before they are referenced in the relevant
vnop template array. Move the function definitions to before the
references, so we can simply get rid of the forward declarations.

These functions are also all only referenced in this file, so declare
them 'static'.

Change-Id: Icd82b6d6176342e2576ce333b40c4b79e8c692c1
Reviewed-on: https://gerrit.openafs.org/12693
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoSOLARIS: Clean up some osi_vnodeops func defs 92/12692/3
Andrew Deason [Thu, 10 Aug 2017 01:05:50 +0000]
SOLARIS: Clean up some osi_vnodeops func defs

Currently, the Solaris osi_vnodeops.c file forward-declares many of
its function definitions, but doesn't declare the arguments. For
example:

    int afs_nfsrdwr();

This avoids type-checking for a few functions that are called before
they are defined in this file. Furthermore, many of these functions
are only used within this file, but are not declared 'static'.

To fix this weirdness, remove most of the forward declarations (most
are not referenced until the function is defined), and fully declare
the rest. Declare functions 'static' that are not referenced outside
of this file.

This commit only changes functions up to the 'afs_getsecattr'
definition. The rest of the file will be fixed in a future commit.

Change-Id: I3f58b9ad8e9c3ea8b3fe3dffacd5118eee0a7ff2
Reviewed-on: https://gerrit.openafs.org/12692
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoauth: remove stale "magic number" comment 90/13490/2
Mark Vitale [Wed, 6 Feb 2019 21:55:03 +0000]
auth: remove stale "magic number" comment

A comment in GenericAuth() refers to a "magic number" which used to be
present as:

  *aindex = 2;

Commit d5622d03196762bd8a60404fea98b4bb044e076d made this a proper enum:

  *aindex = RX_SECIDX_KAD;

Update the comment to remove mention of a "magic number".

No functional change is incurred by this commit.

Change-Id: I1d4770211fe4f88822426a9fe19db77bbb0d7738
Reviewed-on: https://gerrit.openafs.org/13490
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agocmd: bail if out of memory while printing syntax 35/13335/6
Pat Riehecky [Fri, 21 Sep 2018 15:05:24 +0000]
cmd: bail if out of memory while printing syntax

Bail with an error message to stderr if we are unable to format the
command syntax due to a string allocation error.

Found via scan-build.

[mmeffie: updated commit]

Change-Id: Ib3bc7f53c295d8dde6c07b9c4990cd1b3bcee58c
Reviewed-on: https://gerrit.openafs.org/13335
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLINUX: Propagate afs_linux_readdir BlobScan errors 30/13430/3
Andrew Deason [Thu, 17 Jan 2019 05:44:58 +0000]
LINUX: Propagate afs_linux_readdir BlobScan errors

In afs_linux_readdir, if we detect an error code from BlobScan,
currently we 'break' out of the current while() loop. But right after
this loop, we reset 'code' to 0, ignoring the error we just got from
BlobScan, and acting like we just reached the end of the directory.

This means that if BlobScan could not process the given directory at
all, we'll just fail to iterate through some of the entries in the
given directory, and not report an error.

To fix this, process errors from BlobScan like we do for
afs_dir_GetVerifiedBlob, and return an error code and log a message
about the corrupted dir.

Change-Id: I8bd628624ffc04fc55fd6a0820c73018bd9e4a18
Reviewed-on: https://gerrit.openafs.org/13430
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoptserver: Check for -restricted in SPR_Delete 74/13374/4
Andrew Deason [Sat, 3 Nov 2018 06:04:43 +0000]
ptserver: Check for -restricted in SPR_Delete

Currently, all prdb write operations, except for SPR_Delete, will fail
with PRPERM if called by a non-system:administrators caller while
restricted mode is active.  SPR_Delete is missing this check, and so
is not affected by the -restricted option.

Fix this by inserting the same check for -restricted as all other code
paths that check for -restricted.

Change-Id: I35f19d0b715423cd91769e6de845efa330368e50
Reviewed-on: https://gerrit.openafs.org/13374
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agovol: fix vutil format-truncation nit 62/13462/2
Benjamin Kaduk [Sat, 2 Feb 2019 18:25:35 +0000]
vol: fix vutil format-truncation nit

We need one more byte for the trailing NUL.

Change-Id: I1379e958e3b5ec92802060c4541f419599e49311
Reviewed-on: https://gerrit.openafs.org/13462
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoptserver: Fix AccessOK -restricted for SYSADMINID 73/13373/2
Andrew Deason [Sat, 3 Nov 2018 05:58:58 +0000]
ptserver: Fix AccessOK -restricted for SYSADMINID

According to the documentation, as well as other code paths that check
for -restricted, the -restricted option does not affect members of
system:administrators. Currently, though, AccessOK only bypasses the
-restricted check if the caller is SYSADMINID itself (i.e. localauth).

Fix AccessOK to only do the -restricted checks if the caller is not in
system:administrators, to match the documentation as well as other
ptserver operations.

Change-Id: I3074d4537845f1f4deb7f4b72cdb819391b617e3
Reviewed-on: https://gerrit.openafs.org/13373
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoptserver: Fix AccessOK -restricted for addToGroup 70/13370/2
Andrew Deason [Tue, 30 Oct 2018 19:29:24 +0000]
ptserver: Fix AccessOK -restricted for addToGroup

The function AccessOK is used by all of ptserver RPC handlers that
need to do an authorization check, and the last two arguments are set
as such:

- When adding a member to a group, 'mem' is PRP_ADD_MEM and 'any' is
  PRP_ADD_ANY

- When removing a member from a group, 'mem' is PRP_REMOVE_MEM and
  'any' is 0

- When modifying an entry (setFieldsEntry) or modifying some global
  database fields, 'mem' and 'any' are both set to 0

- When reading an entry and not modifying it, 'mem' and/or 'any' are
  set to other values (depending on if we're checking membership,
  examining the entry itself, etc)

Commit 93ece98c (ptserver-restricted-mode-20050415) added a check to
AccessOK to make it return false for -restricted mode when we are
adding a member to a group, or when 'mem' and 'any' are both 0. This
didn't catch the case when we are removing a member from a group,
though, when 'mem' is PRP_REMOVE_MEM.

It looks like commit a614a8d9 (ptutils-restricted-accessok-20081025)
tried to fix this by adding a check for PRP_REMOVE_MEM, but it also
required 'any' to be set to 0 for the conditional to succeed. This is
true when removing a member from a group, but when adding a member to
a group, 'any' is PRP_ADD_ANY, and so this check fails.

This means that currently, when restricted mode is turned on,
non-admins can still run addToGroup and setFieldsEntry successfully.

Fix this by checking for PRP_ADD_MEM/PRP_REMOVE_MEM separately from
checking if 'mem'/'any' are set to 0. Break up this conditional into
separate if() statements with comments to try to make the checks
more clear.

Change-Id: I7e647865b772c42e70014f48ce9cd53ef511cd5b
Reviewed-on: https://gerrit.openafs.org/13370
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRedhat: 'clean build area' error message during dkms build/install 60/13460/2
Cheyenne Wills [Sat, 26 Jan 2019 00:35:51 +0000]
Redhat: 'clean build area' error message during dkms build/install

dkms invokes a make clean command before and after building the kernel
module. The make clean that is issued at the start of building results
in a nuisance error message because the Makefile doesn't yet exist

    Building module:
    cleaning build area...(bad exit status: 2)

In the dkms.conf file, built from within the openafs.spec, change the
command defined in the CLEAN statement to test for the existence of the
Makefile prior to running the actual make clean

Change-Id: Ifc0d5eed6ef0cbc3ddfd193d27bbcb8a7cf52f2a
Reviewed-on: https://gerrit.openafs.org/13460
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAvoid calling krb5_free_context(NULL) 61/13461/2
Andrew Deason [Fri, 1 Feb 2019 22:31:50 +0000]
Avoid calling krb5_free_context(NULL)

Several places in the code currently call krb5_free_context(ctx) in a
cleanup code path, where 'ctx' may or may not be NULL. This is not
guaranteed to be okay, so check for NULL to make sure we don't cause
issues in these code paths.

While we are here cleaning up krb5_free_context() calls, also fix a
few call sites in afscp_util.c that were not calling krb5_free_context
in all error paths.

Change-Id: I881f01bdf94f00079f84c4bd4bcfa58998e51ac9
Reviewed-on: https://gerrit.openafs.org/13461
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoafs: Throw EIO in DRead on empty dir blob 29/13429/2
Andrew Deason [Thu, 17 Jan 2019 05:46:34 +0000]
afs: Throw EIO in DRead on empty dir blob

DRead currently returns ENOENT if we try to read a page beyond the end
of the given dir blob. We do this to indicate we've hit EOF, but we do
this even if the dir blob is completely empty (which is not a valid
dir blob).

If a dir blob in the cache is truncated due to cache corruption
issues, that means we'll indicate a normal EOF condition in that
directory for most code paths. If someone is trying to list the
directory's entries, for instance, we'll just return that there are no
entries in the dir, even though the dir itself is just invalid.

To avoid this for at least some cases, return an EIO error instead if
the dir blob is completely empty.

Change-Id: I8544e125ad12632523d7c514fe63ff9d87e1cd8f
Reviewed-on: https://gerrit.openafs.org/13429
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovolser: Remove unused VolRestore flags args 58/13458/3
Andrew Deason [Thu, 31 Jan 2019 21:44:38 +0000]
volser: Remove unused VolRestore flags args

SAFSVolRestore has a 'flags' argument, which the volserver passes on
to various internal functions, but the value of the flags never
actually changes any behavior. Remove the 'aflags' argument (and the
derived 'incremental' arg) from a few of our internal functions.

The relevant arguments have been unused since OpenAFS 1.0.

Change-Id: Ib6ba3d5d9aa3e29d720921cb32fe45c871cd803e
Reviewed-on: https://gerrit.openafs.org/13458
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoxstat: remove unused variable 55/13455/2
Michael Meffie [Tue, 29 Jan 2019 16:22:41 +0000]
xstat: remove unused variable

Fix unused variable warning for unused variable oneShotCode.

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

5 years agoscout: fix missing softsig header 54/13454/2
Michael Meffie [Tue, 29 Jan 2019 16:20:52 +0000]
scout: fix missing softsig header

Fix implicit declaration of function opr_softsig_Init() in scout.

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

5 years agoviced: use calloc in SRXAFS_GetXStats 04/13204/8
Michael Meffie [Tue, 12 Jun 2018 15:37:01 +0000]
viced: use calloc in SRXAFS_GetXStats

The file server stats are maintained in global static structures, which
are zero-ed on program start. The full contents are memcpy-ed to
allocated buffers as rx output arguments, so no uninitialized data is
sent over the wire. However, this commit converts the output buffer
allocation from malloc to calloc to make this more clear from code
inspection and make the code more robust.

While here, clean up the comments in SRXAFS_GetXStats and remove the
commented out code for a collection type which was never implemented.
Remove the comments about overwriting spare xstat values, which seems to
be a remnant from an early version of the code.

For informational purposes, add a note at the top of SRXAFS_GetXStats to
make it clear the CallPremable() is intentionally avoided in this
implementation of the GetXStats RPC.  Apparently, the CallPremable() is
omitted since the OpenAFS file server does not to send callbacks to
clients issuing only GetXStats RPCs, and so also avoids sending TMAY
requests to clients like xstat_fs_test.

Note that the presumably older GetStatistics and GetStatistics64 do
unfortunately invoke CallPreamble(), so programs such as scout, must be
able receive RXAFSCB RPCs from OpenAFS file servers.

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

5 years agoconvert xstat and friends to pthreads 53/12753/13
Michael Meffie [Tue, 17 Oct 2017 20:39:50 +0000]
convert xstat and friends to pthreads

Convert the xstat, fsprobe, and gtx libraries and test programs to
pthreads. Build these libraries with libtool.

Build the scout and afsmonitor programs with pthreads instead of LWP.

Change-Id: Ie1737e71b4e57735bf7b6c7dc3177d717ea35ac6
Reviewed-on: https://gerrit.openafs.org/12753
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoauth: fix afsconf_GetExtendedCellInfo memory leak 96/13396/7
Michael Meffie [Thu, 15 Nov 2018 21:19:51 +0000]
auth: fix afsconf_GetExtendedCellInfo memory leak

Commit c4a127d0578e521b97131c5dedf9da58f71b0242
(ubik-clone-support-20010212) added changes to support ubik clone sites.
This commit added the afsconf_GetExtendedCellInfo function, which
returns the info given by the original afsconf_GetCellInfo, plus an
array of booleans (as chars) to indicate which cell servers are ubik
clones.

Unfortunately, the afsconf_GetExtendedCellInfo function calls the
afsconf_OpenInternal function on an already opened configuration. It
does so to look for server entries which are marked as clone sites in
the CellServDB file. Opening the already opened configuration leaks at
least the cellName and local realms information, and is generally
confusing.

Instead, remember which sites are designated as clone sites when the
CellServDB is read when the configuration is opened, and return that
info to the callers of afsconf_GetExtendedCellInfo.

This commit adds the clone array to the afsconf_cell structure and
changes to afsconf_GetCellInfo() for this new server-related data.

As part of this change, remove the no longer needed cell and clones
arguments to the internal function afsconf_OpenInternal, which were
added by commit c4a127d0578e521b97131c5dedf9da58f71b0242.

Update the testcellconfig test program to output the new afsconf_cell
clone member.

This leak was found with valgrind.

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

5 years agoauth: plug auth realms memory leaks 95/13395/6
Michael Meffie [Fri, 16 Nov 2018 15:00:17 +0000]
auth: plug auth realms memory leaks

The function _afsconf_FreeRealms, called by afsconf_CloseInternal, leaks
two afsconf_realms structures.

The function _afsconf_LoadRealms also leaks those two structures when it
fails.

These memory leaks were discovered with valgrind.

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

5 years agoAdd the CellServDB pathname to the afsconf_dir 08/13408/5
Michael Meffie [Sat, 8 Dec 2018 01:29:03 +0000]
Add the CellServDB pathname to the afsconf_dir

The determination of the CellServDB pathname is platform-dependent.
However, error reporting in the current code base assumes the CellServDB
location is platform-independent.

Add the pathname of the CellServDB file to the configuration directory
structure and set the new cellservDB member when opening the
configuration. Use this value when checking if the CellServDB has
changed and update the callers to use the cellservDB member when
reporting errors about the CellServDB file.

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

5 years agoafs: Do not ignore errors in afs_CacheFetchProc 28/13428/2
Andrew Deason [Thu, 17 Jan 2019 06:12:06 +0000]
afs: Do not ignore errors in afs_CacheFetchProc

afs_CacheFetchProc currently has a section of code that looks like
this pseudocode:

    if (!code) do {
        while (length > 0) {
            code = read_from_rx();
            if (code) {
                break;
            }
            code = write_to_cache();
            if (code) {
                break;
            }
        }
        code = 0;
    } while (moredata);
    return code;

When we encounter an error when reading from rx or writing to the
cache, we break out of the current loop to stop processing and return
an error. But there are _two_ loops in this section of the code, so
what we actually do is break out of the inner loop, set 'code' to 0,
and then usually return (since 'moredata' is usually never set).

This means that when we encounter an unexpected error either from the
net or disk (or the memcache layer), we ignore the error and return
success. This means that we'll store a subset of the relevant chunk's
data to disk, and flag that chunk as complete and valid for the
relevant DV. If the error occurred before we wrote anything to disk,
this means we'll store an empty chunk and flag it as valid. The chunk
will be flagged as valid forever, serving invalid data, until the
cache chunk is evicted or manually kicked out. This can result in
files and directories appearing blank or truncated to applications
until the bad chunk is removed.

Possibly the most common way to encounter this issue is when using a
disk cache, and the underlying disk partition is full, resulting in an
unexpected ENOSPC error. Theoretically this can be seen from an
unexpected error from Rx, but we would have to see a short read from
Rx without the Rx call being aborted. If the call was aborted, we'd
get an error from the call to rx_EndCall() later on.

To fix this, change all of these 'break's into 'goto done's, to be
more explicit about where we are jumping to. Convert all of the
'break's in this function in the same way, to make the code flow more
consistent and easier to follow. Remove the 'if () do' on a single
line, since it makes it a little harder to see from a casual glance
that there are two nested loops here.

This problem appears to have been introduced in commit 61ae8792 (Unite
CacheFetchProcs and add abstraction calls), included in OpenAFS
1.5.62.

Change-Id: Ib965a526604e629dc5401fa0f1e335ce61b31b30
Reviewed-on: https://gerrit.openafs.org/13428
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLinux_5.0: replaced current_kernel_time with ktime_get_coarse_real_ts64 34/13434/8
Cheyenne Wills [Sat, 19 Jan 2019 00:22:44 +0000]
Linux_5.0: replaced current_kernel_time with ktime_get_coarse_real_ts64

In Kernel commit fb7fcc96a86cfaef0f6dcc0665516aa68611e736 the
current_kernel_time/current_kernel_time64 functions where renamed
and the calling was standardized.

According to the Linux Documentation/core-api/timekeeping.rst
ktime_get_coarse_real_ts64 is the direct replacement for
current_kernel_time64.  Because of year 2038 issues, there is no
replacement for current_kernel_time.

Updated code that used current_kernel_time to use new name and calling
convention.

Updated autoconf test that sets IATTR_TAKES_64BIT_TIME as well.

Change-Id: I607bdcf6f023425975e5bb747e0e780b3d2a7ce5
Reviewed-on: https://gerrit.openafs.org/13434
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLinux_5.0: replace do_gettimeofday with ktime_get_real_ts64 33/13433/4
Cheyenne Wills [Fri, 18 Jan 2019 23:53:58 +0000]
Linux_5.0: replace do_gettimeofday with ktime_get_real_ts64

In Kernel commit e4b92b108c6cd6b311e4b6e85d6a87a34599a6e3 the
do_gettimeofday function was removed.

According to the Linux Documentation/core-api/timekeeping.rst
ktime_get_real_ts64 is the direct replacement for do_gettimeofday

Updated the macro osi_GetTime to use ktime_get_real_ts64 if it is
available.

Change-Id: I7fcd49958de83a6a040e40bd310a228247c481b2
Reviewed-on: https://gerrit.openafs.org/13433
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoLINUX: correct include for ktime_get_coarse_real_ts64() 37/13437/2
Mark Vitale [Fri, 18 Jan 2019 22:05:49 +0000]
LINUX: correct include for ktime_get_coarse_real_ts64()

The include for the ktime_get_coarse_real_ts64() autoconf test is
incorrect; ktime_get_coarse_real_ts64() has always been in linux/ktime.h
(via #include timekeeping.h), not linux/time.h.

This autoconf test still ran correctly because the OpenAFS build was
inadvertently picking up ktime.h via the default autoconf include path.
Therefore, this commit is needed only to provide documentation and
clarity to future maintainers.

Introduced as a cut-n-paste error (from the current_kernel_time test)
with commit 3c454b39d04f4886536267c211171dae30dc0344 for Linux 4.20.

Change-Id: I994b03a1700330756216c7feab0121c82d0f3ee4
Reviewed-on: https://gerrit.openafs.org/13437
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLinux_5.0: Use super_block flags instead of Mount flags when filling sb 32/13432/2
Cheyenne Wills [Thu, 17 Jan 2019 23:00:37 +0000]
Linux_5.0: Use super_block flags instead of Mount flags when filling sb

In Kernel commit e262e32d6bde0f77fb0c95d977482fc872c51996
the mount flags (MS_) were moved from uapi/linux/fs.h to
uapi/linux/mount.h. This caused a compile failure in
src/afs/LINUX/osi_vfsops.c

The Linux documentation in uapi/linux/mount.h indicates that the MS_
(mount) flags should only be used when calling sys_mount and filesystems
should use the SB_ (super_block) equivalent.

src/afs/LINUX/osi_vfsops.c utilized the mount flag MS_NOATIME while
filling the super_block.  Changed to use SB_NOATIME (which has the same
numeric value as MS_NOATIME) if available.

Change-Id: I2b2199de566fbadd45e857b37d24ce63002c7736
Reviewed-on: https://gerrit.openafs.org/13432
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovol: remove empty directories left by vos zap -force 79/12879/4
Marcio Barbosa [Sat, 11 Aug 2018 17:17:28 +0000]
vol: remove empty directories left by vos zap -force

The vos zap -force command does not remove the directories associated
with the volume in question (AFS_NAMEI_ENV). When the vos zap -force
command is executed, the volume server goes through the /vicep*/AFSIDat
directories and removes the files associated with the volume id received
as an argument. Unfortunately, the volume server does not remove the
directories associated with this volume. As a result, empty directories
are left behind.

To fix this problem, remove the empty directories left behind when vos
zap -force is executed.

Change-Id: I56fd52918223f87e424121bac6a086d7b0a46284
Reviewed-on: https://gerrit.openafs.org/12879
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoroken: Use srcdir for roken-post.h 87/13387/2
Andrew Deason [Tue, 13 Nov 2018 17:09:52 +0000]
roken: Use srcdir for roken-post.h

roken-post.h is a source file, not a generated file in the objdir.
Specify $(srcdir) so we can work with objdir builds.

Change-Id: I1d00ba1f28bea99770c2af56890fbf22ee764820
Reviewed-on: https://gerrit.openafs.org/13387
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRedhat: correct path to kernel module in dkms.config 04/13404/6
Cheyenne Wills [Wed, 28 Nov 2018 22:45:20 +0000]
Redhat: correct path to kernel module in dkms.config

This fix corrects some annoying error and warning messages during
dkms install or uninstall.

Install:
DKMS: build completed.

openafs:
Running module version sanity check.
ERROR: modinfo: could not open /lib/modules/2.6.32-754.6.3.el6.x
86_64/weak-updates/openafs.ko: No such file or directory
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/2.6.32-754.6.3.el6.x86_64/extra/
Adding any weak-modules
WARNING: Can't read module /lib/modules/2.6.32-754.6.3.el6.x86_6
4/weak-updates/openafs.ko: No such file or directory
egrep: /lib/modules/2.6.32-754.6.3.el6.x86_64//weak-updates/open
afs.ko: No such file or directory

Remove
Status: Before uninstall, this module version was ACTIVE on this
kernel.
Removing any linked weak-modules
rmdir: failed to remove `.': Invalid argument
WARNING: Can't read module /lib/modules/2.6.32-754.6.3.el6.x86_6
4/weak-updates/openafs.ko: No such file or directory
egrep: /lib/modules/2.6.32-754.6.3.el6.x86_64//weak-updates/open
afs.ko: No such file or directory

openafs.ko:
 - Uninstallation
   - Deleting from:/lib/modules/2.6.32-754.6.3.el6.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel
   - Use the dkms install command to reinstall any previous
   module version.

Background:

Commit 1c96127e37c0ec41c7a30ea3e4aa68f3cc8a24f6 standardized the
location where the openafs.ko module is installed (from
/kernel/3rdparty to /extra/).  The RPM Spec file was not updated to
build the dkms.conf file with the corrected location.

From the documentation for dkms

 DEST_MODULE_LOCATION is ignored on Fedora Core 6 and higher, Red Hat
 Enterprise Linux 5 and higher, Novell SuSE Linux Enterprise Server 10
 and higher, Novell SuSE Linux 10.0 and higher, and Ubuntu.  Instead,
 the proper distribution-specific directory is used.

However the DEST_MODULE_LOCATION is still used saving and restoring old
copies of the module.

The NO_WEAK_MODULES parameter prevents dkms from creating a symlink into
weak-updates directory, which can lead to broken symlinks when
dkms-openafs is removed.  The weak modules facility was designed to
eliminate the need to rebuild kernel modules when kernel upgrades occur
and relies on the symbols within the kABI.  Openafs uses symbols that
are outside the kABI, and therefor is not a candidate for a weak module.

Change-Id: I52a332036056a359a57a3ab34d56781c896a2eea
Reviewed-on: https://gerrit.openafs.org/13404
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agobuild: declare test targets as phony 19/13419/2
Michael Meffie [Thu, 27 Dec 2018 14:32:35 +0000]
build: declare test targets as phony

Modern versions `make` will not build the 'test' target since a
directory exists with the same name.

    $ grep -C1 '^test:' Makefile
    test:
        cd test; $(MAKE)

    $ make test
    make: 'test' is up to date.

Declare these targets as .PHONY to force make to build the test programs
even when the 'test' directory is present. Also use '&&' to concatenate
commands instead ';' to avoid running the second command when the first
fails.

Change-Id: Id561d7610f80b87b59c632801fa0a4b216feb42d
Reviewed-on: https://gerrit.openafs.org/13419
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agolwp: Avoid freeing 'stackmemory' on AIX32 26/13426/2
Andrew Deason [Mon, 14 Jan 2019 23:12:27 +0000]
lwp: Avoid freeing 'stackmemory' on AIX32

Commit 55013a11 (lwp: Fix possible memory leak from scan-build) added
some free() calls to some otherwise-leaked memory. However, one of
these calls frees the 'stackmemory' pointer, which on AIX32 is not a
pointer from malloc/calloc, but calculated from reserveFromStack().

To avoid corrupting the heap, skip this free call on AIX32. This
commit adds another #ifdef to avoid this, which is unfortunate, but
this is also how the free is avoided in the existing code for
Free_PCB().

Change-Id: I6c4518f810e56c362ee744f250747fe8fc765b13
Reviewed-on: https://gerrit.openafs.org/13426
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorx: remove rx_atomic bitops 90/13390/7
Mark Vitale [Fri, 5 Oct 2018 14:39:23 +0000]
rx: remove rx_atomic bitops

The rx_atomic bitops were introduced with commit
1839cdbe268f4b19ac8e81ae78548f5c78e0c641 ("rx: atomic bit ops").

The last (only) reference to them was recently removed with commit
5ced6025b9f11fadbdf2e092bf40cc87499ed277 ("rx: Convert rxinit_status to
rx_IsRunning()").

Remove the now unreferenced bitops.  This commit is comprised of partial
or complete reverts of the following commits:

ae4ad509d35 rx: fix rx_atomic warnings under Solaris (partial)
c16423ec4e6 rx: fix atomics on darwin (partial)
9dc6dd9858a rx: Fix AIX test_and_set_bit (complete)
1839cdbe268 rx: atomic bit ops (complete)

Note: The rx_atomic bitops for Linux systems are known to be broken due
to incorrect casting of rx_atomic_t into the unsigned long operand
expected by the native Linux bitops.  The failure modes include silent
overruns on little-endian and incorrect results on big-endian.  Do not
merely revert this commit in order to bring these bitops back into the
tree.

Change-Id: I6b63519f63d370ccc8df816b4388487909c17dcd
Reviewed-on: https://gerrit.openafs.org/13390
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agorx: Statically check rx_statisticsAtomic size 14/13414/4
Andrew Deason [Thu, 20 Dec 2018 20:29:47 +0000]
rx: Statically check rx_statisticsAtomic size

Currently, rx_GetStatistics assumes that struct rx_statistics and
rx_statisticsAtomic have the same size (we just memcpy between them).
However, this is never checked, and rx_statistics contains many 'int'
fields where rx_statisticsAtomic has rx_atomic_t fields.

If these are not the same size, our rx stats will silently break, so
add a static assert to make sure they are the same size.

Change-Id: I889867f4a85530c30dd15d32d1822144ea128a95
Reviewed-on: https://gerrit.openafs.org/13414
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRevert "rx: fix rx_atomic warnings under Solaris" 15/13415/3
Andrew Deason [Thu, 20 Dec 2018 20:37:31 +0000]
Revert "rx: fix rx_atomic warnings under Solaris"

This reverts commit ae4ad509d35aab73936a1999410bd80bcd711393. While
that commit did fix the mentioned warnings on Solaris, it also changed
the size of rx_atomic_t. Our code in rx_stats.c assumes that an
rx_atomic_t is 4-bytes wide, and so changing the size of rx_atomic_t
broke our reporting for stats in the 'rx_stats' structure.

To fix this, revert that commit. This reintroduces the mentioned
warnings, but those warnings are reported for our atomic bit-op
functions, which are unused and will be removed by another commit.

Change-Id: Ie3e72cc06690d9f8de79e8f0274ea51079004c38
Reviewed-on: https://gerrit.openafs.org/13415
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoauth: update the auth test programs 94/13394/4
Michael Meffie [Thu, 15 Nov 2018 18:49:21 +0000]
auth: update the auth test programs

Fix build errors for the auth test programs.

Close the configuration directory before exiting the testcellconf
program so we can check for leaks.

Add a call to afsconf_GetExtendedCellInfo to the testcellconf test
program.

Use libcmd to parse the testcellconf command line options.

Add the -reload option to testcellconf to perform an optional reload
test. The user must have file permissions to touch the CellServDB to
perform the reload test.

Change-Id: I1cb4cacf9a15ccf7066fb32bfe5f5d03ef64bfd7
Reviewed-on: https://gerrit.openafs.org/13394
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoafs: avoid afs_GetDownDSlot panic on afs_WriteDCache failure 64/13364/4
Mark Vitale [Mon, 29 Oct 2018 20:48:14 +0000]
afs: avoid afs_GetDownDSlot panic on afs_WriteDCache failure

If afs_GetDownDSlot() finds insuffcient free slots in the
afs_freeDSList, it will walk the afs_DLRU attempting to flush and free
eligible dcaches.  However, if an error occurs during the flush to
CacheItems (afs_WriteDCache()), e.g., -EINTR, afs_GetDownDSlot() will
assert.

However, a panic in this case is overkill, since afs_GetDownDSlot() is a
best-effort attempt to free dslots.  The caller (afs_UFSGetDSlot()) will
allocate more dcaches if needed.

Instead:
- Refactor afs_GetDownDSlot() by moving the QRemove() call to after the
afs_WriteDCache logic, so it accompanies the logic that puts the dcache
back on the freelist.  This is safe because we hold the afs_xdcache W
lock for the duration of the routine.
- If afs_WriteDCache() returns an error, return early and let the caller
handle any recovery.

Change-Id: Ifd0d56120095c9792998ff935776bbd339a76c8a
Reviewed-on: https://gerrit.openafs.org/13364
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovos: restore status information to 'vos status' 00/13400/4
Mark Vitale [Fri, 30 Nov 2018 17:10:50 +0000]
vos: restore status information to 'vos status'

Commit d3eaa39da3693bba708fa2fa951568009e929550 'rx: Make the rx_call
structure private' created accessors for several rx_call members.
However, it simply #ifdef'd out the packet counters and timestamps
reported by 'vos status' (AFSVol_Monitor).  This is a regression for the
1.8.x 'vos status' command.

Instead, supply an accessor so 'vos status' can again be used to monitor
the progress of certain volume operations.

FIXES 134856

Change-Id: I91f5831b21f128bd8e86db63387a454c9e57bcdf
Reviewed-on: https://gerrit.openafs.org/13400
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoafs: Reword "cache is full" messages 10/13410/3
Andrew Deason [Thu, 13 Dec 2018 18:25:32 +0000]
afs: Reword "cache is full" messages

Currently, there are multiple different areas in the code that log a
message that look like this, when we encounter an ENOSPC error when
writing to the cache:

    *** Cache partition is FULL - Decrease cachesize!!! ***

The message is a bit unclear, and doesn't even mention AFS at all.
Reword the message to try to explain a little more what's happening.

Also, since we log the same message in several different places, move
them all to a common function, called afs_WarnENOSPC, so we only need
to change the message in one place.

Change-Id: If1c259bd22a382ff56ed29326aa20c86389d06bc
Reviewed-on: https://gerrit.openafs.org/13410
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoafs: remove dead code afs_osi_SetTime 93/13393/3
Mark Vitale [Thu, 15 Nov 2018 20:41:24 +0000]
afs: remove dead code afs_osi_SetTime

afs_osi_SetTime() has been dead code since -settime support was removed
with commit 1d9888be486198868983048eeffabdfef5afa94b 'Remove
-settime/RXAFS_GetTime client support'.

Remove the dead code.

No functional change is incurred by this commit.

Change-Id: Ie5559325b4c98d7e0786c75ae6507ab9c2c47376
Reviewed-on: https://gerrit.openafs.org/13393
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLinux 4.20: do_settimeofday is gone 92/13392/3
Mark Vitale [Thu, 15 Nov 2018 20:31:37 +0000]
Linux 4.20: do_settimeofday is gone

With Linux commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8 'y2038:
remove unused time interfaces', do_settimeofday() is gone.

However, OpenAFS only calls do_settimeofday() from afs_osi_SetTime(),
which has been dead code since -settime support was removed from afsd
with commit 1d9888be486198868983048eeffabdfef5afa94b 'Remove
-settime/RXAFS_GetTime client support'.

Instead of fixing afs_osi_SetTime() to use a current Linux API, remove
it as dead code.

No functional change is incurred by this commit.  However, this change
is required in order to build OpenAFS on Linux 4.20.

Change-Id: I74913deb249de66b0da71539f2596c971f0fd99a
Reviewed-on: https://gerrit.openafs.org/13392
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLinux 4.20: current_kernel_time is gone 91/13391/3
Mark Vitale [Tue, 13 Nov 2018 16:20:09 +0000]
Linux 4.20: current_kernel_time is gone

With Linux commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8 'y2038:
remove unused time interfaces' (4.20-rc1), current_kernel_time() has
been removed.

Many y2038-compliant time APIs were introduced with Linux commit
fb7fcc96a86cfaef0f6dcc0665516aa68611e736 'timekeeping: Standardize on
ktime_get_*() naming' (4.18).  According to
Documentation/core-api/timekeeping.rst, a suitable replacement for:

  struct timespec current_kernel_time(void)

would be:

  void ktime_get_coarse_real_ts64(struct timespec64 *ts))

Add an autoconf test and equivalent logic to deal.

Change-Id: I4ff622ad40cc6d398267276d13493d819b877350
Reviewed-on: https://gerrit.openafs.org/13391
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoubik: calloc ubik_dbase 63/13363/3
Andrew Deason [Mon, 15 Oct 2018 21:10:59 +0000]
ubik: calloc ubik_dbase

Instead of using malloc and initializing various fields to 0, allocate
our ubik_dbase using calloc, to more easily ensure all fields are
initialized.

Change-Id: I5c2f345a82a2eb73d53ffc3e1b0fa408af6a8311
Reviewed-on: https://gerrit.openafs.org/13363
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoviced: fix typo in help for option -unsafe-nosalvage 67/13367/4
Mark Vitale [Fri, 26 Oct 2018 13:12:44 +0000]
viced: fix typo in help for option -unsafe-nosalvage

Change-Id: I4e72533747250cee1b7d8c091c63c78948be6c28
Reviewed-on: https://gerrit.openafs.org/13367
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoviced: correct option parsing for -vlru*, -novbc 65/13365/3
Mark Vitale [Thu, 25 Oct 2018 14:27:41 +0000]
viced: correct option parsing for -vlru*, -novbc

Commit a5effd9f1011aa319fdf432c67aec604053b8656 "viced: Use libcmd for
command line options" modernized the option parsing for (da)fileserver,
but introduced a few errors for the following options:

-vlruthresh <nn>
-vlruinterval <nn>
-vlrumax <nn>
-novbc

Correct the errors.

Change-Id: If57dfabaa8d4e456b63d47694d288bd8c4235ad2
Reviewed-on: https://gerrit.openafs.org/13365
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agobudb: Remove db.lock 62/13362/2
Andrew Deason [Sat, 20 Oct 2018 21:56:01 +0000]
budb: Remove db.lock

Ever since commit dc8f18d6 (Protect ubik cache accesses), the 'lock'
field in struct memoryDB has been unused. Remove it from the struct
definition.

Change-Id: I90131421ae2e2322debf4249e7464126480832d1
Reviewed-on: https://gerrit.openafs.org/13362
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoubik: Remove version_cond 61/13361/2
Andrew Deason [Sat, 20 Oct 2018 21:56:57 +0000]
ubik: Remove version_cond

Several areas in the code do something like this whenever the database
version is changed:

    #ifdef AFS_PTHREAD_ENV
        opr_cv_broadcast(&ubik_dbase->version_cond);
    #else
        LWP_NoYieldSignal(&ubik_dbase->version);
    #endif

However, ever since commit 3fae4ea1 (ubik: remove unused code),
nothing in the tree waits for this condvar, so it currently doesn't do
anything. Remove this unneeded code.

Change-Id: I6903ed89f9dcee2ce154be8883d656d297c97902
Reviewed-on: https://gerrit.openafs.org/13361
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRemove one more automake VERSION reference 60/13360/2
Andrew Deason [Wed, 17 Oct 2018 21:35:36 +0000]
Remove one more automake VERSION reference

The configure summary was still referencing the old automake-specific
VERSION var. Use the autoconf PACKAGE_VERSION var instead, so this
actually shows our version.

Change-Id: I18007935d0235931f1d2e023abddee7356e8ac2d
Reviewed-on: https://gerrit.openafs.org/13360
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoautoconf: remove unnecessary mkdir during configure 94/12994/3
Michael Meffie [Wed, 4 Apr 2018 22:42:46 +0000]
autoconf: remove unnecessary mkdir during configure

Remove an uneeded mkdir command to create the JAVA/libjafs object
directory, since this directory is automatically created by the
config.status when generating the JAVA/libjafs/Makefile.

Change-Id: Ib02a38c5c23790cb07e5c2433fd4870e8763c3a3
Reviewed-on: https://gerrit.openafs.org/12994
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoautoconf: remove spurious no-op 93/12993/3
Michael Meffie [Wed, 4 Apr 2018 22:20:02 +0000]
autoconf: remove spurious no-op

Change-Id: I27242481dc3039f6776deb89e31793deee7f2840
Reviewed-on: https://gerrit.openafs.org/12993
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoautoconf: fix pio checks name 92/12992/3
Michael Meffie [Wed, 4 Apr 2018 22:13:24 +0000]
autoconf: fix pio checks name

The autoconf macro to perform the positional i/o checks was misnamed as
hpux checks (since there happens to be a specific check for hpux at the
top of the macro).  Change the macro name and m4 file name to be more
accurately named.

Change-Id: Ib85728fbfe67930cb5f9f1f0e34f7aa1195fdfc6
Reviewed-on: https://gerrit.openafs.org/12992
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agovol: avoid query for parent id when deleting disk header 39/12839/4
Michael Meffie [Thu, 21 Dec 2017 16:59:38 +0000]
vol: avoid query for parent id when deleting disk header

When a DAFS volume server removes a volume disk header file (V*.vol),
the volume server invokes an fssync command to have the file server
delete the Volume Group Cache (VGC) entry corresponding to the volume id
and the parent id of the removed volume header.

The volume parent id is unknown to the volume server when removing a
volume disk header on behalf of a "vos zap -force" operation. In this
case, the volume server issues a fssync query to attempt look up to the
parent id from the file server's VGC.  If this fssync query fails for
some reason, volume server is unable to delete the VGC entry for the
deleted volume header. The volume server logs an error and vos zap
reports a undocumented error code.

One common way this can be encountered is to issue a "vos zap -force" on
a file server that has just been restarted. In this case, the VGC may
not be fully populated yet, so the volume server is not able to look up
the parent id of the given volume.

With this commit, relax the requirement for the parent id when deleting
VGC entries. A placeholder of 0 is used to mean any parent id for the
given volume id.

This obviates the need to query for the parent id when performing a "vos
zap -force", and allows the volume server to remove any VGC entries
associated with the volume id being zapped.

Change-Id: Iee8647902d93a3c992fca4c4f3880a3393f0b95f
Reviewed-on: https://gerrit.openafs.org/12839
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoRemove automake autoconf vars 57/13357/2
Andrew Deason [Thu, 11 Oct 2018 05:18:17 +0000]
Remove automake autoconf vars

Commit 4706854f (autoconf: updates and cleanup) removed our invocation
of AM_INIT_AUTOMAKE, which defines the output variables PACKAGE and
VERSION. Several files in our build system are still referencing
@PACKAGE@ and @VERSION@, though, leaving them un-substituted. This
most easily is seen as the AFSVersion version string remaining as
"@VERSION@" when the tree is built without git, but it also affects
some packaging in the tree.

Remove references to @VERSION@ and @PACKAGE@, replacing them with
their autoconf equivalents @PACKAGE_VERSION@ and @PACKAGE_TARNAME@.

Change-Id: I6c6a09a46c4af4259009a4a60cfdaee63d6258c2
Reviewed-on: https://gerrit.openafs.org/13357
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoafs: Remove afs_xosi 50/13350/2
Andrew Deason [Fri, 28 Sep 2018 22:12:40 +0000]
afs: Remove afs_xosi

Since OpenAFS 1.0, all platforms in libafs have a lock called
afs_xosi, which is acquired and released around calls like VOP_GETATTR
on cache files. However, this lock doesn't appear to protect anything;
on all platforms, the code that runs while the lock is held uses only
calls VOP_GETATTR and accesses local variables (aside from
afs_osi_cred, which we use similarly in many other places). The
purpose of the lock has never been documented, and is not mentioned at
all in the afs_rwlocks text file.

The comment by the afs_xosi lock declaration suggests that the lock
was originally introduced to protect access to 'tvattr', which perhaps
was a global variable in the past. All uses of 'tvattr' are local now,
though, so protecting access to it doesn't make any sense.

So, remove afs_xosi, to remove the unnecessary serialization of
VOP_GETATTR calls.

Change-Id: Ib3764600ae0155057361418c86b49a3507bdcd94
Reviewed-on: https://gerrit.openafs.org/13350
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoafs: Free 'addrs' array 55/13355/2
Andrew Deason [Mon, 1 Oct 2018 15:56:53 +0000]
afs: Free 'addrs' array

Currently, 3 places in libafs allocate an 'addrs' array in a very
similar way to loop through our list of servers:
ForceAllNewConnections(), afs_LoopServers(), and PCallBackAddr(). Of
these, only afs_LoopServers actually frees the array.
ForceAllNewConnections and PCallBackAddr leak the memory, but these
are only hit from infrequent pioctls that can only be run by root, so
the impact is small.

Fix ForceAllNewConnections and PCallBackAddr to free the array.

Change-Id: Ic348e29cefa7c41cbcb30f738f943e8d022a97f0
Reviewed-on: https://gerrit.openafs.org/13355
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agomacos: packaging support for MacOS X 10.14 49/13349/2
Marcio Barbosa [Sun, 30 Sep 2018 21:38:53 +0000]
macos: packaging support for MacOS X 10.14

This commit introduces the new set of changes / files required to
successfully create the dmg installer on OS X 10.14 "Mojave".

Change-Id: Ia1238b454350777bbfbf3dfd2be0c6c523348928
Reviewed-on: https://gerrit.openafs.org/13349
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agomacos: add support for MacOS 10.14 48/13348/2
Marcio Barbosa [Wed, 26 Sep 2018 03:18:38 +0000]
macos: add support for MacOS 10.14

This commit introduces the new set of changes / files required to
successfully build the OpenAFS source code on OS X 10.14 "Mojave".

Change-Id: Ib7cbd531ad6db3340d59e76abdecbe75886a4d5c
Reviewed-on: https://gerrit.openafs.org/13348
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoauth: check if argument of afsconf_Close* is null 52/13352/2
Marcio Barbosa [Mon, 1 Oct 2018 21:44:22 +0000]
auth: check if argument of afsconf_Close* is null

Currently, we do not check if the argument of afsconf_Close /
afsconf_CloseInternal is equal to null. In order to avoid a possible
segmentation fault, add the checks.

Change-Id: I45635ad2d735505637072867edb7ff17da3c671a
Reviewed-on: https://gerrit.openafs.org/13352
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>

5 years agoafs: make sure to call afs_Analyze after afs_Conn 88/13288/3
Michael Meffie [Fri, 16 Mar 2018 14:25:18 +0000]
afs: make sure to call afs_Analyze after afs_Conn

The afs_Conn function is used to pick a connection for a given RPC. The
RPC is normally wrapped within a do-while loop which calls afs_Analyze
to handle the RPC code and manage the server connection references.
Among other things, afs_Analyze can mark the server as down, blacklist
idle servers, etc.

There are some special cases in which we break out of this do-while loop
early, by putting the connection reference given by afs_Conn and then
jumping out of the loop.

In these cases, be sure to call afs_Analyze to put the server connection
we got from afs_Conn, and to handle the RPC return code, possibly
marking the server as down or blacklisted.

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

5 years agoDARWIN: replace macro exported by automake 54/13354/2
Marcio Barbosa [Fri, 5 Oct 2018 15:26:34 +0000]
DARWIN: replace macro exported by automake

Commit 4706854f57043c8393baa922dd1974176e110a19 removed automake
references from the source tree. As a result, VERSION (exported by
AM_INIT_AUTOMAKE and obtained from Autoconf's AC_INIT macro) is not
available anymore. Unfortunately, a reference to this macro can be found
in src/afs/DARWIN/osi_module.c. Consequently, builds on OS X fail with
the following message:

    osi_module.c:144:32: error: use of undeclared identifier 'VERSION'

To fix this problem, replace VERSION by PACKAGE_VERSION (defined by
AC_INIT).

Change-Id: Ib3821d79c4cddd59c399985762e13dec755d8642
Reviewed-on: https://gerrit.openafs.org/13354
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoubik: do not reuse the offset variable for the sync site address 51/13351/3
Michael Meffie [Mon, 1 Oct 2018 15:38:37 +0000]
ubik: do not reuse the offset variable for the sync site address

The ubik SendFile function performs a sanity check of the host address
before proceeding with the file transfer.  Currently this check reuses
the file offset local variable to hold the value of the sync site
address, a 32-bit IPv4 address. Not only is this confusing, but also
causes a signed/unsigned type mismatch when comparing host addresses.
Instead of being so stingy with local variables, declare a new local
variable of the correct type to hold the value of the sync site address.

This separation is also a prerequisite for supporting larger address
types in the future.

Change-Id: I116fe210f418e6914afeff37c44d30bf795e2413
Reviewed-on: https://gerrit.openafs.org/13351
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovlserver: Remove sascnvldb 45/13345/2
Andrew Deason [Mon, 24 Sep 2018 20:41:23 +0000]
vlserver: Remove sascnvldb

"sascnvldb" appears to be a variant of cnvldb that was used to convert
vldb database blobs from even older versions than what cnvldb handles.
However, it has never been built by default (some makefile rules
reference the program, but it's never built unless the user explicitly
runs 'make sascnvldb'), and it currently cannot build due to a variety
of compiler errors.

Remove the dead code.

Change-Id: I5692d2cd058aa4ae9222ce25721001aabcca5eb7
Reviewed-on: https://gerrit.openafs.org/13345
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agofsint: remove dead code 24/13324/5
Mark Vitale [Fri, 22 Jun 2018 20:52:08 +0000]
fsint: remove dead code

The last references to these objects were removed with commit
3828c257ae33306bbdd3c6db9381601fe5b1b110
"dead-code-and-prototyes-20060214".

A few mentions of CBS and BBS are left in the documentation as
historical references:
- doc/man-pages/pod1/rxgen.pod
- src/kauth/AuthServer.mss

Change-Id: Ia24eef7bb1509ff10d11de5c51e688e27f69417a
Reviewed-on: https://gerrit.openafs.org/13324
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agocmd: improve help for programs without subcommands 83/10983/8
Michael Meffie [Fri, 4 Apr 2014 14:27:10 +0000]
cmd: improve help for programs without subcommands

Some programs do not have subcommands (other than the standard "help",
and "version" subcommands).  The cmd library provides the "noopcode"
mechanism for new subcommand-less programs, but older programs take
advantage of the optional "initcmd" token to simulate subcommand-less
programs.  The "initcmd" token is optional to run the command, however
it is required to display the command help.

For example, running the xstat_cm_test program without any options gives
a syntax error:

    $ xstat_cm_test
    xstat_cm_test: Missing required parameter '-cmname'
    ...

Retrying with -help (or help, -h, --help), gives the rather unhelpful
output:

    $ xstat_cm_test -help
    xstat_cm_test: Commands are:
    apropos         search by help text
    help            get help on commands
    initcmd         initialize the program

It is not obvious to the user how to get the command usage for the
program, nor that the initcmd subcommand to "initialize the program" is
actually is a placeholder to run the program.

Instead, display the command usage when help is requested and initcmd is
the only defined subcommand for a program.

For example:

    $ xstat_cm_test -help
    Usage: src/xstat/xstat_cm_test [initcmd]
             -cmname <Cache Manager name(s) to monitor>+
             -collID <Collection(s) to fetch>+ [-onceonly]
             [-frequency <poll frequency, in seconds>]
             [-period <data collection time, in minutes>] [-debug] [-help]
    Where: -onceonly  Collect results exactly once, then quit
           -debug     turn on debugging output

The libcmd library now supports an "noopcode", which should used for
future subcommand-less programs, but converting old programs to remove
the initcmd opcode could break scripts which actually specify the
optional initcmd token.

This commit adds a new libcmd flag called CMD_IMPLICIT which is used to
denote built-in subcommands such as "version" and "help".

Change-Id: Iee9cb2761254543f74166e5c240685f85b6915b6
Reviewed-on: https://gerrit.openafs.org/10983
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAvoid format truncation warnings 74/13274/4
Andrew Deason [Tue, 7 Aug 2018 22:27:24 +0000]
Avoid format truncation warnings

With gcc 7.3, we start getting several warnings like the following:

vutil.c: In function ‘VWalkVolumeHeaders’:
vutil.c:860:34: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 63 [-Werror=format-truncation=]
      snprintf(name, VMAXPATHLEN, "%s" OS_DIRSEP "%s", partpath, dentry->d_name);

Most or all of these truncations should be okay, but increase the size
of the relevant buffers so we can build with warning checking turned
on.

Change-Id: Iac62d6fcfa46f523c34bf1b0ebc2770d3d67c174
Reviewed-on: https://gerrit.openafs.org/13274
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agovlserver: Remove 'register' argument 46/13346/2
Andrew Deason [Tue, 25 Sep 2018 21:52:14 +0000]
vlserver: Remove 'register' argument

Commit 4a531cb7 (death to register) removed the 'register' declaration
from variables/arguments. But commit 3bf03502 (vlserver: Add a struct
for trans-specific data) accidentally added one back in at around the
same time, probably due to a rebase/merge mistake.

Take the 'register' declaration back out.

Change-Id: I73f206a57ab6b97195771e39556d2b0064be4cf3
Reviewed-on: https://gerrit.openafs.org/13346
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoCellServDB update 14 May 2018 34/13134/3
Benjamin Kaduk [Thu, 31 May 2018 00:38:57 +0000]
CellServDB update 14 May 2018

Update all three copies in the tree, and the rpm specfile.

Change-Id: I572ff4e39ab757128f0082a4f447565e94b8dee5
Reviewed-on: https://gerrit.openafs.org/13134
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoLog binding ip address and port during startup 72/13272/4
Andrew Deason [Mon, 20 Aug 2018 19:53:35 +0000]
Log binding ip address and port during startup

Many daemons currently have the ability to bind to a specific ip
address using the -rxbind parameter. The behavior can be a little
unintuitive, however, since we only bind to the ip address we find via
NetInfo/NetRestrict processing, and only if we end up with a single ip
address. Since that processing involves examining the set of ip
addresses available, this can have confusing results if, for instance,
a daemon starts up while an administrator is changing the local ip
configuration.

If a daemon binds to a different ip address than the administrator
expects, this can be very confusing, especially since for most daemons
we don't log our bound ip anywhere. To help alleviate this, change the
startup code for all of our daemons to log what ip we are trying to
bind to (or "0.0.0.0" if none), along with our local port.

Change-Id: I18d3647c4d134177a0a17c6a64583d444558a9f6
Reviewed-on: https://gerrit.openafs.org/13272
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agofsprobe: add fsprobe_Wait function 47/12747/6
Michael Meffie [Wed, 11 Oct 2017 02:57:01 +0000]
fsprobe: add fsprobe_Wait function

Move the lwp code to wait in the fsprobe applications down to the
fsprobe library.

This is a non-functional change in anticipation of converting the
fsprobe library and programs to pthreads.

Change-Id: I2972b13e2e3eeb691c64c91b0640bbc97e7d0b21
Reviewed-on: https://gerrit.openafs.org/12747
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoxstat: add xstat_*_Wait functions 46/12746/6
Michael Meffie [Tue, 10 Oct 2017 02:23:31 +0000]
xstat: add xstat_*_Wait functions

Add the xstat_cm_Wait and xstat_fs_Wait functions and move the code to
wait for the xstat data collection to complete from the applications
down to the xstat library.

This is a non-functional change in anticipation of converting the xstat
library and programs to pthreads.

Change-Id: Ifd1d6bcda618c89b4ce46e1e64f33b0b30a89a72
Reviewed-on: https://gerrit.openafs.org/12746
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorx: Convert rxinit_status to rx_IsRunning() 61/12761/5
Andrew Deason [Thu, 2 Nov 2017 21:41:52 +0000]
rx: Convert rxinit_status to rx_IsRunning()

Currently, all rx code examines the atomic rxinit_status to determine
if rx is running (that is, if rx_InitHost has been called, and
rx_Finalize/shutdown_rx hasn't been called). This is used in rx.c to
see if we're redundantly calling our setup/teardown functions, and
outside of rx.c in a couple of places to see if rx-related resources
have been initialized.

The usage of rxinit_status is a little confusing, since setting bit 0
indicates that rx is not running, and clearing bit 0 indicates rx is
running. Since using rxinit_status requires atomic functions, this
makes code checking or setting rxinit_status a little verbose, and it
can be hard to see what it is checking for. (For example, does
'if (!rx_atomic_test_and_clear_bit(&rxinit_status, 0))' succeed when
rx running, or when rx is not running?)

The current usage of rxinit_status in rx_InitHost also does not handle
initialization errors correctly. rx_InitHost clears rxinit_status near
the beginning of the function, but does not set rxinit_status if an
error is encountered. This means that any code that checks
rxinit_status (such as another rx_InitHost call) will think that rx
was initialized successfully, but various resources aren't actually
setup. This can cause segfaults and other errors as the code tries to
actually use rx.

This can easily be seen in bosserver, if bosserver is started up while
the local host/port is in use by someone else. bosserver will try to
rx_InitHost, which will fail, and then we'll try to rx_InitHost again,
which will immediately succeed without doing any init. We then
segfault quickly afterwards as we try to use unitialized rx resources.

To fix all of this, refactor code using rxinit_status to use a new
function, called rx_IsRunning(), to make it a little clearer what
we're checking for. We also re-introduce the LOCK_RX_INIT locks to
prevent functions like rx_InitHost and rx_Finalize from running in
parallel.

Note that non-init/shutdown code (such as rx_upcall or rx_GetIFInfo)
does not need to wait for LOCK_RX_INIT to check if rx is running or
not. These functions only care if rx is currently setup enough to be
used, so we can immediately return a 'yes' or 'no' answer. That is, if
rx_InitHost is in the middle of running, rx_IsRunning returns 0, since
some resouces may not be fully initialized.

Change-Id: Ia14a6a725c9662b9db0adef48c33b48a93ffe051
Reviewed-on: https://gerrit.openafs.org/12761
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoSOLARIS: Fix libafs $(KOBJ) parallel make race 44/13344/2
Andrew Deason [Sat, 22 Sep 2018 06:58:17 +0000]
SOLARIS: Fix libafs $(KOBJ) parallel make race

Currently, our COMPDIRS make rule for SOLARIS libafs builds looks like
this:

    ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
        for t in $(KOBJ) ; do
            # set some variables ; \
            cd $$t ; \
            $(MAKE) $@_libafs || exit $$? ; \
            cd ../ ;\
        done

And Makefile.common has this:

    all: setup $(COMPDIRS)

Where the 'setup' rule creates the $(KOBJ) dirs and sets up some
symlinks.

For parallel builds, this means that our commands in the ${COMPDIRS}
target can be running in parallel with the 'setup' target, and so our
$(KOBJ) dirs may not exist by the time we try to 'cd $$t'.

For single-KOBJ platforms this actually largely works, since the 'cd'
will fail, but then the subsequent 'make' will run (just in the wrong
dir), but this can cause us to wastefully re-compile the same source
files (and cause some possibly confusing error messages). For
platforms with multiple KOBJs, this causes obvious problems, since we
don't cd into each KOBJ dir.

To solve this, just have the ${COMPDIRS}/etc rule depend on setup, so
we know that 'setup' has finished running. Also change our way of
'cd'ing into each KOBJ dir to actually cause the rule to fail, to make
any errors here more obvious and consistent.

Change-Id: Id2e662f36ef47a6182716728167b2da4713893c6
Reviewed-on: https://gerrit.openafs.org/13344
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoSOLARIS: Fix platforms for KOBJ definition 43/13343/2
Andrew Deason [Sat, 22 Sep 2018 03:13:25 +0000]
SOLARIS: Fix platforms for KOBJ definition

Currently, we define KOBJ to "MODLOAD32 MODLOAD64" for the following
platforms:

<all -sun4x_510 sun4x_511 sunx86_511>

Which doesn't make any sense, since "all" includes sun4x_511 and
sunx86_511. The previous commits that modified this line, e4c2810f
(Remove support for Solaris pre-8) and c6a22d67 (SOLARIS: Do not build
x86 kernel module on 5.11), clearly meant to change the platforms
sun4x_511 and sunx86_511 to use the KOBJ on the next line, but omitted
the leading "-" for the platform.

This doesn't break anything, since the Makefile on these platforms
expands to:

    KOBJ = MODLOAD32 MODLOAD64
    KOBJ = MODLOAD64

So the first KOBJ line is effectively ignored. It's confusing, though,
so fix this line so these platforms only get one KOBJ definition.

Change-Id: Idea9fdee4ac5883428748c2a5fdfa9707406436a
Reviewed-on: https://gerrit.openafs.org/13343
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRun ctfconvert/ctfmerge for all objects 08/13308/4
Andrew Deason [Thu, 6 Sep 2018 18:42:11 +0000]
Run ctfconvert/ctfmerge for all objects

Commit 88cb536f (autoconf: detect ctf-tools and add ctf to libafs)
introduced running ctfconvert and ctfmerge for libafs on Solaris, but
didn't add any CTF data for userspace code. This commit causes the
same commands to be run for every binary that we build (if the ctf
tools are available).

To accomplish this, also refactor how we run ctfconvert and ctfmerge.
The approach in commit 88cb536f would require us to modify the
makefile rule for every executable to run RUN_CTFCONVERT and
RUN_CTFMERGE, which is somewhat impractical. So instead in this
commit, we modify all of our *_CCRULE and *_LDRULE variables to wrap
the compiler invocation with the new CC_WRAPPER script. This means our
*RULE variables change from something like this:

    FOO_CCRULE = $(RUN_CC) $(CC) $(XXX_FLAGS) -o $@

to something like this:

    FOO_CCRULE = $(RUN_CC) $(CC_WRAPPER) $(CC) $(XXX_FLAGS) -o $@

CC_WRAPPER expands to the script src/config/cc-wrapper, which just
runs ctfconvert or ctfmerge on the relevant files after the
compiler/linker runs. If the CTF tools are not configured, CC_WRAPPER
expands to nothing, to limit our impact on other platforms.

This commit was developed in collaboration with
mbarbosa@sinenomine.net.

Change-Id: Id19ba9d739edc68f01c2db7d5caa20758ec8144a
Reviewed-on: https://gerrit.openafs.org/13308
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoCall rx_InitHost once during daemon startup 71/13271/4
Andrew Deason [Tue, 7 Aug 2018 16:17:43 +0000]
Call rx_InitHost once during daemon startup

Currently, a few daemons calls rx_InitHost in different places, and
under different conditions. For example, vlserver calls rx_InitHost
only when we -rxbind to a specific ip address, and then also makes an
additional rx_Init call. Other daemons always call rx_InitHost, or
just call rx_InitHost sometimes and don't make an extra rx_Init call.

To try to make the various daemons behave a little more consistently,
change the startup code to always call rx_InitHost, and to only call
it once. Note that rx_InitHost is the same as calling rx_Init with
INADDR_ANY as the ip address, and calling rx_Init* after a previous
rx_Init* call is effectively a no-op.

Change-Id: Ifd15175349a7b4695e684ca82deb8a8af5063073
Reviewed-on: https://gerrit.openafs.org/13271
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>