Import Gabriele Svelto's AC_GCC_FUNC_ATTRIBUTE autoconf macro to check for
GCC-style function attributes. This macro is part of the GNU Autoconf
Archive[1]. The imported file is distributed under an all-permissive license.
[1] https://www.gnu.org/software/autoconf-archive/
Reviewed-on: https://gerrit.openafs.org/12962
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit b818854f19e33315d1b6453b72a55b54d740e976)
Change-Id: I6305bf70715048da7da0d605d4ad4bf5551291c0
Reviewed-on: https://gerrit.openafs.org/14988
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Currently, if --with-bsd-kernel-build is not specified during
configure, we do not set KERNBUILDDIR during the libafs build at all.
This means that we do not use an opt_global.h during the build.
For the GENERIC kernel, in the past this has worked well enough to
produce a working kernel module, but with FreeBSD 12, the GENERIC
kernel turns on the VIMAGE option by default. If our kernel module is
built without VIMAGE defined, our kernel module cannot be loaded into
GENERIC, since VIMAGE changes the definitions of some symbols that we
use (for example, trying to load such a libafs fails with the message
"link_elf_obj: symbol in_ifaddrhead undefined").
To allow the build to work by default for GENERIC kernels, without
needing any additional configure flags, change the libafs Makefile to
use the headers for the GENERIC kernel if no kernel build dir is
given. To do this, we create a directory in our build tree and
generate the opt_*.h headers in there (using config(8)), and specify
that directory as the kernel build dir.
This approach only works for GENERIC kernels, of course, but that is
the most common scenario. Users that want to build for a custom kernel
configuration still need to specify the actual kernel build dir with
--with-bsd-kernel-build.
Reviewed-on: https://gerrit.openafs.org/14001
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a9c1939eeb36372872f3258a9ae7259a564332c3)
Change-Id: I456871c2b55cd3fc1eef7bf68011a725e253b902
Reviewed-on: https://gerrit.openafs.org/14921
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Currently, osi_VM_StoreAllSegments calls vget() for the given vnode,
which requires locking the vnode. However, the vnode should already be
locked. For example, when called from the close syscall, we reach this
function via: vn_close1 -> afs_vop_close -> afs_close ->
afs_StoreOnLastReference -> afs_StoreAllSegments ->
osi_VM_StoreAllSegments. This causes a panic like so:
kernel: panic: lockmgr_xlock_hard: recursing on non recursive lockmgr 0x[...] @ /usr/src/sys/kern/vfs_subr.c:2730
We can also reach this code path from the BOP_STORE background
operation (BStore -> afs_StoreOnLastReference -> afs_StoreAllSegments
-> osi_VM_StoreAllSegments), initiated from afs_close(), which has the
vnode locked. In this case, we won't be recursively locking the vnode,
since the process calling afs_close() is the one that holds the lock,
and the background thread is the process trying to lock the vnode
again. So we'll just deadlock.
From the comments in this function, it seems like locking the vnode at
all in here is unnecessary, since the vnode should be locked from the
higher-level functions anyway. So just skip the vget and all of the
related looping retry logic. As a result, this function can now become
somewhat simplified.
Reviewed-on: https://gerrit.openafs.org/14000
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit bdd4a0c78b1acaf1c947ca53d16159ef95cc9840)
Change-Id: I9f279cef6aef9beff6636edc0cd7cfa5f3d36cfa
Reviewed-on: https://gerrit.openafs.org/14920
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Created a new sysname "amd64_fbsd_123" in src/config/afs_sysnames.h
and added "param" files with minimal changes:
modified: src/config/afs_sysnames.h
new file: src/config/param.amd64_fbsd_123.h
new file: src/config/param.i386_fbsd_123.h
This mod builds on 12.3 with all tests passing.
Reviewed-on: https://gerrit.openafs.org/14860
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 7a6192276b3779205fa8bc8c141eda41cf28e37e)
Change-Id: Id66f9fe5663b33671ba1b9e68b8715a5eacd5da2
Reviewed-on: https://gerrit.openafs.org/14878
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
The SOURCE and BUILD environment variables have been changed to
C_TAP_SOURCE and C_TAP_BUILD in the new version of c-tap-harness. The
runtests command syntax has changed as well.
Convert all of the old SOURCE and BUILD environment variables to the new
C_TAP_SOURCE and C_TAP_BUILD names.
Add the required -l command line option to specify the test list.
Add the new runtests -v option to run the tests in verbose mode to make
it easier to see which tests failed.
Reviewed-on: https://gerrit.openafs.org/14295
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 624219a1b2192e5c7b6b45e2cbe784a9c5f33a96)
Change-Id: I3a1ed224a6271918711bdd520094df348d7f8cae
Reviewed-on: https://gerrit.openafs.org/14880
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit updates the code imported from c-tap-harness to
abdb66561ffd4d2f238fdb06f448ccf09d80c059 (release/4.7)
Upstream changes are:
Daniel Collins (1):
Add is_blob() test function.
Daniel Kahn Gillmor (1):
LICENSE: use https for all URLs
Daria Brashear (1):
Add verbose mode environment variable to runtests
Julien ÉLIE (2):
Document -v in usage and comments of runtests
Avoid realloc of zero length in tests/runtests.c
Marc Dionne (1):
Add test_cleanup_register_with_data
Russ Allbery (115):
clang --analyze cleanups for runtests
Modernize POD tests
Update README to my current layout
Explicitly note that test programs must be executable
Fix comment typo in tests/runtests.c
Switch to a copyright-format 1.0 LICENSE file
Flush harness output after each line
Show the test count as ? when the plan is deferred
More correctly backspace over test counts when aborting
Refactor test list handling
Allow passing tests on the runtests command line
Don't allow command-line arguments if a list was given
Search for tests under the name given as well
Release 2.0
Fix backward incompatibility when searching for tests
Document decision to ignore TAP version directives
Release 2.1
Document different runtests behavior in bail handling
Change exit status of bail to 255
Release 2.2
Add a new test_cleanup_register C API
Add warn_unused_result attributes
Add portability for warn_unsed_result attributes to tap/macros.h
Minor coding style fix (spacing) in runtests.c
Split the runtests usage string for ISO C90 string limits
Include stddef.h
Diagnose failure to register the exit handler
Use diag internally in the basic C TAP library
Some additional comments about cleanup functions
Move repetitive printing code in the C TAP library to a macro
Set a flag when bailing for more correct cleanup
Change my email address to eagle@eyrie.org
Release 2.3
Add diag_file_add and diag_file_remove functions
Don't die for unknown files passed to diag_file_remove
Release 2.4
Update comment about AIX and WCOREDUMP
Don't test for NULL before calling free
Be more careful about file descriptors in child processes
Run cleanup functions in non-primary processes as well
Release 3.0
Update collective package copyright notices at start of LICENSE
Check integer overflows on memory allocation, fix string creation
Switch POD spelling test to use Lancaster consensus variable
Add new bnrealloc API for brealloc with checked multiplication
Rename nrealloc to reallocarray
Return the test status from test functions
Fix the overflow check for breallocarray
Fix the overflow check for xreallocarray in runtests
Restructure test result reallocation in runtests
Change diag and sysdiag to always return true
Release 3.1
Fix typos in basic.c and basic.h
Fix usage message when running runtests with no arguments
Update introductory runtests comments for current syntax
Add the -l flag to suggested runtests invocation in README
Support comments and blank lines in test lists
Release 3.2
Update licensing information
Various improvements to verbose support
Compile warning-free with Clang, check Autoconf macros
Release 3.3
Remove unnecessary assert.h include in tap/basic.c
Fix some additional -v documentation issues
Rebalance usage to avoid too-long strings
Fix segfault in runtests with empty test list
Release 3.4
Document running autogen if starting from Git
Rename autogen to bootstrap
Support and prefer C_TAP_SOURCE and C_TAP_BUILD
Fix comment typo in tests/runtests.c
Add missing va_end to is_double
Release 4.0
Fix all non-https www.eyrie.org URLs
Add is_bool C test function
Add DocKnot metadata and a Markdown README file
Update documentation for new DocKnot standards
Release 4.1
Use more defaults from DocKnot templates
Fix new fall-through warning in GCC 7
Use compiler warnings from rra-c-util, fix issues
Merge pull request #4 from solemnwarning/master
Coding style fixes and NEWS for is_blob
Re-enable -Wunknown-pragmas for GCC
Avoid zero-length realloc allocations in breallocarray
Update copyright date on tests/runtests.c
Release 4.2
Add SPDX-License-Identifier headers to source files
Add and run new check-cppcheck target
Fix instructions for running one test
Identify values as left and right
Fix is_string comparisons with NULL pointers
Add support for running tests under valgrind
Replace putc with fprintf
Update shared files from rra-c-util
Release 4.3
Update NEWS date for 4.3 release
Collapse some copyright dates
NEWS and coding style for test_cleanup_register_with_data
Remove unused variables caught by Clang scan-build
Update to rra-c-util 8.0
Fix error checking in bstrndup
Release 4.4
Add support for C++
Document that C TAP Harness can be built as C++
Release 4.5
Regenerate README files
Reformat using clang-format 10
Update to rra-c-util 8.1
Release 4.6
Fix spelling errors caught by codespell
Protect the test suite against C_TAP_VERBOSE
Switch to GitHub Actions for CI
Add NEWS entry for GCC 10 warning fixes
Release 4.7
Reviewed-on: https://gerrit.openafs.org/14294
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 3f377aa117273eba5c77ad652c0b086446b3f874)
Change-Id: I7b72d9ebd34d3bb5a05268339e136bb1b4309b92
Reviewed-on: https://gerrit.openafs.org/14879
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Currently, we 'cd test' and then just run 'make', which makes the
first target specified in the Makefile. On some platforms (FreeBSD),
this results in 'make' trying to build '%.c', which of course we
cannot do, since that's a pattern rule, and so 'make' fails.
To fix this, just 'make all' explicitly, to make the intended targets
in src/dir/test.
Reviewed-on: https://gerrit.openafs.org/14550
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit c0b7367253eb6c346d577e099a0b0172d4d24ff3)
Change-Id: I3c1cc73d88471a31ce2d95325c8dafe797d1c43d
Reviewed-on: https://gerrit.openafs.org/14911
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Commit 7fe4125fe3435092b75ed29b884d8d3c2d1a2cad 'dir/vol: Die() really
does' overlooked src/dir/test/dtest.c, breaking its build.
Fix the signature of Die() and the makefile so dtest can be built.
In addition, change the Makefile so it is always built.
Reviewed-on: https://gerrit.openafs.org/13794
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 192a2ff49af5dbbb4f8175eec7cb63bfe97e444e)
Change-Id: I92df1068c0c071ac643bd8c43eb7e63efdf4f09b
Reviewed-on: https://gerrit.openafs.org/14910
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
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.
Reviewed-on: https://gerrit.openafs.org/13419
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 0bd55a02bb5707b1b8b26347d5cb6ad71765f622)
Change-Id: I4bc8c09720a19658afbab733ea74332083bb29f4
Reviewed-on: https://gerrit.openafs.org/14909
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
When using our multi_Rx mechanism, callers can use either multi_End or
multi_End_Ignore at the end of the multi_Rx block. Among other things,
these macros run 'rx_EndCall(call, code)' for each call in the
multi_Rx invocation that hasn't already ended. For multi_End, 'code'
is RX_USER_ABORT, and for multi_End_Ignore, 'code' is 0; the macros
are otherwise equivalent.
When multi_End is used, this means any un-ended calls are aborted with
RX_USER_ABORT, and the call immediately ends. But when
multi_End_Ignore is used, the call is not aborted, and so we must wait
for the peer to acknowledge that it has received our packets before
ending (done via an rxi_ReadProc call in rx_EndCall).
This means that if a caller multi_Abort's out of a multi call and uses
multi_End_Ignore, we'll wait for the peer to acknowledge our packets
for all of the calls we haven't processed. Waiting for that is a
complete waste of time, since we don't care about the results of those
calls (since we multi_Abort'd). This doesn't matter much if those
calls are responded to promptly, but if the peer is not up or is just
slow, it can cause us to wait several seconds until we timeout.
There are currently only three users of multi_End_Ignore:
- DoProbe in src/ubik/recovery.c
- MultiBreakCallBackAlternateAddress_r in src/viced/callback.c
- MultiProbeAlternateAddress_r in src/viced/callback.c
All of these use multi_Rx to try and probe multiple IPs for the same
machine in parallel, and so some of the calls may very well be trying
to contact unreachable IPs; we only need one to work for the call to
succeed.
To avoid the unnecessary delays in these codepaths, convert them to
use multi_End. Change multi_End_Ignore to be the same as multi_End,
and multi_Finalize_Ignore to the same as multi_Finalize, to make sure
the bad behavior is not used. The _Ignore macros/functions are now
unused in the tree, but keep them around for now since
multi_Finalize_Ignore is exported by libafsrpc.
Thanks to mbarbosa@sinenomine.net for discovering this weird behavior.
Reviewed-on: https://gerrit.openafs.org/14595
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 002b031d01e3c0f2ad3e1069b98800c3a7228bd5)
Change-Id: Ic49c0810bdc9643600a5c060bef4a669798afaf3
Reviewed-on: https://gerrit.openafs.org/14815
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Currently, many routines in 'fs' cause afsconf_GetCellInfo to be
called for the given cell, which causes an AFSDB/SRV lookup for the
given cell if the cell has no dbservers specified in the local
CellServDB. Sites often define such CellServDB records to indicate
that the given cell exists, but the dbserver IPs should only be looked
up via DNS.
However, 'fs' is only calling afsconf_GetCellInfo in order to
canonicalize the cell name (we're allowed to give an abbreviated name
for a cell on the command line if the abbreviation is unambiguous, but
we want to give the full name to the kernel). We don't care about the
other cell info at all, so triggering a DNS lookup is completely
unnecessary.
If our DNS server is not responding, e.g. because we've lost network
access entirely, this causes the relevant 'fs' commands to fail,
possibly after a long delay. Some fs commands such as 'fs setcell' are
often run during client startup, and can still otherwise run fine
without network access, and so such failures are unnecessary.
To fix this, we introduce a new function, called afsconf_GetCellName,
which only returns the full name for a cell, and does not require a
DNS lookup for such "empty" cells in the local CellServDB. For all
code paths in 'fs' that just need the cell name (which is all of them
besides 'fs mkmount'), use this new function.
Reviewed-on: https://gerrit.openafs.org/13540
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 4a150387e3151ecdfca8b4f7c732a1e876968279)
Change-Id: Ia81eb1e067fe399949d3ea8ae1957e87f6698753
Reviewed-on: https://gerrit.openafs.org/14814
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Currently, any code that wants to perform a cold shutdown must first set
global afs_cold_shutdown = 1, then call afs_shutdown(void).
Instead, modify afs_shutdown() to accept a single parm which specifies
AFS_WARM or AFS_COLD shutdown, and to set the value of global
afs_cold_shutdown based on this parm. Remove all other assignments for
afs_cold_shutdown. Modify all callers of afs_shutdown() to specify
AFS_WARM or AFS_COLD as needed to maintain equivalent function.
This should make it much easier to tell at a glance what type of
shutdown is being requested by each caller to afs_shutdown().
No functional change should be incurred by this commit.
Reviewed-on: https://gerrit.openafs.org/12182
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a2e03e74c4959f72c90288ec85a40c037c9c6243)
Change-Id: I9271c1161f419ea02b9fe43ec46219dce19c9d50
Reviewed-on: https://gerrit.openafs.org/14813
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
The server processes will happily start without keys and then fail all
authenticated access, including database synchronization and local
commands with -localauth. At least issue warnings to let admins know
the keys are missing and that akeyconvert or asetkey needs to be run.
The situation is not helped by fact the filenames of the key files have
changed between versions. In 1.6.x the (non-DES) keys were in the
rxkad.keytab file and in later versions they are in the KeyFile* files,
so if you are used to 1.6.x it is not obvious what is wrong.
Reviewed-on: https://gerrit.openafs.org/13911
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 042f809ccfe12bafed73aa4eb4db2c86737e0b22)
Change-Id: I280d3c83b4576684f2035f79d94966bc5a174681
Reviewed-on: https://gerrit.openafs.org/14594
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Autoconf 2.70 (released in 2020-12) produces warning messages about
obsolete constructs by default.
Running regen.sh with autoconf 2.70 installed produces the following
warnings:
..
configure.ac:7: warning: The macro `AC_CONFIG_HEADER' is obsolete.
configure.ac:21: warning: AC_PROG_LEX without either yywrap or noyywrap
is obsolete
configure.ac:21: warning: The macro `AC_HEADER_STDC' is obsolete.
configure.ac:21: warning: The macro `AC_HEADER_TIME' is obsolete.
..
Replace AC_CONFIG_HEADER with AC_CONFIG_HEADERS
Add the noyywrap parameter to AC_PROG_LEX. Use the noyywrap option
since we already provide a yywrap function in the .l sources.
Remove AC_HEADER_STDC. There are no references to the the autoconf
variable set by this macro. This macro was marked as obsolete prior to
autoconf 2.64 with the following note:
"This macro is obsolescent, as current systems have conforming header
files. New programs need not use this macro."
AC_HEADER_TIME was marked as obsolete prior to autoconf 2.64 with the
following note:
"This macro is obsolescent, as current systems can include both files
when they exist. New programs need not use this macro."
The only reference that requires AC_HEADER_TIME is within the external
roken code pulled from heimdal. Compiles that use the external upstream
heimdal packages result in a build error if TIME_WITH_SYS_TIME is not
defined:
building src/crypto/hcrypto
src/external/heimdal/hcrypto/camellia.c
include/roken.h:803:58: error: ‘struct tm’ declared inside
Update autoheader.m4 so a define for TIME_WITH_SYS_TIME is created. This
avoids modifying the external heimdal/roken code.
Reviewed-on: https://gerrit.openafs.org/14838
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 2a659ba160fbdc87a5fb4f330ffda82c1534929d)
[cwills@sinenomine.net resolved conflict with MACOS_VERSION numbers]
Change-Id: I1f5ed4ac66bd5bc35ef79e784e784ae2847321a2
Reviewed-on: https://gerrit.openafs.org/14965
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Clean up the indentation of preprocessor statements, add #endif comments
where helpful.
Clean up whitespace in code indentation.
Reviewed-on: https://gerrit.openafs.org/14470
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 873a5d9e8835b969370f1f031acef60745a0fff8)
Change-Id: Ia3c41652e99c44164dec852b0f8ab2f103e8e3c1
Reviewed-on: https://gerrit.openafs.org/14930
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Clean up the indentation of preprocessor statements, add #endif comments
where helpful.
Clean up whitespace in code indentation.
Reviewed-on: https://gerrit.openafs.org/14469
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit d7469128ceefbd96b61f32f62fd1e11c3674dac8)
Change-Id: Iccf5587e02b3caf0ec6725dc554255366b879d9e
Reviewed-on: https://gerrit.openafs.org/14929
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
These typedefs have been present since commit
a41175cfbbf4d06ccfe14ae54bef8b7464ecd80b
"initial-darwin-support-20010327"; at least some of this material was
obtained directly from IBM after the initial code import.
Based on research of old Darwin source code and kernel documentation,
the Event Trace Analysis Package (ETAP) was a lock-profiling interface
provided in older versions of Mach and xnu. ETAP was not enabled by
default; the kernel had to be recompiled with certain options to enable
it. Support for ETAP was removed from the xnu tree sometime between
xnu-517 (10.3 Panther) and xnu-792 (10.4 Tiger), although some
references remain in the latter under PPC support (osfmk/ppc/hw_lock.s).
All remaining references to etap_event_t disappeared when PPC support
was removed, some time between xnu-1456.1.26 (10.6 Snow Leopard) and
xnu-1699.24.8 (10.7.2 Lion).
Therefore, it is possible that these typedefs were needed in the past by
(IBM/Transarc) AFS to support use of some lock APIs (e.g.,
simple_lock_init, usimple_lock_init) after the ETAP code was withdrawn
from xnu. However, these typedefs have probably always been vestigial
for OpenAFS, because OpenAFS has never used any lock API that took
etap_event_t as an argument.
Regardless, OpenAFS does not need these definitions to build and run on
any currently supported version of macOS.
Remove the vestigial code.
No functional change should be incurred by this commit.
Reviewed-on: https://gerrit.openafs.org/14219
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 145c90bdbeeff4ea95acacd7dc110f0c6fcba281)
Change-Id: I96cdfe756cb8917079a7cc46d6186e69337caf0d
Reviewed-on: https://gerrit.openafs.org/14928
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Currently, code inside afs_vcache.c assumes that osi_NewVnode always
returns non-NULL, which means that osi_NewVnode must panic if it
cannot create a new vnode.
All of the callers of afs_GetVCache, afs_NewVCache, etc, already
handle getting a NULL return, though (after all, the given fid may not
exist or be inaccessible due to network errors, etc). So, just
propagate NULL returns from osi_NewVnode up to our callers, to avoid
panics in these situations.
Modify osi_NewVnode on many arches to return an error on allocation
failure, instead of panic'ing.
Reviewed-on: https://gerrit.openafs.org/13701
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Yadavendra Yadav <yadayada@in.ibm.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit ea9e5e8519dc486cfb019447ee5d695de104079d)
Change-Id: I2a3c5aac44a57093caee4008b86420ed05c66eb7
Reviewed-on: https://gerrit.openafs.org/14927
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
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.
Reviewed-on: https://gerrit.openafs.org/13390
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit d0dbd0f12119f0e874ba30adec81061ac6ae27c7)
Change-Id: I214ec09c07fb35a4d1dbf9719ec3861bde931638
Reviewed-on: https://gerrit.openafs.org/14926
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Update configure version strings for 1.8.8.1. Note that macos kext
can be of form XXXX.YY[.ZZ[(d|a|b|fc)NNN]] where d dev, a alpha,
b beta, f final candidate so we have no way to represent 1.8.8.1.
Switch to 1.8.9 dev 1 for macOS.
Change-Id: I329a48142a6baaedd190d07a1215ba93b0ecce42
Reviewed-on: https://gerrit.openafs.org/14828
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Release notes for the 1.8.8.1 point release
Change-Id: I5c1912439464f64a298739f9ba3e55397e86d29a
Reviewed-on: https://gerrit.openafs.org/14852
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Global use of the compiler option '-isystem' was removed from the top
level Makefile with Linux commit ('isystem: delete global -isystem
compile option' 04e85bbf7). This results with an error due to not
finding "stdarg.h" when building the openafs kernel module.
.../src/rx/rx_kcommon.h:143:12: fatal error: stdarg.h: No such file or
directory
143 | # include "stdarg.h"
| ^~~~~~~~~~
Linux-5.15, introduced a copy of stdarg.h as 'linux/stdarg.h' in commit
('isystem: ship and use stdarg.h' c0891ac15)
Add a test for the linux/stdarg.h include file and if available, use
"linux/stdarg.h" instead of "stdarg.h" within the Linux kernel module.
Reviewed-on: https://gerrit.openafs.org/14844
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 3daa6e97330d23ae46c4389e4041c61c1a1d76d9)
Change-Id: I6347d09b3ffc73e3524c83830e2f2bbd2958121f
Reviewed-on: https://gerrit.openafs.org/14851
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
With Linux 5.15-prerc1 printk is defined as a macro instead of a
function ("printk: Userspace format indexing support" 33701557)
This change is causing a build failure:
.../src/rx/rx_kernel.h:62:18: error: ‘printk’ undeclared (first use in
this function); did you mean ‘_printk’?
62 | # define osi_Msg printk)(
| ^~~~~~
The definition and use of the osi_Msg and osi_VMsg macros are
unconventional and the C preprocessor is not handling the macro
expansion when printk is itself a macro.
#define osi_Msg printk)(
...
(osi_Msg "%s", x);
Change osi_Msg to a function, and simply replace osi_VMsg with vprintf
since osi_VMsg is only used at one location within user space code.
osi_Msg is implemented in 2 locations, in rx_kcommon for kernel space
and in rx_user for userspace.
Note: The unconventional definitions of osi_Msg/osi_VMsg was historical
and due to older compilers not supporting variadic macros. All of
the currently support platforms should now support variadic functions.
Reviewed-on: https://gerrit.openafs.org/14791
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 22876c8b88f8e5e92f08b230e5e1959499f0c406)
Change-Id: I48a67b2fe79b45403414bb7d962c29c9be07262e
Reviewed-on: https://gerrit.openafs.org/14831
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Add the canonical install path for Studio 12.6 to the autoconfig test.
Reviewed-on: https://gerrit.openafs.org/13867
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit fe6798d0d9e4df006ef96612b5c6e07fcc757b7e)
Change-Id: Iad5a43eb22c8a76af6ce7e73d77de913d3c2d8e0
Reviewed-on: https://gerrit.openafs.org/14841
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Linux 5.14 commit: 'mm: require ->set_page_dirty to be explicitly wired
up' (0af573780b0b13) removed calling __set_page_dirty_buffers when the
address_space_operations structure member set_page_dirty was NULL.
A kernel RIP error can occur when the set_page_dirty operation is
requested. (Reproducible by running 'iozone -B -a')
Update the definition for afs_file_aops to explicitly set the
'set_page_dirty' member to '__set_page_dirty_buffers'.
There are no functional changes, since this commit is using the same
function that the Linux kernel was using if set_page_dirty had been
NULL.
Problem originally reported by "Andrej Filipcic"
<andrej.filipcic@ijs.si> in the openafs-info mailing list. The Linux
5.14 commit causing the openafs failure was identified by "Michael Laß"
<lass@mail.upb.de> also on in the openafs-info mailing list.
Note: The declaration for the function '__set_page_dirty_buffers' was
moved from linux/mm.h into linux/buffer_head.h in Linux 2.6.19. Since
this is close to the minimum supported Linux version 2.6.18, we are not
introducing an additional autoconf test to determine which header file
the declaration for __set_page_dirty_buffers resides in.
Reviewed-on: https://gerrit.openafs.org/14826
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Tested-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Ralf Brunckhorst <rbrunckhorst@sinenomine.net>
Tested-by: Ralf Brunckhorst <rbrunckhorst@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit ba485a13e965909b63b25103fdf810de381e4977)
Change-Id: Iae61573e5ccf9458646eba4403322536fd86f2bf
Reviewed-on: https://gerrit.openafs.org/14830
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Our LWP version of rxi_Sendmsg can allocate an fd_set, but we don't
free the fd_set if sendmsg() returns certain errors afterwards.
To make sure we go through the same cleanup code for the different
possible error code paths, reorganize the function to go through a
'goto error'-style destructor. This also makes our return codes a bit
more consistent; we should always return -errno now for errors.
Reviewed-on: https://gerrit.openafs.org/14422
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 7239565b0fea8504deebc5bd43c4fa1ea80fcb17)
Change-Id: I7291ea5f339f26c5c1a64b65893e2cb33ebfe623
Reviewed-on: https://gerrit.openafs.org/14825
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Commit 20dc2832268eb (correctly) introduced changes so that we
avoid interacting with vnodes marked as VI_DOOMED to the extent
possible, but in doing so inadvertendly used the vrefl() KPI that
was only introduced in FreeBSD 11.0.
Rewrite the relevant logic to use the older vref() KPI, at the cost
of a few more unlock/locks, in order to have a single codepath that
works on all supported FreeBSD versions.
Reviewed-on: https://gerrit.openafs.org/14373
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 81ea654494f5c90f67eb54adbb722a95e0d11d82)
Change-Id: Ia48380bb7498fcf5d0b6b68fe153d4459612a3b6
Reviewed-on: https://gerrit.openafs.org/14795
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Currently on FreeBSD, osi_TryEvictVCache calls vgone() for our vnode
after checking if the given vcache is in use. vgone() then calls our
VOP_RECLAIM operation, which calls afs_vop_reclaim, which calls
afs_FlushVCache to finally actually flush the vcache.
The current approach has at least the following major issues:
- In afs_vop_reclaim, we return success even if afs_FlushVCache()
fails. This allows FreeBSD to reuse the vnode for another file, but
the vnode is still being referenced by our vcache, which is
referenced by the global VLRU and various other structures. This
causes all kinds of weird errors, since we try to use the underlying
vnode for different files.
- After the relevant checks in osi_TryEvictVCache are done, another
thread can acquire a new reference to our vcache (this can happen
while vgone() is running up until the vnode is locked). This new
reference will cause afs_FlushVCache to fail.
- Our afs_vop_reclaim callback is called while the vnode is locked,
and can acquire afs_xvcache. Other code locks the vnode while
afs_xvcache is already held (such as afs_PutVCache -> vrele). This
can lead to deadlocks if two threads try to run these codepaths for
the same vnode at the same time.
- afs_vop_reclaim optionally acquires afs_xvcache based on the return
value of CheckLock(&afs_xvcache). However, CheckLock just returns if
that lock is locked by anyone, not if the current thread holds the
lock. This can result in the rest of the function running without
afs_xvcache actually being held if we drop AFS_GLOCK at any point.
- osi_TryEvictVCache() tries to vn_lock() the target vnode, but we may
already have another vnode locked in the current thread. If the
vnode we're trying to evict is a descendant of a vnode we already
have locked, this can deadlock.
To fix these issues, make some changes to how our vcache management
works on FreeBSD:
- Do not allow anyone to hold a new reference on a VI_DOOMED vnode.
We do this by checking for VI_DOOMED in osi_vnhold, and returning an
error if VI_DOOMED is set.
- In afs_vop_reclaim, panic if afs_FlushVCache fails. With the new
VI_DOOMED check, afs_FlushVCache show now never fail; and if it
somehow does, panic'ing immediately is better than corrupting
various structures and panic'ing later on.
- Move around some of the relevant locking in afs_vop_reclaim to fix
the lock-related issues.
- In osi_TryEvictVCache, don't wait for the vnode lock (LK_NOWAIT);
treat the vnode as "in use" if we can't immediately obtain the lock.
Thanks to tcreech@tcreech.com and kaduk@mit.edu for insight and help
investigating the relevant issues.
FIXES 135041
Reviewed-on: https://gerrit.openafs.org/13972
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 20dc2832268eb81d40e798da0d424c98cf26062c)
Change-Id: I91e464ce2fa90d7baf593c0b813f52f1fc45b481
Reviewed-on: https://gerrit.openafs.org/14794
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Make a few changes to osi_vnhold and AFS_FAST_HOLD:
- Currently, the second argument of osi_vnhold ("retry") is never used
by any implementation. Get rid of it.
- AFS_FAST_HOLD() is the same as osi_vnhold(). Get rid of
AFS_FAST_HOLD, and just have all callers use osi_vnhold instead.
- Allow osi_vnhold to return an error, and adjust callers to handle
it.
- Change osi_vnhold to be a real function, instead of a macro, to make
nontrivial implementations less cumbersome.
Most platforms never return an error from osi_vnhold(), so the added
code paths to check the return value of osi_vnhold() will not trigger.
However, this lets us add future commits that do make osi_vnhold()
return an error.
Reviewed-on: https://gerrit.openafs.org/13971
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 13e44b2b200cd99d0df4e03cf6413d3a6915783f)
Change-Id: Ia3e1c4e45a870cd095f90adc66880eb524a10c1f
Reviewed-on: https://gerrit.openafs.org/14793
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Currently we call vinvalbuf(9) in a few places while holding
AFS_GLOCK, but AFS_GLOCK is a non-sleepable lock (struct mtx), and
vinvalbuf can sleep. This can trigger a panic in some rare conditions,
with the message:
Sleeping thread (tid 100179, pid 95481) owns a non-sleepable lock
To avoid this, drop AFS_GLOCK around a few places that call
vinvalbuf().
Reviewed-on: https://gerrit.openafs.org/13970
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 61993cf45a648906abb865756d5a98d9c2d7cc40)
Change-Id: I1b4d6d7d9d4cd54091cfd8e168a928c08cb643e5
Reviewed-on: https://gerrit.openafs.org/14792
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
FreeBSD 12 changed how network interfaces and network addresses are
linked together; we're supposed to use CK_STAILQ_FOREACH to traverse
them now, instead of TAILQ_FOREACH. To try to keep this change
simpler, introduce a new macro, AFS_FBSD_NET_FOREACH, which picks the
right macro to use.
Based on a commit by tcreech@tcreech.com.
Reviewed-on: https://gerrit.openafs.org/13999
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 7c89322c45605c90c8ce27a77695a1c291f0def4)
Change-Id: I1530213a447ecf09dde47987fdd7b3df489dc490
Reviewed-on: https://gerrit.openafs.org/14781
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
When traversing the list of network interfaces, or the list of
addresses for a network interface, we're supposed to lock the relevant
resource with IFNET_RLOCK, if_addr_rlock, or IN_IFADDR_RLOCK. Add
these locks around our code that examines network interfaces, to
avoid issues if the interface or address list changes while we're
traversing them.
While we're doing this, move around some "AFS_DARWIN_ENV ||
AFS_FBSD_ENV" ifdefs, since these were getting a bit hard to read.
This commit adds some duplicated code, but the result should be easier
to follow.
Also for FreeBSD 12, we must be in NET_EPOCH_ENTER when calling
ifa_ifwithnet/rx_ifaddr_withnet (it panics if we don't, with
INVARIANTS). Add the needed NET_EPOCH_ENTER/EXIT calls, but do so a
bit higher up the call stack, since the returned structures are
potentially no longer valid after we NET_EPOCH_EXIT. Since this means
we're calling these in a few places in libafs, create a couple of rx
abstractions (RX_NET_EPOCH_ENTER) to handle the relevant ifdefs.
[adeason@dson.org: Various adjustments to locking calls; splitting up
DARWIN/FBSD ifdefs.]
Reviewed-on: https://gerrit.openafs.org/13998
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 9e98d61ff41709cee8d484be1ecd638a18e2ce0f)
Change-Id: I240d03d892107179f07acf5d76aa49371ef0bec4
Reviewed-on: https://gerrit.openafs.org/14780
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Everything in devname.c is for the inode vol backend, so skip building
it when AFS_NAMEI_ENV is defined.
While we're doing this, alter the #ifdefs inside this file to assume
that we're not on XBSD, DARWIN, or LINUX, since those platforms are
all namei-only.
Reviewed-on: https://gerrit.openafs.org/13995
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 80afdc2adabb098394e1b2178ba301964868befe)
Change-Id: I54a7cc4f845283ff15f7b91d5d3523a1df42c3af
Reviewed-on: https://gerrit.openafs.org/14788
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
In FreeBSD 12 (see: https://reviews.freebsd.org/rS318736), the layout
of struct dirent changed to allow for 64-bit inodes and a few other
changes. Update our struct min_direct to accommodate, to allow our
readdir() results to be accurate. Without this, readdir() can yield
garbage entries, due to the mismatch in the structure definitions.
Reviewed-on: https://gerrit.openafs.org/13854
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 14cbd02b8a1a4f1d3c30dd4fb2864d35f39a95eb)
Change-Id: I5218fdf315aac71a7cdf488879b88d476f97f2d3
Reviewed-on: https://gerrit.openafs.org/14786
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
r317061 changed where v_vnodein &c are stored. Use the new
VM_CNT_INC/VM_CNT_ADD macros when available to accommodate.
Reviewed-on: https://gerrit.openafs.org/13859
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit e50e5ede55497b0c02647d21905f4134919fbf05)
Change-Id: I099fbfc91640c411ac582141a926e0eae7ce80d9
Reviewed-on: https://gerrit.openafs.org/14785
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
LINK_MAX was removed in r327598. When we don't have a LINK_MAX, just
use its value from before it was removed (32767).
Reviewed-on: https://gerrit.openafs.org/13860
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 0066f4e9f27fedc4cf4df52eaf10d35ae5c7ad6e)
Change-Id: I9e91c4d892bc6b276065d34bc7220a240d6b6fcd
Reviewed-on: https://gerrit.openafs.org/14784
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
syscall_register/syscall_deregister were effectively removed in
r329647. Use syscall_helper_register/syscall_helper_unregister
instead, which have existed since r205321 in FreeBSD 9.
Reviewed-on: https://gerrit.openafs.org/13858
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 2add334454019b4a8fd979fb16da686cf93b56c6)
Change-Id: I68037c7fc8e5a1b399bd49ff7bcccacdfd1a7643
Reviewed-on: https://gerrit.openafs.org/14783
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
According to <https://www.freebsd.org/security/unsupported.html>,
FreeBSD 8.x EoL was on August 1, 2015, and FreeBSD 9.x EoL was on
December 31, 2016. Remove our support for these versions, since they
haven't been supported by FreeBSD itself for a while.
FreeBSD 10.x EoL was on October 31, 2018, which has passed, but was
less than a year ago. So keep 10.x in for now.
Adjust our preprocessor checks accordingly:
- In FBSD-specific dirs, assume AFS_FBSD100_ENV and lower is always
true. Assume __FreeBSD_version is always at least 1000000.
- In non-FBSD dirs, convert AFS_FBSD100_ENV and lower to AFS_FBSD_ENV.
Reviewed-on: https://gerrit.openafs.org/13842
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a4e9365fff2b0e3daf7e9cf2b40e6027b7dd3a15)
Change-Id: If92991dead88bf8d18b837ef4661731c7fc2edbb
Reviewed-on: https://gerrit.openafs.org/14782
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
FreeBSD 12 (r328417) removed the deprecated compatibility macros
MALLOC and FREE. Convert our users to just use the normal malloc and
free, so we can build.
FreeBSD 12 (r334545) also changed malloc() into a macro, which breaks
our own malloc macro in our hcrypto config.h. To fix this, just undef
malloc, if it's already a macro.
Reviewed-on: https://gerrit.openafs.org/13856
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 3bc541743b09f408364a946139c524d53056d40a)
Change-Id: I3d2f98dd635480a2eea4e0cdad9c9bb308475695
Reviewed-on: https://gerrit.openafs.org/14773
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
The rx_ackPacket.acks array (the SACK table) consists of up to 255
octets. Each octet stores either the value zero (RX_ACK_TYPE_NACK)
or one (RX_ACK_TYPE_ACK). Effectively only bit-zero of each octet
is used.
The rx_ackPacket.acks array cannot be enlarged but one possible
method of encoding the ACK/NACK state for packets when the
window size is greater than 255 is to use bits 1-7 of each
octet.
This change alters the test for ACK vs NACK to be a bit comparison
instead of a equality comparison. This change permits RX to be
compatible with any future use of bits 1-7.
No peer that treats the SACK table as bytes can ever send more
than 255 packets regardless of the advertised receive window.
Therefore, existing peers will never receive a SACK table with
more than 255 packets worth of bits.
Reviewed-on: https://gerrit.openafs.org/14465
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 7739d1e967177686e91a6ea86c73b404515a1c0d)
Change-Id: I59c098414f309bac283017823dff6d491d895db8
Reviewed-on: https://gerrit.openafs.org/14740
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Update version strings for the 1.8.8 release
Change-Id: I8dc5b309ab17890410825caa329e536f14430d6b
Reviewed-on: https://gerrit.openafs.org/14642
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Finalize the release notes for the 1.8.8 release.
Change-Id: I01b4527f708fbc8a733b3aa7754274c94683cb92
Reviewed-on: https://gerrit.openafs.org/14641
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Update version strings for the second 1.8.8 prerelease.
Change-Id: Ie920e12fde0bc5043273d6dfceceaa1a4705ea3a
Reviewed-on: https://gerrit.openafs.org/14699
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
The autoconf function OPENAFS_HAVE_STRUCT_FIELD can produce a compiler
warning for an implicit function definition for memset, however with
macOS 11 (Big Sur) the default compiler flags have been changed
(-Werror=implicit-function-declaration) so that this is now flagged as an
error. As an error this can lead to an incorrect result returned by
OPENAFS_HAVE_STRUCT_FIELD.
Add an include for <string.h> to provide the necessary definition for
memset.
Note, both gcc and clang can produce the implicit function definition
warning.
Reviewed-on: https://gerrit.openafs.org/14631
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit fd5aa52ef8ce719502f970ab93ffde07d7ed4780)
Change-Id: I6829f13ee2fb1698738e95b379928cfea383e348
Reviewed-on: https://gerrit.openafs.org/14668
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Ever since it was introduced in commit 5ec5ad5 (New GetToken pioctl),
extractPioctlToken has incorrectly freed pioctlToken by passing
'&pioctlToken' to xdr_free (instead of 'pioctlToken').
This causes xdr_ktc_tokenUnion to interpret &pioctlToken (which is a
struct ktc_tokenUnion **) as a struct ktc_tokenUnion *. This doesn't
cause any corruption or panics, since ktc_tokenUnion doesn't contain
any freeable fields unless its at_type is 2 (AFSTOKEN_UNION_KAD). So
as long as the bogus 'at_type' from the misinterpreted pointer is not 2,
the xdr_free call will just not free anything (and return an error,
which we ignore).
If the bogus at_type is 2, this would probably cause some memory
corruption or other nastiness. For this to happen on 32-bit systems,
the value of the 'pioctlToken' pointer itself would need to be 0x2.
On 64-bit systems, the top or bottom 32-bits of the pointer would need
to be 0x2 (depending on endianness). Those situations seem impossible
or very unlikely on most systems, and have never been seen in the
wild.
FIXES 135238
Reviewed-on: https://gerrit.openafs.org/14651
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
(cherry picked from commit 966d5eb58f1f4fb333f263f018429c3a782be344)
Change-Id: Ied9b6c42106fa2c4353cccd08e1a6b50190a8504
Reviewed-on: https://gerrit.openafs.org/14667
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
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: Stephan Wiesand <stephan.wiesand@desy.de>