Commit Graph

13854 Commits

Author SHA1 Message Date
Mark Vitale
ac9d766b47 tests: Ensure temp file cleanup on Solaris
Commit 71acc392a3 'tests: Generalize temp dir management' introduced
afstest_mkdtemp and afstest_rmdtemp.  In afstest_rmdtemp, we invoke rm
with option --one-file-system for Linux and Solaris only.

However, this rm option is new for Solaris 11.4; older Solaris versions
of rm do not support --one-file-system.  This causes afstest_rmdtemp to
always silently fail on Solaris 11.3 or older, due to the invalid rm
option.

Correct the #ifdef so ihe --one-file-system option is specified only for
Linux.  An autoconfig test could be added in a future commit.

Change-Id: Idfe8a018698b128463aaa9679dfef4e55deef805
Reviewed-on: https://gerrit.openafs.org/15723
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-06-24 15:10:23 -04:00
Mark Vitale
f3fb37d608 vos: Remove client connection rx_ServiceOf() calls
Since the original IBM import, the 'vos dump' command has logic to
adjust the rx dead time for the rx_service of our client conns.  But
client conns by definition do not have an rx_service associated with
them, only a service id.  Therefore this code has "always" been
harmlessly superfluous (at least, "it was like that when we got it").

Later, with commit 1f3990e5ea vos-getsize-20030619, this logic was
cargo-culted into the then-new 'vos size' command as well.

Remove both instances of trying to update a non-existent service.

No functional change should be incurred by this commit.

(This was discovered during an audit of rx_service timeouts and
rx_ServiceOf usage.)

[mmeffie: update commit message]

Change-Id: Icffd5860be3c38c78cc16d7606d760364c5fa3b4
Reviewed-on: https://gerrit.openafs.org/15726
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-06-24 15:09:46 -04:00
Cheyenne Wills
3412e3b67e stds.h: Fix comment/indentation for static_inline
The comment proceeding the block of defines for the static_inline
is incorrect.  In addition the indentation is missing for the
preprocessor statements within this block.

The commits:
    "printf-sanity-20090317" (3553442536)
    "printf-sanity-20090318" (be4d4076f2)
introduced the functions afs_cast_int32() and afs_cast_uint32() and the
associated comment for these functions.

Later the commits:
    "static-inline-macros-20090319" (101399171b)
    "Rename printf cast helpers and clean up format string warnings"
    (ac3e0ed031)
moved afs_cast_int32() and afs_cast_uint32() and later renamed them, but
failed to relocate the associated comment.

Relocate the existing comment for the casting functions and add
an appropriate comment for the "static_inline" macro.

Fix the preprocessor indentation for this block.

There are no functional changes with this commit

Change-Id: Ie49f2dd4a8f18c7855e400f32aa39f49e1a15fb1
Reviewed-on: https://gerrit.openafs.org/15767
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-06-24 09:26:02 -04:00
Mark Vitale
a25912df8d macos: AFSBackgrounder: report details of failed command
AFSBackgrounder function executeTask will execute a shell command
specified by its caller.  If the command fails for any reason, the
following error message is logged:

  "Task failed."

I think we can do better.  Add the name of the command, the arguments,
and the status (code) to the log message:

  "Task failed: <command> <args> status:<status>."

Change-Id: I41db8d1cd82c8e46ad447bc46fd3cd641e6294fb
Reviewed-on: https://gerrit.openafs.org/14588
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
2024-06-21 17:33:16 -04:00
Cheyenne Wills
7097eec17b Linux 6.10: Move 'inline' before func return type
With Linux 6.10 commit:
    "kbuild: turn on -Wextra by default" (f5982cceb3)
there are additional compiler warnings that can turn
into build errors when --enable-checking is used.

    "error: ‘inline’ is not at beginning of declaration
    [-Werror=old-style-declaration]"

The error is due to the return type preceding the "inline" keyword
in function declarations.

Fix the declarations for file_can_read_pages() and
afs_linux_readpage_fastpath() to have the proper ordering of the
static/inline keywords attributes so they precede the return type.

Just a note that the `static` and `inline` keywords must precede a
function's return type.

Change-Id: I3ff9d45c119e70a90faf18fbf6d49fb6b9adcf33
Reviewed-on: https://gerrit.openafs.org/15768
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
2024-06-15 15:17:06 -04:00
Cheyenne Wills
d8b56f2199 afs: avoid empty-body warning
With Linux 6.10 commit:
    "kbuild: turn on -Wextra by default" (f5982cceb3)
there are additional compiler warnings that can turn
into build errors when --enable-checking is used.

    "error: suggest braces around empty body in an ‘if’
     statement [-Werror=empty-body]"

when there is an empty body, e.g.
    if (foo)
        ;

Most cases are due to the macros afs_PutCell and afs_PutServer which are
"empty" macros.

Update the afs_PutCell and afs_PutServer macros so they expand to
  do {} while(0)

Add a comment at the definitions for afs_PutCell and afs_PutServer to
document the reason for keeping them.

Add braces to conditionals that have an empty body.

There are no functional changes with this commit.

Change-Id: I359723eb6a19d1c78449902b4f477da131b0fa18
Reviewed-on: https://gerrit.openafs.org/15766
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
2024-06-15 15:10:45 -04:00
Cheyenne Wills
03b280649f Linux-6.10: remove includes for asm/ia32_unistd.h
The Linux 6.10 commit:
    "x86/syscall/compat: Remove ia32_unistd.h" (e2d168328e)

Removed the header ia32_unistd.h since it was just a wrapper for the
unistd_32_ia32.h.

The commit:
    "linux-afs-translator-xen-20060731" (29dd792381)
added an ia32_unistd.h include to several files; all were not needed
(as they didn't reference any of the contents from the header file, e.g
_NR_ia32_*).

The commit:
    "amd64-hook-ia32-table-20030519" (831e172463)
added an include for ia32_unistd.h to osi_module.c.

A later commit:
    "osi-probe-syscall-20050129" (f126dbdbe2)
removed many of the references to defines from ia32_unistd.h, but did
not remove the include for the header.

Currently the only remaining files (linux-kernel-syscall-probe.m4,
LINUX/osi_probe.c and LINUX/osi_syscall.c) continue to reference the
items from ia32_unistd.h, but only when building older kernels that
either don't have LINUX_KEYRING_SUPPORT or when
ENABLE_LINUX_SYSCALL_PROBING is enabled (in both cases, these are only
applicable for older kernels where the asm/ia32_unistd.h file would be
present).

For the files that don't have references (i.e. _NR_ia32_*), we can
simply remove the include for asm/ia32_unistd.h.  For the remaining set
of files, we can leave the include for asm/ia32_unistd.h since the code
already has preprocessor conditionals so it's only included for older
Linux kernels where the header file will be present.

We noted above, the include for asm/ia32_unistd.h is already conditional
on the checks for LINUX_KEYRING_SUPPORT and ENABLE_LINUX_SYSCALL_PROBING
so we do not need to add any additional configure checks.

Change-Id: I901b5c0f0ff86272b02f898f3951325533d22f4f
Reviewed-on: https://gerrit.openafs.org/15763
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
2024-06-15 15:08:16 -04:00
Cheyenne Wills
658942f279 Linux-6.10: define a wrapper for vmalloc
The Linux 6.10 commit:
    "mm: vmalloc: enable memory allocation profiling" (88ae5fb755)
changed vmalloc from a function to a wrapper macro.

This change results in build errors:
    "error: implicit declaration of function ‘vmalloc’; did you mean
       ‘kmalloc’? [-Werror=implicit-function-declaration]"

when vmalloc is passed as a parameter to the afs_atomlist_create() and
afs_lhash_create() functions.

Add a little wrapper function around vmalloc() to use for the parameter
to afs_atomlist_create() and afs_lhash_create().

Note: A configure test was not needed for this change since the name
and functionality of Linux's vmalloc did not change.

Change-Id: I69c1da9eea5d1de11c1628bbcef427f81f5c01e1
Reviewed-on: https://gerrit.openafs.org/15765
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-06-14 12:02:48 -04:00
Cheyenne Wills
0f6a3a402f Linux-6.10: Use filemap_alloc_folio when avail
The Linux 6.10 commit:
    "mm: remove page_cache_alloc()" (3f2ae4ebd5)
removed the page_cache_alloc(), with a note that callers would be using
filemap_alloc_folio instead.

The function filemap_alloc_folio() was introduced in Linux 5.15 commit:
    "mm/filemap: Add filemap_alloc_folio" (bb3c579e25)

Add a configure check for filemap_alloc_folio and update the function
afs_linux_read_cache() to use a wrapper that calls filemap_alloc_folio()
if available otherwise calls page_cache_alloc().

Minor whitespace/style cleanup

Note: The function filemap_alloc_folio() was introduced in Linux 5.15,
so this change affects builds using the Linux kernel 5.15 and later.

Change-Id: Ia17aefc38fe9787e54b315c864da726d610b8bb9
Reviewed-on: https://gerrit.openafs.org/15764
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-06-14 12:02:30 -04:00
Cheyenne Wills
2856a350d0 afsweb: remove unsupported afsweb component
The afsweb component is marked as obsolete.  The last substantial change
other than global changes was in 2002 to add build support for netscape
(afsweb-add-netscape-config-script-20020213 0e04c507b).  The
documentation and build configuration implies support for Apache 1.3.6
which was released in 1999; and the Apache 1.3 series as a whole was EOL
in 2010.

By default the afsweb component isn't built.

Clean out the source and references for the afsweb component
(src/afsweb).

Change-Id: Ibb3f91260d4e8d703619fafbad70cd3f7e4da7bc
Reviewed-on: https://gerrit.openafs.org/14849
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
2024-06-13 15:29:05 -04:00
Cheyenne Wills
cbfdf1ed97 JAVA: remove unsupported JAVA component
The Java (libjafs) component has been marked as obsolete.  Other than
a minor update in 2007 (java-admin-interface-updates-20071214 f72145f79)
there have been no substantial changes since 2003
(java-jafs-update-20030619 af1a0ea03). Changes since then have been
mostly related to source cleanups and a commit in 2012 (Make libjafs
buildable again 967d7201ee).

By default the Java component isn't built and an attempt to build fails
with an error in the src/JAVA/libjafs/Makefile:
make[1]: Entering directory '.../src/JAVA/libjafs'
Makefile:34: *** Recursive variable 'CC' references itself (eventually).
             Stop.

Clean out the source and references for the obsolete JAVA component
(src/JAVA).

Change-Id: Idc241e08f62a1b9384a5ce4d0f2fdb13e2f96904
Reviewed-on: https://gerrit.openafs.org/14839
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2024-06-13 12:18:15 -04:00
Michael Meffie
372930175e auth: Allocate ThisCell and CellAlias pathnames
The CellServDB pathname is dynamically allocated, however the ThisCell
and CellAlias pathnames are constructed with stack allocated buffers,
which limit the supported pathname lengths and makes this code path
susceptible to stack smashing.

Instead, use asprintf() to dynamically allocate the ThisCell and
CellAlias pathnames in order to support long configuration directory
paths.

Change-Id: I117a4109856ce58d875d7104a6b1805789fa55de
Reviewed-on: https://gerrit.openafs.org/15530
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-06-13 11:59:11 -04:00
Michael Meffie
bee0566133 rx: Print free and allocated counters as unsigned values
Commit b967654434 (rxdebug-print-values-unsigned-20090512) changed the
output of rxdebug to print counters as unsigned values.  However, that
commit missed changing the format of the "free" and "allocated" packets
counters.

Change the printf format specifiers of the "free" and "allocated" packet
counters to print them as unsigned values.

The free packets counter is stored as an afs_int32, which maybe a long
on some platforms.  This counter was previously cast to an int type in
commit 1d93f2da22 (rx-warnings-and-prototyping-20010623) to avoid a
format specifier warning.  Update the cast to an unsigned int to be
clear this is an unsigned value.

Change-Id: I22eecd0ca8533778bc6459c6ede8694575d20273
Reviewed-on: https://gerrit.openafs.org/15608
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-06-13 08:48:44 -04:00
Benjamin Kaduk
bc896094dd CODING: general tidying
Try to normalize the use of top-level (==) and second-level (--)
heading markers, and make the length of the header marker match
the length of the preceding line.

Wrap some long lines.

Document the existing practice of using braces for one-line conditional
bodies when other branches of the conditional need braces.

Update list of build-dependencies for Debian.

Update size of the git repository.

Mention the Stable Release Manager for backports.

Clarify that --enable-checking=all is not generally useful.

Promote the guidance to document new warning inhibitions into a
full directive (i.e., remove "please").

Add some more line breaks in the section on inhibited warnings to
try to have things line up better in the designated columns.

Change-Id: Ibfb7f3a2ad0ec82a401b4b028ab108f87a9b2b03
Reviewed-on: https://gerrit.openafs.org/15610
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-06-04 00:54:04 -04:00
Andrew Deason
6ca01529de rx: Use _CLASS_RECV_CBUF in rxi_ReadPacket
Currently, the userspace rxi_ReadPacket() allocates additional space
for the incoming packet (if needed) with the RX_PACKET_CLASS_SEND_CBUF
class. But we are allocating buffers for receiving packets, and so we
should be using the RX_PACKET_CLASS_RECV_CBUF class.

This is clearly a mistake from OpenAFS 1.0, since all other
packet-receiving code uses RX_PACKET_CLASS_RECV_CBUF, and all other
users of RX_PACKET_CLASS_SEND_CBUF are for sending packets.

This mistake doesn't actually matter for most cases, since the packet
class given to rxi_AllocDataBuf() is ignored for non-KERNEL, and this
code is userspace only. The only time this is actually used is for
UKERNEL. For UKERNEL, this mistake could possibly cause us to
prematurely restrict how much space we allocate here (since the
_SEND_CBUF packet quota is larger than the _RECV_CBUF quota), and
trigger a sendCbufPktAllocFailures event.

To fix this, use the proper RX_PACKET_CLASS_RECV_CBUF class instead,
to match other packet-receiving code paths.

Change-Id: I94077d595102560375d12c766d176b87d427b735
Reviewed-on: https://gerrit.openafs.org/15336
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2024-05-30 18:38:16 -04:00
Sahil Siddiq
3961e416f6 rx: Cleanup and build simple.example
Our simple.example is not built by default, and currenly does not build
for a couple of reasons:

There are undefined references to symbols in "lib/libafsrpc.a". For
example, there is an undefined reference to "hc_RAND_bytes" in
"rx_InitHost" in libafsrpc.a (rx.o). Modify the rules in
simple.example's Makefile.in to link the object files with hcrypto and
roken to fix this.

Running rxgen fails on objdir builds, because we weren't specifying a
srcdir path for sample.xg. Specify ${srcdir}/sample.xg instead.

Also change simple.example to be built by default to improve its
maintainability. Add it to the "rx_test" top-level make target, since it
depends on libafsrpc and libafsauthent.

[adeason@sinenomine.net: Use the existing rx_test target, slight commit
message edits.]

Change-Id: I9196ab170c594e9b5567e8f299625e4ff07f00eb
Reviewed-on: https://gerrit.openafs.org/15754
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>
2024-05-30 18:06:34 -04:00
Mark Vitale
abb15d449c afs: Correct comment typo in DNew()
Commit aed4a0c4b9 "afs: avoid panic in
DNew when afs_WriteDCache fails" introduced Doxygen comments for DNew().
However, due to a cut-and-paste error, the name of the second parameter
is incorrect.

Correct the Doxygen comments.

No functional change is incurred by this commit; it is just
documentation.

Change-Id: Ia6183d4aac0946f78982626f195e4a305fe9a481
Reviewed-on: https://gerrit.openafs.org/15757
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-05-30 14:29:59 -04:00
Andrew Deason
236cb51b83 rx: Cleanup and build src/rx/test
We have several programs in src/rx/test that are not built, and have
bitrotted as a result. Clean them up so they can build again, and
make them all build by default.

Some pieces depend on higher-level libraries (libafsrpc) that depend
on rx, so we cannot build all of these during 'make rx'. So create a
new top-level make target, 'rx_test', that just builds the test
programs.

Remove testqueue.c instead of fixing it, since it just tests the old
rx queue implementation, and we already have tests for the newer
opr_queue.

Remove some obsolete references to rxperf/th_rxperf in here; rxperf
has lived in src/tools/ for quite some time.

Change-Id: I8b8b2c0813531ef185d95f4d6fdce6bc69320b80
Reviewed-on: https://gerrit.openafs.org/14749
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-05-23 17:57:32 -04:00
Marcio Barbosa
2d980aaef7 rxgk: Initialize 'iterations'
gcc 4.4.7 (used on RHEL6) throws a warning that 'iterations' is used
uninitialized:

    .../src/rxgk/rxgk_crypto_rfc3961.c: In function 'PRFplus':
    .../src/rxgk/rxgk_crypto_rfc3961.c:621: error: 'iterations' may be used uninitialized in this function [-Wuninitialized]

It's not actually possible for 'iterations' to be used uninitialized;
we only use it in the 'done' destructor if 'pre_key' is set. But
initialize 'iterations' to 0 to avoid the warning.

Change-Id: I7ec3d033847a8804899f4d9fe163a56586812d4d
Reviewed-on: https://gerrit.openafs.org/15750
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
2024-05-10 14:40:44 -04:00
Andrew Deason
799d789fba afs: Reintroduce and use DFlushDCache()
This reverts commit 432ac5810e (afs:
Remove DFlushDCache()). This also re-adds the caller of DFlushDCache()
removed by commit 4045f3d535
(disconnected-shadow-directory-fixes-20090121), and the prototype
removed by commit 5ad1e6cb90 (dir:
Prototype and function name cleanup).

The removal of the DFlushDCache() call in commit 4045f3d535 seems like
a mistake. If the directory in question has dirty pages in memory, we
need to flush those to the cache before making a copy of the
directory's data, because we read the existing dir's data from the
cache. If we don't flush, afs_MakeShadowDir() might make a copy of the
dcache that is missing updates to the directory blob.

Change-Id: I4f26103b3db5e1ebdbe3324d2d9f67b39ab22e09
Reviewed-on: https://gerrit.openafs.org/15740
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
2024-04-26 18:47:45 -04:00
Stephan Wiesand
407c637157 make-release: create SHA256 checksums too
Check for utilities to create both MD5 and SHA256 message digest files.

Search the PATH plus some common directories for the message digest
utilities.

Exit with an error at the end of make-release when one or more message
digest files are not generated.

In addition, omit the path component in the generated files by running
the message digest utilities in the directory containing the files being
checked.

Before:

    $ make dist
    ...
    $ cat packages/openafs-1.9.1-333-g4bf33-doc.tar.gz.md5
    920793bcd7bd9bc8fbff9016ed2cc8bb  packages/openafs-1.9.1-333-g4bf33-doc.tar.gz

After:

    $ make dist
    ...
    $ cat packages/openafs-1.9.1-333-g4bf33-doc.tar.gz.md5
    920793bcd7bd9bc8fbff9016ed2cc8bb  openafs-1.9.1-333-g4bf33-doc.tar.gz

[mmeffie: Add change directories, search PATH, update commit message.]

Change-Id: I0deddc0318846a5000aec9e6b4e189d166b8a539
Reviewed-on: https://gerrit.openafs.org/14566
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-25 12:22:19 -04:00
Andrew Deason
4645618ec1 venus: Remove dedebug
This utility has never been built by default, currently does not build
(because RXAFSCB_GetDE doesn't exist), and generates many warnings.
Remove the dead code.

Change-Id: I4c91eb44b3b3c265f0741b9918601abf338b492a
Reviewed-on: https://gerrit.openafs.org/15738
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-18 16:50:37 -04:00
Cheyenne Wills
9937cce3f3 Linux-6.9: file_lock mbrs moved to file_lock_core
In the Linux 6.9 commit:
 'filelock: split common fields into struct file_lock_core' (a69ce85ec9)
several fields were relocated into a new structure, file_lock_core,
which was added as a member the file_lock structure.  The names where
changed (fl_x to flc_x).

Add a configure test to determine if the new members (flc_type, flc_pid,
and flc_flags) are available as part of the file_lock_core structure.

Add static inline getter/setter routines to handle accessing the
flc_type or flc_pid members in the file_lock_core structure, or the
fl_type, fl_pid members in the file_lock structure as appropriate. Add
static inline function to clear FL_SLEEP in the flc_flag in the
file_lock_core structure or the fl_flag in the file_lock structure as
appropriate.

Minor surrounding white space cleanup.

Change-Id: Idfc66db34bab4d5c764647fefda1b9eebb7af0b0
Reviewed-on: https://gerrit.openafs.org/15708
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-17 23:49:18 -04:00
Andrew Deason
134d6c1966 Remove more SRXAFSCB_GetDE stubs
Commit 444a971edc (afs: Remove SRXAFSCB_GetDE) removed our
SRXAFSCB_GetDE stub from src/afs, but the same thing also exists in
fsprobe and xstat. Remove those, too.

Change-Id: I8cfbe8524f16be645e50274d3690442965bcc9e5
Reviewed-on: https://gerrit.openafs.org/15737
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-17 23:07:06 -04:00
Chas Williams (CONTRACTOR)
4aafe1613d bozo: Introduce bnode_Wait()
Create bnode_Wait(), the other half of bnode_Check().

Change-Id: Ib38419ccae5861b8c2491c9d8d8b740ddf81d274
Reviewed-on: https://gerrit.openafs.org/14081
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Indira Sawant <indira.sawant@ibm.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Kailas Zadbuke <kailashsz@in.ibm.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-11 17:45:24 -04:00
Cheyenne Wills
6ace773fdc tests: rx/perf wait for server init before client
The rx/perf test can occasionally fail due to the rxperf server not
being fully initialized before the client started. This can cause test
errors, even without changes to the rx code.

 C_TAP_VERBOSE=1 make check TESTS="rx/perf"
 ...
 rx/perf

 1..4
 ok 1 - Started rxperf server
 not ok 2 - single threaded client ran successfully
 RPC: threads	30, times	1, write bytes	1048576, read bytes...
 ok 3 - multi threaded client ran succesfully
 ok 4 - Server exited succesfully
 FAILED 2 (exit status 1)

Add a routine that waits for the rx_perf server to become available.
Loop several times trying the connection via the rx_perf client, with
a short delay between retries.  If the connection cannot be established,
fail the test.

Clean up trailing whitespace on a couple of lines.

Note: This failure was observed in an OpenAFS buildbot worker that
included a make tests, and which would occasionally fail when there was
no rx related code changes. The intermittent failure could be duplicated
on a slower virtual test system, but would not fail on a faster system.

Thanks to mmeffie@sinenomine.net for the 'wait_for_server' contribution.

Change-Id: Ie11e0d726ce287c45a677f3bb799388121aafc1e
Reviewed-on: https://gerrit.openafs.org/15676
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
2024-04-11 17:45:00 -04:00
Michael Meffie
e6bc50524e rxperf: Add -o option to rxperf client
Add the -o (output) option to the rxperf client specify the output file.

If not specified, the output is written to stdout, as before.

Change-Id: Ibcb375c65a0ff67afea9aba4ba7da7308a273e2d
Reviewed-on: https://gerrit.openafs.org/15731
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-11 14:52:22 -04:00
Cheyenne Wills
0f116d265c Linux: osi_gcpags.c remove unreferenced extern sym
Commit 'Cleanup usage of LINUX_VERSION_CODE for older kernels'
(91a576142e) removed the last references to the Linux symbol
'tasklist_lock' in osi_gcpags.c, but did not remove the declaration for
the symbol.

Remove the unused declaration for the tasklist_lock symbol.

Change-Id: I14103397d0cc0f2c15a283c2572bed07090f1a73
Reviewed-on: https://gerrit.openafs.org/15670
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-28 12:53:23 -04:00
Cheyenne Wills
2f260825b9 Linux: Remove weak attribute for key_type_keyring
The reference to the Linux symbol key_type_keyring uses a weak
attribute to assist in determining if the symbol is exported.  This
method was introduced in commit: 'keyring-updated-20080310' (b7fb842b1c)
as a way to detect if the symbol was exported by the Linux kernel.  A
later commit: 'linux-keyring-export-check-20090701' (4ca66112c2)
introduced an autoconf test that eliminated the need for using the weak
attribute, but the commit did not remove the attribute.

On a Debian-12 system on ARM64 the use of the weak attribute in this
case causes an error when loading the kernel module:
  "ERROR: could not insert 'openafs': Exec format error".
The error is due to the Linux module loader not supporting the
relocation entry type in the openafs kernel module for the
key_type_keyring.  Further investigation showed that this problem could
occur with gcc-12 on a ARM64 system (see below for additional
information).

The code in osi_groups.c uses a pointer, __key_type_keyring, to the
key_type_keyring.  When this symbol is exported by the Linux kernel, the
loader would resolve the address and __key_type_keyring would contain
the address.  If the key_type_keyring symbol was not exported,
__key_type_keyring would be set to NULL (due to the weak attribute
associated with key_type_keyring).

Remove the weak attribute for key_type_keyring when the configure
test, introduced in the 4ca66112c2 commit, determines that the symbol
is exported (EXPORTED_KEY_TYPE_KEYRING is defined).  When the symbol
isn't exported (pre Linux 2.6.22), just set the pointer,
__key_type_keyring to NULL.

NOTE:

The load error was reported on the openafs IRC channel by "clarkb"

The problem of loading the openafs kernel module was also observed
on a NixOS system as well, and is described in the NixOS ticket

  https://github.com/NixOS/nixpkgs/issues/284501

A Debian-11 system did not have a problem loading the openafs kernel
module. Investigation of the differences between Debian-11 and Debian-12
showed that the problem is due to a series of fixes in the toolchain
(in particular gcc-12) to address 'Cortex-A53 erratum #843419', which
deals with how the ARM64 ADRP instruction is used. With gcc-12, the
code generated uses a R_AARCH64_ADR_GOT for this particular case (which
isn't supported by the Linux kernel module loader).  Gcc-11 created a
R_AARCH64_ABS64 relocation entry type for the symbol.

Change-Id: I3160175c82b47e244c8cedf5ef79fdb0d0dd0002
Reviewed-on: https://gerrit.openafs.org/15668
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-28 12:51:46 -04:00
Andrew Deason
5cda275890 afs: Add prototypes for roken strlcpy/strlcat
Currently, our kernel module on AIX uses the strlcpy and strlcat from
roken, built into strlcat-kernel.o and strlcpy-kernel.o. However, we
don't declare a prototype for strlcat or strlcpy for roken's version
of these (except on LINUX).

To fix this, declare prototypes for strlcpy and strlcat in our
kernel-only roken.h for all platforms that don't define
HAVE_STRLCAT/HAVE_STRLCPY, and redefine them to rk_* variants to make
sure callers are actually using our prototypes and avoid potential
symbol conflicts. Set HAVE_STRLCAT/HAVE_STRLCPY properly to actually
reflect whether a native strlcat/strlcpy is available, and check
HAVE_STRLCAT/HAVE_STRLCPY to control whether we build our own
implementation of the strlcpy/strlcat functions. Always build
strlcat-kernel.o and strlcpy-kernel.o, instead of needing to specify
them in the platform-specific AFS_OS_OBJS; they'll just be empty if
HAVE_STRLCAT/HAVE_STRLCPY are set.

Add roken.h to afsincludes.h, so most KERNEL files will automatically
include it. Since it's now in the OS-independent afsincludes.h, we don't
need it in LINUX/osi_machdep.h, so remove that inclusion of roken.h
Fix a few files that were not properly including
afsincludes.h/sysincludes.h so all files using strlcpy/strlcat will
get roken.h and see the proper prototypes.

Change-Id: I051dbdf3b688835ffe10d278c96f0fb7451ab298
Reviewed-on: https://gerrit.openafs.org/15651
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-22 23:15:40 -04:00
Mark Vitale
2cecc4335e rx: Add 'getters' for Rx timeout values
Since aa76c8f670 'rx: Make struct rx_connection private', the fields
in struct rx_connection have been non-public.

In preparation for a future commit, implement new 'getter' routines for
the three rx_connection timeout values.  Each one is fashioned after the
pre-existing 'setters':
 - rx_GetConnDeadTime()
 - rx_GetConnIdleDeadTime()
 - rx_GetConnHardDeadTime()

Change-Id: I0c6f5370dc992316a49f7c8bff36ccf859c2c908
Reviewed-on: https://gerrit.openafs.org/15555
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2024-03-15 22:34:08 -04:00
Mark Vitale
6425e78ccb ubik: remove superfluous checks of rx_NewConnection return
Since the original IBM code import, rx_NewConnection allocates a new
rx_connection on each call by invoking rxi_AllocConnection -> rxi_Alloc.
rxi_Alloc will panic if no memory is available; therefore
rxi_AllocConnection and rx_NewConnection can never return NULL.

Remove the superfluous checks of the return from rx_NewConnection.
Add equivalent asserts to guard against future breakage.

While here, reorder operations in ubeacon_ReInitServer so we can
eliminate some temporary variables.

Change-Id: I6d00195277d689d80cc6cd7963d8b0a5e5630229
Reviewed-on: https://gerrit.openafs.org/14607
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2024-03-15 17:46:10 -04:00
Cheyenne Wills
30b18c1657 Linux 6.8: Use roken's strlcpy() in kernel module
The Linux 6.8 commit 'string: Remove strlcpy()' (d26270061a) removed the
the strlcpy function from the Linux kernel.  The replacement function,
strscpy(), cannot be used as a drop-in replacement as its currently a
Linux kernel specific function and there are differences in the returned
value.

We can use roken's strlcpy() (provided in roken/strlcpy.c).

Create a configure test to that defines its own strlcpy() to test
if the kernel doesn't provide one itself. Note, we need to use a
different function signature for strlcpy() from what the kernel might
have otherwise the test build succeeds when the kernel does provide a
strlcpy().

Update the OpenAFS kernel specific roken.h to define the prototype for
strlcpy when it's not present in the Linux kernel.  We need to match the
defines used in the 'real' roken.h so the roken/strlcpy.c can build
properly. Add defines for ROKEN_LIB_FUNCTION, ROKEN_LIB_CALL and
ROKEN_LIB_VARIABLE to the kernel roken.h

Update Linux's osi_machdep.h to include roken.h so the strlcpy protoype
is available.

Update the Linux MakefileProto to include the strcpy-kernel object
when building the kernel module.

Change-Id: I64a5743ba94134538853f51cd6e7a8df19127624
Reviewed-on: https://gerrit.openafs.org/15646
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-12 01:13:18 -04:00
Mark Vitale
15022f84b0 ubik: ensure correct election deadline
Ubik invariants (see src/ubik/ubik.p.h) document that for proper quorum
elections, the VOTE service requires:

      "#SMALLTIME and #BIGTIME must be larger than
       #RPCTIMEOUT+max(#RPCTIMEOUT, #POLLTIME)"

    Solving this for VOTE connection Rx dead timeout yields:

       Rx dead timeout < 30s

However, setting rx dead time only protects the election if a db host
goes down.  If a db server is still alive (responding with acks and
pings) but the VOTE_Beacon reply is delayed for some reason, the entire
election can still take too long and cause a loss of quorum.

Specify a hard dead time in ubeacon_NewVOTEConnection.  This ensures
that all VOTE RPCs for all ubik servers (and thus, all elections) will
end within the hard dead time,

Change-Id: I90d0cd2ec9ecd001d448068960592067e6d8dc77
Reviewed-on: https://gerrit.openafs.org/15553
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>
2024-03-09 16:59:32 -05:00
Mark Vitale
6232a99fb6 ubik: ensure correct election timeout for vlserver
Ubik invariants (see src/ubik/ubik.p.h) document that for proper quorum
elections, the VOTE service requires:

  "#SMALLTIME and #BIGTIME must be larger than
   #RPCTIMEOUT+max(#RPCTIMEOUT, #POLLTIME)"

Solving this for VOTE connection Rx dead timeout yields:

   Rx dead timeout < 30s

The current default rx_connDeadTime is 12s; if this value is in force
when VOTE client connections are created or recreated, ubik elections
will work correctly.

(Apparently, RPCTIMEOUT 20s was once intended to be used for this value,
but this constant has not been referenced by any live code since the
original IBM code import.)

However, since the original IBM code import, vlserver has set
rx_connDeadTime to 50s.  In 1.6.x and older releases, this was only done
after the ubik VOTE and DISK client connections had been established;
therefore the initial VOTE connections had the correct default
rx_connDeadTime of 12s.  However, if a VOTE client connection ever failed
(e.g., due to a down vlserver), it would be reestablished with the 50s
timeout.  Because this violates a ubik invariant, it may lead to random
quorum disturbances if further vlserver outages occur.  This is because
the election results may be delayed for up to 50s until the
multi_VOTE_Beacon to the down vlserver times out.  If the vlserver goes
down just a few seconds before the next election, this delay is just
long enough to cause the syncsite's votes to expire (SMALLTIME 60s),
triggering a temporary loss of quorum even when there are sufficient yes
votes to maintain quorum.

As of commit 3e531db9ce (vlserver: rx_SetRxDeadTime before ubik init)
introduced with OpenAFS 1.8.0, rx_connDeadTime is set to 50s for ALL
vlserver connections, including the initial ubik VOTE and DISK client
connections.  However, as explained above, this violates a ubik
invariant for the VOTE service.  This results in a consistent loss of
quorum every time a vlserver goes down within a few seconds of a new
election, even if there are sufficient votes to maintain quorum.

Create and use a new function ubeacon_NewVOTEConnection to create all
VOTE client connections with an rx dead time VOTE_RPCTIMEOUT which
complies with the ubik invariants.  This allows ubik applications like
vlserver to change rx_connDeadTime without affecting ubik election
timing.

Note: vlserver is the only in-tree ubik server affected by this issue.
Even though buserver (src/budb/server.c) also sets a problematic
rx_connDeadTime of 60s at initialization, this is immediately reset to
12s by a subsequent call to rx_InitHost.  (This buserver anomaly will be
addressed in another commit.) The other ubik servers (ptserver and
kaserver) always use the default 12s time.

Change-Id: I63e2c46b6097c9c2c89e6e858e3958846c6cb190
Reviewed-on: https://gerrit.openafs.org/14608
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-09 16:57:00 -05:00
Mark Vitale
b4a4a2ae9c rx: Define symbolic names for Rx magic numbers
Since the original IBM code import, the magic number '6' has been used
to specify the number of consecutive lost keepalives (ping acks) that
indicate a dead connection.  By implication, this also defines the
minimum number of seconds (at the minimum keeplive periodicity of 1
second) before a connection may be considered dead.

Define and use symbolic names for both uses of '6', and document their
relationship.  Both have the same assigned value '6', but
RX_PINGS_LOST_BEFORE_DEAD is use as an ordinal count, while
RX_MINDEADTIME is expressed in units of seconds.

The magic number '12' is used in a couple of places for the default
value of rx_connDeadTime.  Give this constant a name
(RX_DEFAULT_DEAD_TIME) and use it.

No functional change is incurred by this commit.

Change-Id: I8689062d25b51c557da16e27601297b6856e048a
Reviewed-on: https://gerrit.openafs.org/14621
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-09 16:56:14 -05:00
Cheyenne Wills
35c8c1bf0b Linux 6.8: Remove ctl_table sentinels
The Linux 6.8 commit 'sysctl: Remove the now superfluous sentinel
elements from ctl_table array' (c8a65501d3) was a clean up commit
that removed the sentinel entry in the ctl_table array (e.g. the
"null" entry at the end of the table).

As of Linux 6.8, including the sentinel entry (.procname =) in the
ctl_table is unnecessary, but doesn't yet break anything.  But it is
likely that including the sentinel will start to cause runtime errors in
future Linux versions very soon, so avoid the sentinel when we can, to
avoid possible problems in the future.

Define a new macro that can be used as the last entry of a ctl_table
that will either add a "null" entry, or nothing.

There is not a specific build test we can use within configure, so we
must explicitly test the Linux version to decide if we need to use a
sentinel or not when defining the macro.  We are selecting 6.8 to match
the version where the Linux kernel is removing the sentinels from the in
kernel filesystems.

Note: See the Linux merge commits 'Merge tag 'sysctl-6.8-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux' (a05aea98d4)
for more details behind the staged removal of the sentinels in the
ctl_table structures and the potential future change for removing the
actual check for the sentinel within the Linux kernel.

Change-Id: I0f50872e7d08dc198584623337909a180002ab30
Reviewed-on: https://gerrit.openafs.org/15645
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-06 23:35:06 -05:00
Cheyenne Wills
8e0bbe6a07 Linux 6.8: use hlist iteration for dentry children
Linux 6.8 commit 'dentry: switch the lists of children to hlist'
(da549bdd15) replaces the dentry lists d_subdirs/d_child with the hlist
d_children/d_sib.

Add an autoconf test for a d_children member in the dentry structure.

Define a macro that uses the applicable Linux function for iterating
over a dentry's children.

Change-Id: I6e8fb9a58c0afd9c383c07c294f64df1fc045585
Reviewed-on: https://gerrit.openafs.org/15632
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-06 23:31:04 -05:00
Cheyenne Wills
26bb4d143b rxgen: Declare generated PKG_OpCodeStats()
The function {PKG}_OpCodeStats() is generated by rxgen, however a
prototype for the function is not generated.

The functions h_ProcMainBody_setup() and h_HeadofOldStyleProc_setup()
in rpc_parse.c emit prototypes for {PKG}_ExecuteRequest() and
{PKG}_TranslateOpCode(), but do not emit a prototype for
{PKG}_OpCodeStats().

Update rxgen to emit a function prototype for {PKG}_OpCodeStats() in the
generated header file.

Use a variable to point to "PackagePrefix[PackageIndex]" in
h_ProcMainBody_setup to improve readability.

{PKG}_OpCodeStats(), specifically RXSTATS_OpCodeStats(), is flagged due
to a missing prototype when building against a Linux 6.8 kernel (which
sets the -Wmissing-declarations and -Wmissing-prototypes compiler flags
as default). Linux 6.8 commit:  'Makefile.extrawarn: turn on
missing-prototypes globally' (0fcb70851f). When building against a
kernel with CONFIG_WERROR=y, the build fails.

Change-Id: If660c21c1a7c452d212cc98fefc1bd61138b7c31
Reviewed-on: https://gerrit.openafs.org/15631
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-06 23:30:32 -05:00
Andrew Deason
9b2c27fc6d rxgen: Declare generated PKG_TranslateOpCode()
Ever since commit 5c77a6ca (rxgen: add *TranslateOpcode functions to
XDR code), rxgen generates a PKG_TranslateOpCode function in the
relevant .xdr.c source, which can translate an RPC opcode into the RPC
name. But we never declare this function in a header file, making it
impossible to use without compiler warnings (unless the caller
declares the function itself).

To make it possible to actually use this function, declare this
function in the generated header file.

Change-Id: I013349d28ab1cac8e8aac2ddf6b2cecb64bdcc51
Reviewed-on: https://gerrit.openafs.org/14871
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-01 00:44:17 -05:00
Cheyenne Wills
55adceba2d rx: Add static attribute to internal functions
When building against a Linux 6.8 kernel, functions that are missing
prototypes or declarations are flagged.

We can add the static attribute to functions that are not referenced
outside of the file that implements them to avoid having these functions
flagged by the compiler.

These functions are flagged due to missing prototypes when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

There are no functional changes in this commit.

Change-Id: I663f0483f4b1f91ead86523de66b051053a41296
Reviewed-on: https://gerrit.openafs.org/15626
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-01 00:44:08 -05:00
Cheyenne Wills
efee796f28 afs: Add static attribute to internal functions
When building against a Linux 6.8 kernel, functions that are missing
prototypes or declarations are flagged.

We can add the static attribute to functions that are not referenced
outside of the file that implements them to avoid having these functions
flagged by the compiler.

These functions are flagged due to missing prototypes when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

There are no functional changes in this commit.

Change-Id: I24c78a3167f6a81da4f62267cf901024468ae6b3
Reviewed-on: https://gerrit.openafs.org/15625
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-01 00:37:36 -05:00
Cheyenne Wills
36e4c02ff2 afs: fix 'ops' variable may be used uninitialized
When the function rxfs_storeInit() has the static attribute, gcc flags
the variable 'ops' as possibly uninitialized.

In function 'afs_CacheStoreDCaches',
    inlined from 'afs_CacheStoreVCache' at
     .../src/afs/afs_fetchstore.c:630:14:
     .../afs/afs_fetchstore.c:535:17: error: 'ops' may be used
     uninitialized [-Werror=maybe-uninitialized]
      535 |         code = (*ops->destroy)(&rock, code);
          |                ~^~~~~~~~~~~~~~
     ...src/afs/afs_fetchstore.c: In function 'afs_CacheStoreVCache':
     ...src/afs/afs_fetchstore.c:567:22: note: 'ops' was declared here
      567 |     struct storeOps *ops;
          |                      ^~~
     cc1: all warnings being treated as errors

This is a false positive report by the gcc compiler.

The function rxfs_storeInit() returns a 0 only when it has successfully
assigned a value to the ops variable, and afs_CacheStoreDcaches() is
only called if the return value from rxfs_storeInit() is 0.

The ops variable is only used within a block that is within a for loop,
which could leave a stray value if the variable isn't initialized within
that loop.

Assigning a NULL to ops is sufficient to avoid the compiler error, and
relocating the declaration of the ops variable into the block where it
is actually used ensures that it's always initialized before its use
within the loop.

Clean up whitespace in the statement that follows the new location for
the ops variable.

Note, this commit is being added before a commit that adds the static
attribute to the rxfs_storeInit() function which also "fixes" the
compiler error (see: afs: Add static attribute to internal functions).

Change-Id: Id2c3e68720f92ea05818419567ffe90ce0b5061a
Reviewed-on: https://gerrit.openafs.org/15630
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-29 12:55:51 -05:00
Cheyenne Wills
8528c36b96 rx: Add function prototypes to rx_prototypes.h
The prototype for rxk_NewSocketHost() is not in a header file, but is
defined in the referencing .c file. The ARCH/rx_knet.c files that
implement rxk_NewSocketHost() do not have a prototype (but when the
rx_kcommon.c implementation is used it does have a prototype, since
rx_kcommon.c is the "referencing .c file").

Add the prototype for rxk_NewSocketHost() to rx_prototypes.h and
remove the prototype from rx_kcommon.c

The prototypes for the functions rx_DebugOnOff() and rx_StatsOnOff()
are defined within rx_prototypes.h, but are within a preprocessor
conditional for AFS_NT40_ENV, however the implementation for these
2 functions do not have the preprocessor conditional.

Rearrange the prototypes for rx_DebugOnOff() and rx_StatsOnOff() so they
are outside the AFS_NT40_ENV preprocessor conditional.

These functions are flagged due to missing prototypes when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

There are no functional changes in this commit.

Change-Id: I9bf48c5971b022e40575aeb50692c1fa14c286a2
Reviewed-on: https://gerrit.openafs.org/15624
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-29 12:54:09 -05:00
Cheyenne Wills
fae4003b40 afs: Remove SRXAFSCB* protos from afs_prototypes.h
The prototypes for the afscbint RPC functions (SRXAFSCB_*) implemented
in afs_callback.c are defined in 2 locations, afs_protypes.h and
afscbint.h (which is generated by rxgen).

Remove the protoypes for the SRXAFSCB_* functions from afs_prototypes.h
as they are redundant and are currently out of sync (the prototypes
for SRXAFSCB_GetCellByNum() and SRXAFSCB_TellMeAboutYourself() are
not present in afs_prototypes.h).  Also remove a redundant prototype for
afs_RXCallBackServer() which was prototyped both before and in the
middle of the SRXAFSCB* prototypes.

Since afs_callback.c only pulled in afs_prototypes.h and not afscbint.h,
add an include for afscbint.h to ensure that the all the prototypes for
the SRXAFSCB_* functions are present.

The 2 functions listed above are flagged due to missing prototypes when
building against a Linux 6.8 kernel (which sets the
-Wmissing-declarations and -Wmissing-prototypes compiler flags as
default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Change-Id: Ieb43314cbeef444d44a3af74b4dca7a7986b54ba
Reviewed-on: https://gerrit.openafs.org/15644
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-29 12:38:56 -05:00
Cheyenne Wills
575d986aa6 afs: Add afs_xioctl prototyes to afs_prototypes.h
Several .c files have external function prototypes for the afs_xioctl
function, while the implementing files do not have the prototype.

Move these prototypes into afs_prototypes.h so that the prototypes are
available to both the caller and the implementation.

Because the file holding the implementation does not have a prototypes,
afs_xioctl() is being flagged when building against a Linux 6.8 kernel
(which sets the -Wmissing-declarations and -Wmissing-prototypes compiler
flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a Linux kernel with CONFIG_WERROR=y, the build
fails.

Note that the function afs_xioctl() has platform specific
implementations.

Change-Id: I0956daace8c9036a924b928e387eb4a2ea542bf1
Reviewed-on: https://gerrit.openafs.org/15643
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-29 12:31:26 -05:00
Mark Vitale
f7591ee2f9 packaging: Remove '--with bos-restricted' option from RedHat spec file
Commit f085951d39 'Turn on bos restricted code' removed configure
option '--enable-bos-restricted-mode'.  However, the references to
restricted mode in the in-tree RedHat packaging were overlooked.

Remove the '--with bos-restricted' option from the spec file to prevent
specifying the obsolete OpenAFS configure option
'--enable-bos-restricted-mode'.

Change-Id: I9a29dd0ea1f3a1ac4145865777d1d3b751e93195
Reviewed-on: https://gerrit.openafs.org/15667
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-02-27 16:45:44 -05:00
Mark Vitale
2a099859ba cf: Remove obsolete comment "Fast restart"
Commit 8ab7a90937 'pts-supergroups-20030114' inserted new configure
option --enable-supergroups into acinclude.m4.  This unintentionally
separated the comment "# Fast restart" from its corresponding
--enable-fast-restart option.

Commit e61800b992 'Remove --enable-fast-restart configure option'
overlooked the associated comment "# Fast restart" due to the separation
introduced by the previous commit.

Commit c72622a244 'autoconf: refactor acinclude.m4' moved this vestigial
comment to its current resting place in src/cf/options.m4

Remove the vestigial comment.

No functional change is incurred by this commit.

Change-Id: I2f83e12bbbcb2d9929575f298b3d3a260b68a9ca
Reviewed-on: https://gerrit.openafs.org/15666
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-02-27 16:44:25 -05:00
Cheyenne Wills
85781d7e83 afs: Move function prototypes into headers
Several .c files contain external function prototypes, while the
implementing files do not have these prototypes.

Move these prototypes into header files so that the prototypes are
available to both the caller and the implementation.

Because the file holding the implementation does not have prototypes,
these functions are flagged when building against a Linux 6.8 kernel
(which sets the -Wmissing-declarations and -Wmissing-prototypes compiler
flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Add the prototypes for the following to afs_prototypes.h:
  exporter_add
  afs_syscall (AFS_LINUX_ENV)
  BlobScan

Remove the prototypes from the .c files where they are referenced.

Change-Id: Ifc75cafe0132bb4cb8714062253f08874be7c06d
Reviewed-on: https://gerrit.openafs.org/15642
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-22 12:49:51 -05:00
Cheyenne Wills
3683f15278 afs: Add includes to pick up function prototypes
The functions defined in LINUX/osi_crypto.c, osi_pagecopy.c,
osi_probe.c, and osi_syscall.c have function prototypes defined in
existing header files, however either due to missing includes or
preprocessor conditionals that skip the includes, these function
prototypes are not being pulled in.

These functions are flagged due to missing prototypes when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Add the necessary includes to osi_crypto.c and osi_pagecopy.c and
re-arrange the includes in osi_probe.c and osi_syscall.c to ensure that
the function prototypes are present when building the Linux kernel
module.

Change-Id: Idcb409b1c25354b1b8b3bff286000a189651bbf6
Reviewed-on: https://gerrit.openafs.org/15641
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-20 01:02:31 -05:00