13170 Commits

Author SHA1 Message Date
Andrew Deason
fa3ce81178 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>
2019-01-14 18:50:29 -05:00
Michael Meffie
67c406e57a 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>
2019-01-11 11:21:16 -05:00
Mark Vitale
d6f52d11c3 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>
2019-01-05 18:52:38 -05:00
Mark Vitale
59d3a8b86d 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>
2019-01-03 09:58:42 -05:00
Andrew Deason
d9d9571785 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>
2018-12-20 21:59:29 -05:00
Mark Vitale
16b981ec66 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>
2018-11-22 18:34:09 -05:00
Mark Vitale
aa80f892ec 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>
2018-11-22 18:32:09 -05:00
Mark Vitale
3c454b39d0 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>
2018-11-22 18:30:10 -05:00
Andrew Deason
bfb2ebdfc2 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>
2018-10-26 10:21:52 -04:00
Mark Vitale
84b3e1c436 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>
2018-10-26 09:52:39 -04:00
Mark Vitale
d058acb354 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>
2018-10-26 09:33:05 -04:00
Andrew Deason
a821938394 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>
2018-10-26 09:29:53 -04:00
Andrew Deason
7eeec61181 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>
2018-10-26 09:29:45 -04:00
Andrew Deason
0f65b40b24 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>
2018-10-23 13:46:16 -04:00
Michael Meffie
db38561dea 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>
2018-10-19 00:16:48 -04:00
Michael Meffie
eb47fa9879 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>
2018-10-19 00:04:50 -04:00
Michael Meffie
b1b3322a68 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>
2018-10-18 23:47:23 -04:00
Michael Meffie
65b55bcc26 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>
2018-10-18 22:45:56 -04:00
Andrew Deason
2f2c2ce62a 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>
2018-10-16 12:18:08 -04:00
Andrew Deason
d75bc6370f 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>
2018-10-12 09:40:39 -04:00
Andrew Deason
0548ee436d 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>
2018-10-12 08:46:49 -04:00
Marcio Barbosa
2aeabf8c5b 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>
2018-10-11 23:51:58 -04:00
Marcio Barbosa
72b2670a9e 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>
2018-10-11 23:50:17 -04:00
Marcio Barbosa
bd58bb8500 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>
2018-10-09 10:28:27 -04:00
Michael Meffie
0835d7c2a1 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>
2018-10-06 16:06:20 -04:00
Marcio Barbosa
07ed94cfd8 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>
2018-10-05 14:17:31 -04:00
Michael Meffie
f0bab78cbe 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>
2018-10-05 10:06:02 -04:00
Andrew Deason
d7ae7df42c 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>
2018-10-05 09:40:19 -04:00
Mark Vitale
0796de43ea 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>
2018-10-05 09:27:36 -04:00
Michael Meffie
77ae3dc899 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>
2018-10-05 09:27:19 -04:00
Andrew Deason
2daa413e3e 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>
2018-10-05 09:13:28 -04:00
Andrew Deason
fa6edf73d4 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>
2018-10-05 09:06:53 -04:00
Benjamin Kaduk
4a2b5101af 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>
2018-10-05 09:00:31 -04:00
Andrew Deason
02dede5d40 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>
2018-10-05 08:54:56 -04:00
Michael Meffie
794748af87 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>
2018-10-03 23:30:29 -04:00
Michael Meffie
2c1a7e4733 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>
2018-10-03 23:30:13 -04:00
Andrew Deason
5ced6025b9 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>
2018-09-28 09:49:36 -04:00
Andrew Deason
00aa9200be 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>
2018-09-28 08:32:59 -04:00
Andrew Deason
68be8d7a18 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>
2018-09-28 08:31:23 -04:00
Andrew Deason
c1d39153da 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>
2018-09-28 08:30:07 -04:00
Andrew Deason
78ed034603 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>
2018-09-23 22:09:15 -04:00
Andrew Deason
38a094137f pthread.m4: Add missing 'test' to conditional
Commit c5def62d (autoconf: update pthread checks) accidentally omitted
a 'test' in one of the conditionals. This causes an ugly error message
during configure:

    checking for pthread_attr_init in -lpthread... yes
    ./configure[31043]: x-lpthread: not found [No such file or directory]

Replace the missing 'test'.

Change-Id: I28b82594e43a4ab42a5eb9fcc78e0ce8c5517d8b
Reviewed-on: https://gerrit.openafs.org/13342
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2018-09-23 21:15:00 -04:00
Mark Vitale
3fae4ea19a ubik: remove unused code
ubik_GetVersion and ubik_WaitVersion have been unused since at least
OpenAFS 1.0.  Remove them.

No functional change should be incurred by this commit.

Change-Id: Iee6952f35d8c34e9f05a4e6011f5795f7222fb08
Reviewed-on: https://gerrit.openafs.org/13325
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2018-09-23 20:57:31 -04:00
Andrew Deason
809ee49b80 Remove alpha_dux/alpha_osf references
Several files were still referencing the alpha_dux* and alpha_osf*
sysnames. The code for these platforms has been removed, so get rid of
this cruft.

Change-Id: I042fcc29be322bf557829974242553bb6d5b2be4
Reviewed-on: https://gerrit.openafs.org/13339
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2018-09-22 17:05:26 -04:00
Andrew Deason
42625220bb libafs: Remove .i Makefile rules
Makefile.common.in defines a suffix rule to generate .i files from .c
files, but we never actually need to do this. The rule originates from
before OpenAFS 1.0, which also did not use the rule. Remove the
unused definitions.

Change-Id: I057b2aca7d17e3e85e93d886a65c954e8d9d708f
Reviewed-on: https://gerrit.openafs.org/13338
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2018-09-22 17:03:02 -04:00
Mark Vitale
930d8ee638 volser: ensure GCTrans transaction walk remains valid
Commit bc56f5cc97a982ee29219e6f258b372dbfe1a020 ("volser: Delete
timed-out temporary volumes") introduced new logic to GCTrans().
Unfortunately, part of this logic temporarily drops VTRANS_LOCK in order
to call VPurgeVolume().  While this lock is dropped, other volser_trans
may be added or deleted from the allTrans list.  Therefore, GCTrans
should not trust the next pointer (nt = tt->next) which was obtained
before the lock was dropped.

One symptom observed in the field was a segfault while examining
tt->volume.  Neither tt nor volume were valid any longer, since tt had
been set from a stale nt at the top of the loop.

To repair, improve, and clarify this logic:
- Refactor so nt is assigned correctly and as late as possible.
- Add comments to explain the placement of the assigns to future
maintainers.

Change-Id: Ibd3a504bddd3622730aa349576341e20f2f27836
Reviewed-on: https://gerrit.openafs.org/13286
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2018-09-21 09:12:31 -04:00
Marcio Barbosa
89b50fdec9 volser: add more logs for failures during restore
In the current version of the volserver, some failures during volume
restores are not logged. In order to help debugging, this commit
introduces extra logs for possible failures during this process, so we
guarantee that an error at any point during the restore causes a
message to be logged.

Change-Id: I3647155aeb3f10316d9d7fecb5b126efc909f7b4
Reviewed-on: https://gerrit.openafs.org/13252
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2018-09-21 08:35:35 -04:00
Michael Meffie
7c27365ea2 afsmonitor: remove unused LWP_WaitProcess
Remove the unimplemented once-only flag and the unused LWP_WaitProcess
call.

Change-Id: Idec5815f6f20019b9be4b973794d8b05cea7f6c9
Reviewed-on: https://gerrit.openafs.org/12745
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2018-09-21 08:18:30 -04:00
Mark Vitale
95b0641ad8 volser: combine GCTrans conditional clauses
In preparation for a future commit, combine two conditional clauses in
GCTrans().

No functional change should be incurred by this commit.

Change-Id: Ib08d5b83dd26327124fe0119e6e5f459adc5f78a
Reviewed-on: https://gerrit.openafs.org/13303
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2018-09-21 08:12:02 -04:00
Michael Meffie
f62fb17b3c ubik: positional io for db reads and writes
The ubik library was written before positional i/o was available and
issues an lseek system call for each database file read and write.  This
change converts the ubik database accesses to use positional i/o on
platforms where pread and pwrite are available, in order to reduce
system call load.

The new inline uphys_pread and uphys_pwrite functions are supplied on
platforms which do not supply pread and pwrite. These functions fall
back to non-positional i/o. If these symbols are present in the database
server binary then the server process will continue to call lseek before
each read and write access of the database file.

This change does not affect the whole-file database synchronization done
by ubik during database recovery (via the DISK_SendFile and DISK_GetFile
RPCs), which still uses non-positional i/o. However, that code does not
share file descriptors with the phys.c code, so there is no possibility
of mixing positional and non-positional i/o on the same FDs.

Change-Id: I28accd24f7f27b5e8a4f1dd0e3e08bab033c16e0
Reviewed-on: https://gerrit.openafs.org/12272
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2018-09-21 08:08:22 -04:00