rx: Add 'getters' for Rx timeout values Since aa76c8f67001 '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>
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>
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>
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>
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 3e531db9ce50 (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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
packaging: Remove '--with bos-restricted' option from RedHat spec file Commit f085951d39c0 '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>
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>
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>
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>