commit 6cb9320825c3617abcb48e7fbd9d0d64f0c2f65b Author: Stephan Wiesand Date: Thu Dec 8 18:49:41 2022 +0100 Make OpenAFS 1.8.9 Update version strings for the 1.8.9 release, and add the finishing touch to NEWS. Change-Id: I8185cc177c1150d29d802df522e3b161dac7d75e Reviewed-on: https://gerrit.openafs.org/15215 Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Stephan Wiesand commit 0ad4c50f91c2d322688981b97aa05ba471b848c1 Author: Benjamin Kaduk Date: Fri Oct 8 20:11:19 2021 -0700 viced: cope with signed length/position in FetchData For legacy reasons, the "Pos" (initial position) and "Len" (length) inputs to the RXAFS_FetchData and RXAFS_FetchData64 RPCs are represented as signed integers (the corresponding StoreData RPCs use unsigned values). The use of signed values allows for the possibility of negative inputs, and of signed integer overflow (undefined behavior in C), though the latter is unlikely to arise naturally given that the implementation uses a common backend with 64-bit values. In particular, if a negative "Pos" value is supplied, we end up in FetchData_RXStyle() that performs either FDH_PREAD() or FDH_PREADV() with the negative value as the position from which to read, which is an error. The error handling for those calls treats any error as indicative of a problem with the volume or its underlying storage, and takes the volume offline for salvage. Furthermore, after the maximum number of automatic salvages the volume is left offline for administrator action. This presents a simple route for (unauthenticated) denial of service, as root.cell.readonly must be available to all users of the cell, and can be brought offline in this way; rendering root.cell.readonly unavailable would bring essentially all access to the cell to a halt. (Other volumes could be targeted as well, subject to their corresponding ACLs.) Since there is no valid use for a negative position or length input, reject them outright from the common_FetchData64() implementation. Also check for whether the combination requests a read that would overflow a signed integer and reject that as well. Thanks to Jeffrey Altman and Chaskiel Grundman for collaborating on this change. FIXES 135263 Reviewed-on: https://gerrit.openafs.org/15223 Reviewed-by: Stephan Wiesand Reviewed-by: Mark Vitale Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Tested-by: Mark Vitale Reviewed-by: Jeffrey Altman Reviewed-by: Benjamin Kaduk (cherry picked from commit 1fbbcbee0183aa7855c0e5d9d38aa89af75902db) Change-Id: I1d634918789dddd5500ab50a0b508c142d83dc84 Reviewed-on: https://gerrit.openafs.org/15224 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Stephan Wiesand Reviewed-by: Benjamin Kaduk commit f812d1125f785df05bf1028f665d22c608006bae Author: Stephan Wiesand Date: Thu Nov 3 15:59:04 2022 +0100 Make OpenAFS 1.8.9pre2 Update version strings for the second 1.8.9 prerelease. Change-Id: Ic45d60180097f85263b2bd81b0beb039c36ad51f Reviewed-on: https://gerrit.openafs.org/15192 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Reviewed-by: Mark Vitale Reviewed-by: Benjamin Kaduk Reviewed-by: Stephan Wiesand commit e8ead732246d7bd9c1e38fa806b19dfd9e38cf6a Author: Stephan Wiesand Date: Thu Nov 3 16:11:30 2022 +0100 Update NEWS for 1.8.9pre2 Release notes for the second 1.8.9 prerelease. Change-Id: I564ee4f4348ca3574a52c75fea30c55dac5e33a4 Reviewed-on: https://gerrit.openafs.org/15193 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Benjamin Kaduk Reviewed-by: Cheyenne Wills Reviewed-by: Stephan Wiesand Tested-by: Stephan Wiesand commit fdf38483c7765270c24a01b65fc3d1173509136e Author: Cheyenne Wills Date: Thu Sep 22 13:04:59 2022 -0600 Linux-6.0: Replace add_to_page_cache Linux 6.0 removed the add_to_page_cache function in the Linux commit: 'filemap: Remove add_to_page_cache() and add_to_page_cache_locked()' (2bb876b58d593d7f2522ec0f41f20a74fde76822) The replacement function, filemap_add_folio function is exported as GPL, but a non-GPL wrapper was provided in the Linux 5.15 commit: 'mm/filemap: Add filemap_add_folio()' (9dd3d069406cea073fc633e77bc59abbfde8c6c4) which changed the GPL exported function add_to_page_cache_lru to a non-GPL exported function. The function add_to_page_cache_lru functionally combines the add_to_page_cache with lru_cache_add. Within afs, all the calls to add_to_page_cache follow the pattern of calling the lru_cache_add via the wrapper afs_lru_cache_add immediately after (except in one case noted below). Add an autoconf check to see if add_to_page_cache_lru is available. Introduce a new wrapper function afs_add_to_page_cache_lru that handles calling either add_to_page_cache/afs_lru_cache_add or add_to_page_cache_lru. As noted above there is one function, afs_linux_bypass_readpages, that calls add_to_page_cache but does not immediately call afs_lru_cache_add. This function is only used in Linux kernels prior to 5.18, see the commit: 'Linux-5.18: replace readpages with readahead' (7a181415db) Since this code path is only built for a Linux kernel level where add_to_page_cache should also exists, we do not replace this call. NOTE: The add_to_page_cache_lru was moved into mm/folio-compat.c which has a comment indicating that callers of these functions should migrate to folio calls. However the replacement folio call that is needed by afs, filemap_add_folio, is exported as GPL. Reviewed-on: https://gerrit.openafs.org/15132 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit 0ce315f0cee1cff7e19e6ebcc0e0e82e03719c20) Change-Id: Ic0496c2fba00e7be467dbbcf52d9854495e1ad9f Reviewed-on: https://gerrit.openafs.org/15148 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Reviewed-by: Cheyenne Wills Reviewed-by: Mark Vitale Reviewed-by: Harish Sharma Reviewed-by: Stephan Wiesand commit 79a04c3448541bd8299598c5d87b404d8d2219a5 Author: Michael Meffie Date: Mon Sep 26 11:34:57 2022 -0400 afs: Avoid unbounded string copy in SRXAFSCB_GetLock() Use strlcpy() instead of strcpy() when filling in the lock name to avoid string buffer overflows of the AFSDBLock name arrays. This is a 1.8.x specific commit, derived from 419f0cd7aa (afs: Replace strcpy &co by safer alternatives) Change-Id: Ia59f6dccdeab1c0b6f267254bd264842568b7582 Reviewed-on: https://gerrit.openafs.org/15151 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Benjamin Kaduk Reviewed-by: Harish Sharma Reviewed-by: Stephan Wiesand commit 119cea2f49af08f0f24711d1398a739beef1e359 Author: Cheyenne Wills Date: Wed Sep 7 19:03:50 2022 -0600 Remove gssapi in autoconf and configuration The 1.8.x specific commit in gerrit 12681, "Remove src/rxgk" (7c2ce4040) removed rxgk from the build, however the probe for GSSAPI is still place. If there is no gssapi library available, configure fails: checking for gss_import_name in -lgssapi_krb5... no checking for gss_import_name in -lgss... no configure: error: cannot find usable GSS-API library There are no references to gssapi other than the probe in autoconf and 2 defines in src/config/Makefile.config.in Remove the autoconf check for GSSAPI via the RAA_LIB_GSSAPI call. Remove the 2 GSSAPI related defines from Makefile.config.in Update the INSTALL document to remove references to gssapi. Change-Id: I873e46bfccfbf538740e8bf5e28a3ca8c3cd3744 Reviewed-on: https://gerrit.openafs.org/15137 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand commit a2c1f9dc21b9e17aa8b075e4507f07def3275c2a Author: Stephan Wiesand Date: Thu Sep 23 20:20:44 2021 +0200 Make OpenAFS 1.8.9pre1 Update version strings for the first 1.8.9 prerelease. Change-Id: I6fc6dff8143445ee82188a2614588068f1feeb25 Reviewed-on: https://gerrit.openafs.org/14810 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Reviewed-by: Mark Vitale Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 7a44c381f1d599f8a7ee8e6349f3c7ab190ea1f5 Author: Stephan Wiesand Date: Thu Aug 25 16:01:02 2022 +0200 Update NEWS for 1.8.9pre1 Release notes for the first 1.8.9 prerelease. Change-Id: I26e4334f9f1e34b36299b097525a61a89f422aaf Reviewed-on: https://gerrit.openafs.org/15126 Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk Reviewed-by: Stephan Wiesand commit beb1a8a16c946c5ffba9868ae33f20a719fca95f Author: Cheyenne Wills Date: Fri Mar 6 10:00:25 2020 -0700 afs: Clean up compiler warning casting ptr to int In osi_probe.c, the macro 'check_result' casts a pointer to an int which on older Linux kernels (e.g. 2.6.18) produces several lines with the C warning: ... warning: cast from pointer to integer of different size Change the cast from int to long int. Linux 2.6.18 doesn't provide intptr_t or uintptr_t, and stdint.h is not available to kernel modules. But the size of a pointer is the size of a long (see uintptr_t in linux/types.h - Linux 2.6.24+), so change the cast from int to long. Note that the this code by default only gets pulled in for older Linux kernels (e.g. 2.6.18). For newer kernels, ENABLE_LINUX_SYSCALL_PROBING is not defined, and so most of osi_probe.c is not built. Reviewed-on: https://gerrit.openafs.org/14092 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Andrew Deason (cherry picked from commit 38d78e2496c3d242e44bad401ecffe15e3883388) Change-Id: I474ad10c8cda8c414154e20f739a2aba5ba890cf Reviewed-on: https://gerrit.openafs.org/15134 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand commit 7a8c044c09e965af05ac7978123695a3b234d8a1 Author: Andrew Deason Date: Tue Oct 13 12:17:37 2020 -0500 dir: Set srcdir correctly in src/dir/test srcdir is a magic variable that needs to be set to @srcdir@, not some relative path like ../../.. (which will usually be somewhere in the objdir, not srcdir). Set it correctly in here. Without this, objdir builds can fail with: make[4]: Entering directory '...obj/src/dir/test' make[4]: *** No rule to make target 'dtest.o', needed by 'dtest'. Stop. Which happens because the automatic rule for dtest.o can't be constructed, since we cannot find dtest.c automatically because srcdir isn't set properly. This has been broken since commit 37b4195d (dtest-20021111), but was not noticeable until commit 192a2ff4 (dir: make dtest buildable again), since that caused dtest to actually get built. Also set LIBS correctly in here, using the conventional ${TOP_LIBDIR}, since ${srcdir} no longer points to "../../..". Reviewed-on: https://gerrit.openafs.org/14384 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit bc6f50ca0ce6c17a5a9b1042fa90235613f80c95) Change-Id: I8aff31557b6b92bb10c68abb0ba5a61a68b8f750 Reviewed-on: https://gerrit.openafs.org/15133 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand commit e3edd8c43e5808c19a37d8d74a311f4d9240665a Author: Cheyenne Wills Date: Mon Mar 7 18:35:03 2022 -0700 LINUX: Use bitwise & for f_flags test This code is clearly supposed to be masking f_flags with O_ACCMODE, and so should be using a bitwise &, not the boolean &&. Clang complains about this, causing a warning (which breaks the build with --enable-checking): error: use of logical '&&' with constant operand [-Werror, -Wconstant-logical-operand] } else if ((file->f_flags && O_ACCMODE) != O_WRONLY) { ^ ~~~~~~~~~ .../osi_vnodeops.c:3192:28: note: use '&' for a bitwise operation For the current code without this commit the behavior of this check is as follows: When f_flags is: The check is: ==================== ============= O_RDONLY True (as expected) O_WRONLY False (as expected) O_RDWR False (incorrect) has some non-O_ACCMODE False (incorrect) bit is set The incorrect check doesn't cause any problems for overall correctness, but it does mean that in those cases afs_linux_fillpage will not be called and that partially-written pages will be left out of date and any reader will need to fill the page again. Fix this by using the bitwise &. There is also an out of date link to the Linux documentation. Update the comment to point to the current documentation that is in the Linux source tree. Reviewed-on: https://gerrit.openafs.org/14903 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit 8d9545008240d7f285b140503e432f53f41e0724) Change-Id: Iae459ffe87df9a21a90587c02a1ee2c20b360d33 Reviewed-on: https://gerrit.openafs.org/15129 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit c3f31cc9c3442aca0f6f66ba493ea92bfa46dcca Author: Jan Iven Date: Fri Aug 5 14:46:27 2022 +0200 systemd: do not load the 'openafs' module on boot remove /etc/sysconfig/modules/openafs-client.modules, i.e no longer have systemd run "modprobe openafs" at boot, on RPM-based systems. This had been introduced with a reference to the Fedora packaging guide at the time. However, this mechanism was meant just for persistent driver modules (i.e expected to stay loaded over the runtime) - the "openafs" module is loaded (and unloaded) by the actual systemd unit. The systemd unit that processes the above file comes from "initscripts", this is optional in later Fedoras/RHELs and so the file may not even be processed (/usr/lib/modules-load.d/ would be an alternative mechanism to load modules at boot.. if needed). This change is mostly cosmetic, although RT#135204 showed that having the "openafs" module loaded without a client running can actually be harmful. Reviewed-on: https://gerrit.openafs.org/15092 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit 40b2c6036737a416f3b33624b5abeefa407c1b01) Change-Id: Iea1475217b8ae56accfb4436248011f0b84e0c09 Reviewed-on: https://gerrit.openafs.org/15128 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Stephan Wiesand commit 99f04b1398cc38fc18f7f98cca9d5785218feb0b Author: Cheyenne Wills Date: Thu Jul 14 13:03:08 2022 -0600 linux: Call put_page if errors in aops->readpages Within the address_space_operations readpages function, when we remove a page from the page->lru list, we must ensure that the page reference count is decremented via put_page. There are two cases within the flow of the afs_linux_readpages where we remove a page from the page->lru list, but fail to put_page() it. - If we go through afs_linux_bypass_readpages we fail to call put_page() if the page index is larger than the index calculated from i_size_read for the cache file. - If get_dcache_readahead returns an error in afs_linux_readpages, we fail to put_page(). This can happen if there was a problem opening the cache file, or if the cache file has no a_ops->readpage. Add a call to put_page in afs_linux_bypass_readpages when the page index is greater than the index calculated from the i_size_read for the cache file. Add a call to put_page in afs_linux_readpages if get_dcache_readahead returns an error. Note: The condition of not calling put_page if there was an error opening the cache file was introduced by commit 'LINUX: Don't panic on some file open errors' (af73b9a3b1f), which replaced an assert with code that handled the error. The other conditions have existed since the relevant code was introduced. In addition, the problems addressed by this commit are not present in Linux kernels 5.8 and greater when the commit 'Linux-5.18: replace readpages with readahead' (7a181415db1) is present, because we call afs_linux_readahead instead of afs_linux_readpages. Reviewed-on: https://gerrit.openafs.org/15068 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk (cherry picked from commit 903dd5bf5e9328431e356abc42e20c248c5df6fd) Change-Id: I3679969f985e83a7291a5fb735c80f7d57429c29 Reviewed-on: https://gerrit.openafs.org/15096 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 0ca47d0a03bfc39c064d2a1ae88970c67dc3dbce Author: Cheyenne Wills Date: Tue Jul 5 10:33:19 2022 -0600 Linux-5.19: Remove flags from aops->write_begin The Linux 5.19 commits: fs: Remove aop flags parameter from grab_cache_page_write_begin() (b7446e7c) fs: Remove flags parameter from aops->write_begin (9d6b0cd7) removed the flags parameter from the address space operations 'write_begin' as well as removing the flags parameter from the Linux function 'grab_cache_page_write_begin'. Add an autoconf test to see if grab_cache_page_write_begin takes 2 or 3 parameters. Use this as a test to determine if the address space operations 'write_begin' takes a flags parameter. Create a version of afs_linux_write_begin that does not take a flags parameter, which also calls grab_cache_page_write_begin without flags. Reviewed-on: https://gerrit.openafs.org/15041 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit 52d8df218ff27c139ede221ec4decf593610fc47) Change-Id: I20575c2e9d0979749078f4e3d6f862900c6b6561 Reviewed-on: https://gerrit.openafs.org/15095 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand commit e8f136dd687a7f7ac5296f52739f46dde8c8543e Author: Cheyenne Wills Date: Tue Jul 5 11:45:29 2022 -0600 Linux-5.19: Rename aops readpage to read_folio With Linux commits: mm,fs: Remove aops->readpage (7e0a126519) fs: Introduce aops->read_folio (5efe7448a1) the address space operations method 'readpage' was replaced with read_folio. The operation behaves the same, except instead of taking a struct page parameter, the new function takes a folio structure. Add an autoconf test for the address space operation entry read_folio Replace the references to an address space operations' readpage with read_folio. Note that the function Linux page_folio can be used to obtain the required pointer to the folio for a given page. Introduce afs_linux_read_folio that accepts a folio and calls afs_linux_readpage with the page associated with that folio. Reviewed-on: https://gerrit.openafs.org/15040 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk Reviewed-by: Michael Meffie Tested-by: BuildBot (cherry picked from commit bfb852197edcbe0c38c499faecd7c1be23308a20) Change-Id: Iab96bd10a143d88fe37ac8aa8980b33339c76852 Reviewed-on: https://gerrit.openafs.org/15094 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand commit 43c926bf4da3f66f3acc013159fb51072e39efdb Author: Cheyenne Wills Date: Tue Jul 5 10:28:10 2022 -0600 Linux: Introduce file mapping readpage helpers Create a helper function that determines if a file's i_mapping->a_ops->readpage is NULL. Create a helper function that calls a file's i_mapping->a_ops->readpage There are no functional changes with this commit. Note: This commit isolates references to 'readpage' so that future commits can change the name in a more straight forward manner. Reviewed-on: https://gerrit.openafs.org/15039 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit a81f7300f08d6e515adbde4bce4b72a3102b60f9) Change-Id: I9268fd2622ecd48ad6971a8faaeefef8128f4024 Reviewed-on: https://gerrit.openafs.org/15093 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand commit 6997f890445680ecda572778155c900ba9147b7b Author: Cheyenne Wills Date: Mon Jun 27 08:38:25 2022 -0600 Linux-5.18: replace readpages with readahead The linux 5.18 commit 'fs: Remove ->readpages address space operation' (704528d8) removes the address_space_operations operation "readpages", which is replaced with the "readahead" operation that was introduced with the 5.8 commit 'mm: add readahead address space operation' (8151b4c8). When readahead is called, the pages in 'rac' have already been added to the lru caches and are locked. For each page that we get from the 'rac' (i.e. from 'readahead_page(rac)'), we must unlock and put_page the page; if we successfully populated the page with data, we also set PageUpToDate. If we don't process all the pages in 'rac', the caller will handle cleaning up any remaining pages; we don't need to unlock/put them or touch them at all. (See Linux Documentation/filesystems/vfs.rst) Add an autoconf test to detect the presence of 'readahead' in the address_space_operations structure. For the implementation of readahead (which is contained in Linux's osi_vnodeops.c): Add new functions 'afs_linux_bypass_readahead' and 'afs_linux_readahead' as replacements for 'afs_bypass_readpages' and 'afs_linux_readpages' when the linux kernel supports the readahead operation. Notes: In afs_linux_bypass_readahead, the pages are already locked and are already in the page cache, we just need to place the page into the iovecp. The page's refcount will be decremented and will be unlocked when processing the read request. In afs_linux_readahead, the lrupages is needed in case a page is added to the cachefp's mapping in afs_linux_read_cache (which also handles unlocking the page). In afs_linux_readahead, if there is no tdc, we must still unlock the page otherwise the read process will wait on that page. Reviewed-on: https://gerrit.openafs.org/14953 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit 7a181415db1b2142d125714f1dea32879e2ca07d) Change-Id: I2ed4f22bd2b12c76586ae5326841a23735a20af0 Reviewed-on: https://gerrit.openafs.org/15065 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Tested-by: Michael Laß Reviewed-by: Stephan Wiesand commit 45bf0cc73db964f52c74f3b5b09b1de26d79b35f Author: Cheyenne Wills Date: Tue Jun 7 12:19:44 2022 -0600 Prevent sscanf format widths from overrunning array cppcheck noted these instances of sscanf could wipe out the ending null terminator. Length is now macro expanded rather than hard coded and the array itself is one unit longer to avoid the overrun. Reviewed-on: https://gerrit.openafs.org/13136 Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 1162fcdba6c5234f4ac36e17f29e01ae04950004) Change-Id: I1759f4c11df003c6d0798910db9210ff91b95536 Reviewed-on: https://gerrit.openafs.org/15064 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 07b78426fe223b23bbb4739a4f017a49c97b8d29 Author: Cheyenne Wills Date: Tue Jun 21 09:50:41 2022 -0600 opr: replace AFS_STRINGIZE with opr_stringize To avoid adding new includes for afs/afsutil.h in order to use 'AFS_STRINGIZE', create a replacement, 'opr_stringize', in afs/opr.h. Replace the usage of 'AFS_STRINGIZE' with opr_stringize and remove the definition of 'AFS_STRINGIZE' Reviewed-on: https://gerrit.openafs.org/15029 Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit 7f54bbe1568ea66d04bf69f5f083aa0422fcb417) Change-Id: I09fe7ba2191d1522342ac2a935afc40b1c67b7a4 Reviewed-on: https://gerrit.openafs.org/15063 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit f6e6ed4b316378031676d7180b9e71336a3c9f62 Author: Cheyenne Wills Date: Tue Jun 7 11:14:55 2022 -0600 lwp: Ignore dangling-pointer warning in process.c In lwp/process.c the address of a stack variable is saved as part of creating a new context. GCC-12 is flagging the statement with a diagnostic: ./process.c:46:24: error: storing the address of local variable ‘stackvar’ in ‘*savearea.topstack’ [-Werror=dangling-pointer=] 46 | savearea->topstack = (char *)&stackvar; | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ In this particular case, the code is meaning to save the address of the stack in preparation of setting up a new context, which requires knowing the address the current stack. The diagnostic is changed from a warning to an error when configured with --enable-checking. Set the env variable CFLAGS_NODANGLING_POINTER to '-Wno-dangling-pointer' if the compiler supports the option and update the src/lwp/Makefile.in to use the flag when compiling process.c Reviewed-on: https://gerrit.openafs.org/14957 Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 748ae0fc25c51316d741afd9b9dfd479ffdf3250) Change-Id: I03d2d4a77b4a391f023f40e9793968e03a50c241 Reviewed-on: https://gerrit.openafs.org/15062 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit f034932791d9bcf0ed23a79ab1d0913a3e338881 Author: Cheyenne Wills Date: Tue Jun 21 09:57:40 2022 -0600 afs: Avoid always-false NULL test on AFSTOV(avc) GCC-12 is flagging a comparison with the following diagnostic: src/afs/afs_vcache.c:3161:25: error: the comparison will always evaluate as ‘false’ for the address of ‘v’ will never be NULL [-Werror=address] 3161 | AFSTOV(avc) == NULL || vType(avc) == VDIR || | ^~ When the vcache structure does not have the vnode embedded the expansion of the AFSTOV macro results in: ((avc)->v) which tests contents of a 'v'. When the vcache structure does have the vnode embedded, the expansion of the macro results in: (&(avc)->v) which tests the address of 'v', which will never be NULL in this case. Update afs.h to add a new define 'AFS_VCACHE_EMBEDDED_VNODE' when the vcache structure contains an embedded vnode structure. Restructure the preprocessor statements for the AFSTOV definition Avoid testing AFSTOV(x) against NULL when AFS_VCACHE_EMBEDDED_VNODE is defined. The diagnostic is changed from a warning to an error when configured with --enable-checking. Reviewed-on: https://gerrit.openafs.org/14956 Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit 1d1a20c33258a9285a16e85a55df9c0fbf4a3ac2) Change-Id: Ieeb2b958c20aabbb412023c8e60c6d68e961c4b8 Reviewed-on: https://gerrit.openafs.org/15061 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit f5de30623d1442fb3911e2deae4c12507f093ab8 Author: Cheyenne Wills Date: Thu Jun 9 13:20:02 2022 -0600 afs: introduce get_dcache_readahead Relocate the block of code that obtains the dcache for a readahead operation from the afs_linux_readpages function into its own static function. Reviewed-on: https://gerrit.openafs.org/14962 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 44e24ae5d7dc41e54d23638d5f64ab2e81e43ad0) Change-Id: I5fce05cd241dc5a22526d931969cf11da89e3d48 Reviewed-on: https://gerrit.openafs.org/15060 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 5c9ec0359914e641da69b5490150e74d8ce3b8a7 Author: Cheyenne Wills Date: Mon Jun 6 12:27:43 2022 -0600 afs: introduce afs_alloc_ncr/afs_free_ncr There is duplicated code for initializing a nocache_read_request and also freeing the associated storage in certain cases. Create a set of helper functions that allocates and frees a nocache_read_request and its associated structures. afs_alloc_ncr allocates a nocache_read_request structure and if not UKERNEL, will allocate and initialize the associated uio and iovec structures. afs_free_ncr releases a noncache_read_request structure and the associated uio and iovec structures if not UKERNEL. Update locations that allocate/free nocache_read_request structures to use the new functions. Reviewed-on: https://gerrit.openafs.org/14954 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 209eb92448001e59525413610356070d8e4f10a0) Change-Id: Id9c23195e062c720fdbde83a9b5d36fb287aa8a4 Reviewed-on: https://gerrit.openafs.org/15059 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 52061e0670e3ba4571cee887c6a04f6035490c95 Author: Cheyenne Wills Date: Wed Mar 30 11:09:45 2022 -0600 Linux-5.18 replace set_page_dirty with dirty_folio The commits going into Linux 5.18: fs: Add aops->dirty_folio (6f31a5a261db) fs: Convert __set_page_dirty_buffers to block_dirty_folio (e621900ad2) fs: Remove aops ->set_page_dirty (3a3bae50af) replaces the address_space_operations structure member set_page_dirty which with dirty_folio. The linux function __set_page_dirty_buffers is replaced by block_dirty_folio. Nothing within afs uses or implements the set_page_dirty function, however the structure member is required to be initialized. Add an autoconf test for the dirty_folio member and if present, set the address_space_operations member dirty_folio to block_dirty_folio instead of setting the set_page_dirty member. Reviewed-on: https://gerrit.openafs.org/14939 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 6aa129e743e882cf30c35afd67eabf82274c5fca) Change-Id: I8afccecae7971d98f87a65db816c337fb2380854 Reviewed-on: https://gerrit.openafs.org/15058 Tested-by: BuildBot Reviewed-by: Michael Laß Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 1909260bb2cd2028e697f42ebd745e9ac12334d2 Author: Cheyenne Wills Date: Wed May 11 08:48:52 2022 -0600 afsd: Avoid fscanf overflows when paring cacheinfo clang-14 is producing the following diagnostic: afsd.c:581:44: error: 'fscanf' may overflow; destination buffer in argument 3 has size 1024, but the corresponding specifier may require size 1025 [-Werror,-Wfortify-source] fscanf(cachefd, "%1024[^:]:%1024[^:]:%d", tCacheMountDir, fscanf is being used to parse the contents of a file and the buffer sizes are hardcoded. Simply increase the size of the 2 buffers by 1. The diagnostic warning is changed to an error when configured with --enable-checking. Reviewed-on: https://gerrit.openafs.org/14958 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 82c14b9a667174f044b7421e6e081ad323720a67) Change-Id: I81b5563599272b8f224962941d179ae2e93f7f47 Reviewed-on: https://gerrit.openafs.org/15057 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 80be173ac14d02af725c7ee1db9043ae79e6b535 Author: Cheyenne Wills Date: Tue May 24 20:14:36 2022 -0600 vol: Use asprintf in _namei_examine_special GCC-12 is flagging an snprintf statement with a format truncation warning: namei_ops.c: In function ‘namei_ListAFSSubDirs’: namei_ops.c:2029:22: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 511 [-Werror=format-truncation=] Change code to use asprintf instead of snprintf. Return an error if a memory allocation fails. Reviewed-on: https://gerrit.openafs.org/14955 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit ae70db6cde5be5abd3bbbb26bd9af6fe68cc4b6b) Change-Id: I742e0210ac35eec7a143a780db4a6047a0a7c3fc Reviewed-on: https://gerrit.openafs.org/15056 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 05d8ecd96ddab47f449089c2a9627a314d585e1d Author: Cheyenne Wills Date: Thu Jul 16 15:07:15 2020 -0600 autoconf: fix detection for fallthrough attribute Due to bug , ax_gcc_func_attribute.m4 fails to properly detect __attribute__((fallthrough)) in clang. Until this is fixed in autoconf-archive upstream, fix our local copy of ax_gcc_func_attribute.m4, so we can detect __attribute__((fallthrough)) to make --enable-checking work with clang. Reviewed-on: https://gerrit.openafs.org/14273 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 899b1af4183fb09fd55a36e3d10ffbdb9671a47e) Change-Id: Ia7398f958897e326722a77db2e64262212ff3367 Reviewed-on: https://gerrit.openafs.org/15055 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit b18c2f580f5680016dca748a77f64ca4f2778606 Author: Cheyenne Wills Date: Tue Mar 1 15:35:07 2022 -0700 cf: Use -Werror when checking for -Wno-* flags When detecting valid compiler flags clang behaves differently than gcc for certain types of flags. Specifically, gcc will ignore an unknown "-Wno-someflag" while clang will issue a warning. If using clang and --enable-checking is specified, this difference causes a build failure because the warning for the unknown flag is turned into an error. The autoconf macro AX_APPEND_COMPILE_FLAGS (via the underlying macro AX_CHECK_COMPILE_FLAGS) looks specifically for errors and not warnings to determine if the flag is valid. In order to properly catch the above type of unknown compiler flags, a '-Werror' must be passed as an extra-flag. Update the autoconf functions that use AX_APPEND_COMPILE_FLAGS to use '-Werror' as an extra flag when testing for "-Wno-..." flags. Note, for gcc, the test may (incorrectly) think that the compiler supports the given flag, but that is okay, since the flag will be ignored by gcc during the build without raising any warnings or errors. Reviewed-on: https://gerrit.openafs.org/14900 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit 573be0228778873c0d445263fb09989918bea4c1) Change-Id: Ie11cf176d4c88560d5fce9a0c5932d3a0d5dba1e Reviewed-on: https://gerrit.openafs.org/15054 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit e03825bf22c615d7fec18481dc0145b79a3b3e82 Author: Cheyenne Wills Date: Fri Jan 28 14:10:46 2022 -0700 Linux-5.17: Kernel build uses -Wcast-function-type The linux 5.17 commit: "Makefile: Enable -Wcast-function-type" (552a23a0) added the -Wcast-function-type compiler flag for kernel module builds. This change catches a type mismatch in the external files obtained from heimdal: hcrypto/evp.c and hcrypto/evp-algs.c and produces the following type of compile time error messages. src/libafs/MODLOAD-.../evp.c: In function ‘hc_EVP_md_null’: src/libafs/MODLOAD-.../evp.c:501:2: error: cast between incompatible function types from ‘void (*)(void *)’ to ‘int (*)(EVP_MD_CTX *)’ {aka ‘int (*)(struct hc_EVP_MD_CTX *)’} [-Werror=cast-function-type] 501 | (hc_evp_md_init)null_Init, | ^ Use AX_APPEND_COMPILE_FLAGS to create a CFLAGS_NOCAST_FUNCTION_TYPE macro to disable this warning and update the CFLAGS for these 2 files for the Linux libafs build. Update the CODING documentation to add the new exceptions. In addition add a brief description on how to set up autoconf to add a new build macro to suppress compiler warnings. Note: upstream heimdal has committed a fix for this in: hcrypto: Fix return type for null_Init, null_Update and null_Final (fc4b3ce49b) Reviewed-on: https://gerrit.openafs.org/14881 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Andrew Deason (cherry picked from commit 6bdfa976731ce07f3236893ecf12abb9e169b882) Change-Id: Ibd354f663d5876c421a8b4e89b8943c9e3d59ebc Reviewed-on: https://gerrit.openafs.org/14946 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand commit 9e1ac3f56650b8f69735b75a723a493d4630b011 Author: Cheyenne Wills Date: Sun Apr 5 15:51:17 2020 -0600 cf: Use common macro to test compiler flags Use the AX_APPEND_COMPILE_FLAGS macro to test and set compiler specific flags. Remove the OPENAFS_GCC_SUPPORTS_MARCH check entirely (and the associated P5PLUS_KOPTS), since nothing has used it for quite some time. Reviewed-on: https://gerrit.openafs.org/14132 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 790824ff749b6ee01c4d7101493cbe8773ef41c6) Change-Id: I0880abd2e114568cbcf232197efced91bb2ea5e7 Reviewed-on: https://gerrit.openafs.org/15053 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit b34c14dae1ed94bc24580278e90b57df2b92b496 Author: Cheyenne Wills Date: Thu Jul 2 13:39:27 2020 -0600 LINUX: Don't panic on some file open errors Commit 'LINUX: Return NULL for afs_linux_raw_open error' (f6af4a155) updated afs_linux_raw_open to return NULL on some errors, but still panics if obtaining the dentry fails. Commit 'afs: Verify osi_UFSOpen worked' (c6b61a451) updated callers of osi_UFSOpen to verify whether or not the open was successful. This meant osi_UFSOpen (and routines it calls) could pass back an error indication rather than panic when an error is encountered. Update afs_linux_raw_open to return a failure instead of panic if unable to obtain a dentry. Update osi_UFSOpen to return a NULL instead of panic if unable to obtain memory or fails to open the file. All callers of osi_UFSOpen handle a fail return, though some will still issue a panic. Update afs_linux_readpage_fastpath and afs_linux_readpages to not panic if afs_linux_raw_open fails. Instead of panic, return an error. For testing, an error can be forced by removing a file from the cache directory. Note this work is based on a commit by pruiter@sinenomine.net Reviewed-on: https://gerrit.openafs.org/14242 Reviewed-by: Andrew Deason Reviewed-by: Mark Vitale Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit af73b9a3b1fc625694807287c0897391feaad52d) Change-Id: I1e430403561d5b85d6a4094d4bf413a6eca4ff5a Reviewed-on: https://gerrit.openafs.org/15052 Tested-by: BuildBot Reviewed-by: Michael Laß Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit a18f4845cf4f10c0352502e95a1b4b489b37402d Author: Andrew Deason Date: Thu Jan 17 15:45:36 2019 -0600 afs: Introduce afs_IsDCacheFresh Numerous places in libafs check the DV of a dcache against the DV of the vcache for the same file, in order to check if the dcache is up to date and can be used. Consolidate all of these checks into a new function, afs_IsDCacheFresh, to make it easier for future commits to alter this logic. This commit should have no visible impact; it is just code reorganization. Reviewed-on: https://gerrit.openafs.org/13435 Reviewed-by: Benjamin Kaduk Tested-by: Andrew Deason (cherry picked from commit 0d8ce846ab2e6c45166a61f04eb3af271cbd27db) Change-Id: I2d7f63339e0cd6e0df7f4b07000834ac946cb4b7 Reviewed-on: https://gerrit.openafs.org/15051 Tested-by: BuildBot Reviewed-by: Michael Laß Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 524600accb775577bf931577d92aaec1723d2f6c Author: Michael Meffie Date: Wed Jun 29 10:33:23 2022 -0400 Change klog.krb5 -lifetime option help description Change the klog.krb5 -lifetime help description to show this option is ignored. This option name was copied from the krb4 command but is not implemented for the krb5 version. It is retained for command line syntax compatibility. Reviewed-on: https://gerrit.openafs.org/15045 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit f0c9fe7f8983eccf6453e3345de72a0eed649a5a) Change-Id: If2b34f8d9d8e65fb8b6497f0ab01ff1ef6d2196e Reviewed-on: https://gerrit.openafs.org/15047 Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Stephan Wiesand commit 0d53d4170bb3992248db55d990db0ceae03513b2 Author: Cheyenne Wills Date: Thu Jan 27 20:19:17 2022 -0700 Linux-5.17: kernel func complete_and_exit renamed Handle the Linux kernel function rename made in commit "exit: Rename complete_and_exit to kthread_complete_and_exit" (cead1855) Add a new autoconf test for the linux function kthread_complete_and_exit and if not found use a define to map kthread_complete_and_exit to complete_and_exit. Replace calls to complete_and_exit with kthread_complete_and_exit. Reviewed-on: https://gerrit.openafs.org/14882 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit a651d4db7f86a24ea6784f6f27d5c8482667267b) Change-Id: Ibe96b92a84a8f876dda4019c221c37dabde93244 Reviewed-on: https://gerrit.openafs.org/14945 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit fd98e964d6ba0c685d56021dbf61cc3d5d9d9af5 Author: Cheyenne Wills Date: Fri Aug 27 08:20:42 2021 -0600 clang-13: remove unused variables flagged by clang Clang-13 changed the default for the unused-but-set-variable resulting in build warnings/errors with the following type of messages vsprocs.c:3493:25: error: variable 'tentries' set but not used [-Werror,-Wunused-but-set-variable] afs_int32 nentries, tentries = 0; The locations where these local variables are being flagged show that while the variables are being updated, they are actually never used for anything (e.g. used as part of an assignment to another variable, passed as a parameter, used for as returned value, etc.) Remove the variables being flagged by the clang-13 compiler. Removal of these variables will not alter the overall functionality of the code. Reviewed-on: https://gerrit.openafs.org/14775 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit 8333e8e6020331013af912acb92a308e4f5a1dd2) Change-Id: Id5e7c6a323e352106b8f6bf32b7163846c366dec Reviewed-on: https://gerrit.openafs.org/14991 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 588decb457501a8b0d0e65ea9dba726400f9c911 Author: Cheyenne Wills Date: Thu Jul 23 15:43:42 2020 -0600 clang-10: ignore fallthrough warning in generated code Clang-10 will not recognize '/* fall through */' as an indicator to turn off the fallthrough warning due to the lack of a 'break' in a case statement. Code generated by flex uses the '/* fall through */' comments to turn off compiler warnings for fallthroughs in case statements. For code generated by flex, ignore the implicit-fallthrough via pragma or disable the warning via a compile time flag. Add new env variable "CFLAGS_NOIMPLICIT_FALLTHROUGH" to selectively disable the compile check in Makefiles when checking is enabled. Reviewed-on: https://gerrit.openafs.org/14275 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit e5f44f6e9af643cab3a66216dff901e0a4c5eda8) Change-Id: Ibe1b95e6784ca8b422378cf2896bdc7f1a6d8e61 Reviewed-on: https://gerrit.openafs.org/14990 Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 7c8127c5a12a94457251b35643a9fa2f284d2a11 Author: Andrew Deason Date: Wed Jul 10 12:42:54 2019 -0500 LINUX: Honor --enable-checking for libafs When we build the kernel module on LINUX, we don't pass in any of our CFLAGS, since the Linux buildsystem itself figures out what flags are needed. However, this means that we don't pass in -Werror when --enable-checking is turned on, so warnings may not cause the build to fail. To fix this, create a new autoconf variable, called CFLAGS_WERROR, that only contains -Werror if --enable-checking is turned on. We then pass that into the Linux module buildsystem, so -Werror is given to the compiler when building our module. Reviewed-on: https://gerrit.openafs.org/13682 Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 6e0f1c3b45102e7644d25cf34395ca980414317f) [cwills@sinenomine.net] On master gerrit 14106 comes after this commit. In the 1.8.x branch the 14106 commit is already pulled in (gerrit 14217) which causes a conflict due a difference ('-fno-common') in the line above the change in osconf.m4. Change-Id: I4e49d5c5fdf26399eb04d2f76196f3c3f4e7baf6 Reviewed-on: https://gerrit.openafs.org/14989 Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 0cb26f198c6e049171b698098afab82203848434 Author: Michael Meffie Date: Fri Sep 3 07:05:36 2021 -0400 ptserver: Fix CreateEntry() stringop-overflow warnings The CreateEntry() prototype has been fixed to match the function definition, so callers are expected to provide bounded arrays for the user or group name. Fix the InitialGroup() macro which is used to set the built-in names using string literal to avoid stringop-overflow warnings. error: ‘CreateEntry’ accessing 64 bytes in a region of size 22 [-Werror=stringop-overflow=] code = CreateEntry(tt, (name), &temp, /*idflag*/1, flag, SYSADMINID, SYSADMINID); \ note: in expansion of macro ‘InitialGroup’ InitialGroup(SYSADMINID, "system:administrators"); note: referencing argument 2 of type ‘char *’ note: in a call to function ‘CreateEntry’ CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], ... (Repeated for "system:backup", "system:anyuser", "system:authuser", "system:ptsviewers", and "anonymous".) Reviewed-on: https://gerrit.openafs.org/14789 Reviewed-by: Benjamin Kaduk Tested-by: Benjamin Kaduk (cherry picked from commit 7924aecf95bf4918a485a041f2426bd1fa407ac8) Change-Id: I6e30729f1b24beb1ed1c4b6d9162b347285b7edc Reviewed-on: https://gerrit.openafs.org/14987 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 07704dc7b4a58a05e921d374302a3026fa95a44e Author: Michael Meffie Date: Mon Aug 23 15:42:52 2021 -0400 libadmin: Fix isAlias may be uninitialized warning The cfgutil_HostNameIsAlias() function has an output parameter called isAlias, which is used when cfgutil_HostIsAlias() returns non-zero. However, it possible for isAlias to not be set before returning. GCC 12 issues a warning about the possible use of the uninitialized isAlias variable: cfginternal.c:366:32: error: ‘isAlias’ may be used uninitialized [-Werror=maybe-uninitialized] Initialize the cfgutil_HostNameIsAlias() isAlias output flag to false. Also, fix the misleading code indentation around the cfgutil_HostNameIsAlias() call. Reviewed-on: https://gerrit.openafs.org/14772 Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 4a8d0c4089078fb3df9cc06b595c80c9b4c2ca7f) Change-Id: I4cadcb4380962e47213fcfd310c1cac331100f65 Reviewed-on: https://gerrit.openafs.org/14986 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 1f868e7bdde59440695f5b2e99aa562f953250ad Author: Michael Meffie Date: Mon Aug 23 15:37:13 2021 -0400 bucoord: Fix doDispatch() array-parameter gcc warning The doDispatch() prototype does not match the function definition. The targv parameter is declared as an unbounded array in the prototype, but is defined as a bounded array. As of GCC 12, a warning is issued for the mismatch. main.c:346:18: error: argument 2 of type ‘char *[100]’ with mismatched bound [-Werror=array-parameter=] bucoord_internal.h:123:40: note: previously declared as ‘char *[]’ Within doDispatch(), the targv argument is just passed to cmd_Dispatch() (this is the only use of targv). Since cmd_Displatch() expects an unbounded array, update the doDispatch() definition to match the prototype. Reviewed-on: https://gerrit.openafs.org/14771 Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 92a6242de2d8ea280debc283a7c089f97c1670bc) Change-Id: Idc674dccac5adcbe610e059463e493716cf80f57 Reviewed-on: https://gerrit.openafs.org/14985 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 3a32158d000a29c8ca7282db02ffb27c6f2a892d Author: Michael Meffie Date: Mon Aug 23 15:33:19 2021 -0400 Fix PrintInode() mismatched array parameter warnings The PrintInode() prototypes do not match the function definitions. When AFS_64BIT_IOPS_ENV is defined (which is the common case and is required for namei), the buffer parameter is declared as a bounded character array (afs_ino_str_t) in the prototype, but is defined as an unbounded character pointer. When AFS_64BIT_IOPS_ENV is not defined (for legacy 32-bit inode vice partitions), PrintInode() is declared with no specified parameters. A static buffer is used to hold the formatted string when a NULL is passed as the first argument to PrintInode(). However, this method is only used by the volinfo and iopen utility programs. Fix the mismatch function prototypes and definitions to use the bounded char array (afs_ino_str_t) in all cases. Remove the deprecated function declaration with no specified parameters. Update vol-info and iopen to pass an afs_ino_str_t buffer and remove the now unused static buffer. Update the duplicated PrintInode() function definition in namei_ops.c. (This duplicated code could be removed in a future commit.) Reviewed-on: https://gerrit.openafs.org/14770 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk (cherry picked from commit a1e57d2e42b6d01e5ece93d5d49a4b9f3ecd3edc) Change-Id: Ia8685805513c2c17e9253d83aa471718a09a449a Reviewed-on: https://gerrit.openafs.org/14984 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand commit c6b47f77dc27c4624c3348c8de0aee8f0ed15970 Author: Michael Meffie Date: Mon Aug 23 19:43:45 2021 -0400 pts: Fix stringop-overflow warnings The ptutil functions are defined to accept bounded character arrays for user and group names. As of GCC 11, callers which provide the names as string literals now trigger the stringop-overflow warning, since the regions provided by the string literals are smaller than the bounded areas. error: ‘pr_ChangeEntry’ accessing 64 bytes in a region of size 1 [-Werror=stringop-overflow=] note: referencing argument 4 of type ‘char *’ error: ‘pr_IsAMemberOf’ accessing 64 bytes in a region of size 22 [-Werror=stringop-overflow=] note: referencing argument 2 of type ‘char *’ error: ‘pr_CreateUser’ accessing 64 bytes in a region of size 16 [-Werror=stringop-overflow=] note: referencing argument 1 of type ‘char *’ error: ‘pr_Delete’ accessing 64 bytes in a region of size 16 [-Werror=stringop-overflow=] note: referencing argument 1 of type ‘char *’ Update the callers in pts and testpt which pass literal strings. Instead of passing char pointers to literal strings, assign the strings to prname buffers and pass the prname buffers to the pr utility functions. Reviewed-on: https://gerrit.openafs.org/14769 Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit a3aac5106beddc5a6f7a09c2d21c2524342aca01) Change-Id: I38883cdf9c6db701370b3c6755ca28e50f618c82 Reviewed-on: https://gerrit.openafs.org/14983 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 8765514b2ac7c258646fa446dca3040a23be4da4 Author: Michael Meffie Date: Tue Aug 24 16:40:22 2021 -0400 ptserver: Fix CreateEntry() mismatched array parameter warning The CreateEntry() prototype does not match the function definition. The aname parameter is declared as an unbounded array in the prototype but is defined as a bounded array. As of GCC 12, a warning is issued for the mismatch. error: argument 2 of type ‘char[64]’ with mismatched bound [-Werror=array-parameter=] CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], ... note: previously declared as ‘char[]’ extern afs_int32 CreateEntry(struct ubik_trans *at, char aname[], ... Fix the prototype to declare the 'aname' parameter as a bounded array as expected for this function. Reviewed-on: https://gerrit.openafs.org/14768 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit fe64ddd3b49bf15222d32d443ff226dd4c2b899e) Change-Id: If29ada7f9460591de8d2b61c17d00090465625b2 Reviewed-on: https://gerrit.openafs.org/14982 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 5a1944282e77c681c30ddf12f41fc8e07efee3ea Author: Michael Meffie Date: Mon Aug 23 14:23:01 2021 -0400 ubik: Fix ubeacon_updateUbikNetworkAddress() mismatched array parameter warning The ubeacon_updateUbikNetworkAddress() prototype does not match the function definition. The ubik_host parameter is declared as an unbounded array in the prototype but is defined as a bounded array. As of GCC 12, a warning is issued for the mismatch: error: argument 1 of type ‘afs_uint32[256]’ {aka ‘unsigned int[256]’} with mismatched bound [-Werror=array-parameter=] ubeacon_updateUbikNetworkAddress( afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR]) note: previously declared as ‘afs_uint32[]’ {aka ‘unsigned int[]’} extern int ubeacon_updateUbikNetworkAddress(afs_uint32 ubik_host[]); Restore the ubik_host array length in the function prototype, which was dropped in commit 9020e6e2f0357b1082705dcaa6626573433969ec (ubik: Defer updateUbikNetworkAddress until after RX startup). Reviewed-on: https://gerrit.openafs.org/14767 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 36796bbb83af2650a872234fdb5cf7124bf6cfa8) Change-Id: Ia27b5b9642dbd355e1310419424ed0ac04add4b2 Reviewed-on: https://gerrit.openafs.org/14981 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 0130ff6fc4f6ca0f85346941f39c9fe3eea6e3aa Author: Michael Meffie Date: Mon Sep 10 23:47:33 2018 -0400 klog.krb5 -lifetime is not implemented The klog.krb5 -lifetime option was copied from earlier versions of log and klog, which had the ability to set the krb4 token lifetime. However, the -lifetime option is not feasible the krb5 version, and so is not implemented in klog.krb5. Update the klog.krb5 man page to document the -lifetime option has no effect. Remove the code which unnecessarily checks the unused klog.krb5 -lifetime command line argument. The unused lifetime variable was discovered by Pat Riehecky using the clang scan-build static analyzer. Reviewed-on: https://gerrit.openafs.org/13309 Tested-by: BuildBot Reviewed-by: PatRiehecky Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit da699c8b81e818ba97ff8115397d7f7afe0bf512) Change-Id: I81cd0024f4727ba401df7b5813163b11f9b43bd4 Reviewed-on: https://gerrit.openafs.org/14980 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 7d4f5fe3e2f8009ebfa45626f104b61cf9c6c924 Author: Michael Meffie Date: Mon Oct 1 11:38:37 2018 -0400 ubik: do not reuse the offset variable for the sync site address The ubik SendFile function performs a sanity check of the host address before proceeding with the file transfer. Currently this check reuses the file offset local variable to hold the value of the sync site address, a 32-bit IPv4 address. Not only is this confusing, but also causes a signed/unsigned type mismatch when comparing host addresses. Instead of being so stingy with local variables, declare a new local variable of the correct type to hold the value of the sync site address. This separation is also a prerequisite for supporting larger address types in the future. Reviewed-on: https://gerrit.openafs.org/13351 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit f0bab78cbe4f59609fa18647a480cc6989948786) Change-Id: I2bda69a2586628b51e84c3facf116bf652e3df0a Reviewed-on: https://gerrit.openafs.org/14979 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 1c5c7eba38dc510bf571225e3feeba9b7565bd27 Author: Andrew Deason Date: Thu Mar 24 12:04:13 2022 -0500 afs: Remove redundant AFS_LINUX_ENV test After our Linux checks were converted to AFS_LINUX_ENV in commit 6329a523 (Change AFS*_LINUXnn_ENV to AFS*_LINUX_ENV), the extra AFS_LINUX_ENV check in this line doesn't make any sense. Get rid of it. Reviewed-on: https://gerrit.openafs.org/14935 Reviewed-by: Marcio Brito Barbosa Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit a7d04f0770beb08ea7db2dcdc3dee80b2a57233a) Change-Id: I797e1d677cc758d0475011167c0cbafeedf9788c Reviewed-on: https://gerrit.openafs.org/15037 Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk Reviewed-by: Stephan Wiesand commit 147d3bf945f5f3c5135a372a91d079c8ef99fb50 Author: Cheyenne Wills Date: Thu Jun 2 11:17:45 2022 -0600 Cleanup AFS_*LINUX_ENV usage Commit 6329a523f6305541871bc3d1694065e7b17abe77 changed all occurrences of AFS_*LINUXnn_ENV to AFS_*LINUX_ENV, but did not perform any refactoring of the use of these variables. This commit completes the task by refactoring the preprocessor conditionals that involved removing dead code or collapsing statements. The updates should have no functional changes. Reviewed-on: https://gerrit.openafs.org/14388 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit cbc18e4b311bdd2c461f60b7b96eb2ab8a6d1ee5) Change-Id: I02e9f0cab5e60994c67593b0709ae1e500d23545 Reviewed-on: https://gerrit.openafs.org/14978 Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand commit 43644792092698ace05a6e96bf58464d7837abdd Author: Cheyenne Wills Date: Thu Jun 2 11:19:32 2022 -0600 Change AFS*_LINUXnn_ENV to AFS*_LINUX_ENV The minimum Linux kernel that is now supported is linux-2.6.18. The Linux versioned preprocessor macros AFS_*LINUXnn_ENV are no longer needed to distinguish the different levels of Linux and can be merged into just a single set of macros. Perform a global change of _LINUX\d+_ENV to _LINUX_ENV. e.g. AFS_LINUX24_ENV -> AFS_LINUX_ENV AFS_USR_LINUX24_ENV -> AFS_USR_LINUX_ENV AFS_AMD64_LINUX20_ENV -> AFS_AMD64_LINUX_ENV Replace the multiple definitions for the versioned 'AFS*_LINUXnn_ENV' with just single non-version definitions 'AFS*_LINUX_ENV'. Apart from replacing the now-redundant #define directives and tidying up a few comments at the close of a preprocessor block to match their current form, this commit was done using a mechanical change of the variable names and did not reduce preprocessor statements that could now be combined or eliminated. Nor does this commit remove dead code. A follow-up commit (Cleanup AFS_*LINUX_ENV usage) will handle these changes. The updates should have no functional changes. Reviewed-on: https://gerrit.openafs.org/14387 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 6329a523f6305541871bc3d1694065e7b17abe77) [cwills@sinenomine.net] Conflicts due to: 'afs: Set AFS_VFSFSID to a numerical value' is already in 1.8.x 'Linux 5.15: Convert osi_Msg macro to a function' is already in 1.8.x 'fsint: remove dead code' is not in 1.8.x (removes fsint/afsaux.c) 'Remove rpctestlib' is not in 1.8.x (removes rpc_test_procs.c) Change-Id: I19da50622f63db0fcad7acd834559c538e6030be Reviewed-on: https://gerrit.openafs.org/14977 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand commit a07ac7f818d8c4c79eed096bf57d2a147dc827be Author: Andrew Deason Date: Thu Jun 2 11:11:24 2022 -0600 Remove AFS_PARISC_LINUX24_ENV references Since commit 91713206 (Remove LINUX24 from src/afs), AFS_PARISC_LINUX24_ENV is never defined. Remove references to it. Reviewed-on: https://gerrit.openafs.org/14472 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit e0e0b3cea6305cdbccc71039a05d6121c32c51cf) Change-Id: I4871f5ba6018ab47c78d3f07d4665b5a2676102f Reviewed-on: https://gerrit.openafs.org/14976 Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 49512eb8c94f81ed8611e288008275899ac6bfd2 Author: Andrew Deason Date: Tue Jun 2 13:37:00 2020 -0500 afs: Always define our own osi_timeval32_t Since OpenAFS 1.0, osi_GetTime has taken a timeval-like pointer, which contains 32-bit fields (the actual type has been called either osi_timeval_t or osi_timeval32_t over time). For platforms that have a native timeval-like type with 32-bit fields, we just define osi_timeval32_t to that type, and elsewhere we define our own struct to be osi_timeval32_t. For platforms that use the native timeval, we can then define osi_GetTime() to just be, e.g., microtime(). This approach is difficult to maintain, though, because we must keep track of whether 'struct timeval' contains 32-bit fields on each platform, which can depend on many factors. It's easy to make mistakes (the current tree already contains mistakes), and there's not much benefit. To avoid all of this, just always define osi_timeval32_t to be our own struct with afs_int32 fields, and provide definitions for osi_GetTime that convert from the native time struct to our osi_timeval32_t. This does mean that for some platforms we do an unnecessary type conversion, but this is a small price to pay for more straightforward and maintainable code. To be a little more sure that our types are correct, change osi_GetTime to be defined as an inline function instead of a macro. At the same time, do a similar conversion for the KERNEL implementation of the rx clock_GetTime function. Get rid of platform-specific mess, and do a straightforward type conversion between osi_timeval32_t and struct clock in an inline function. Reviewed-on: https://gerrit.openafs.org/14238 Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit eccd4b9778014c36a4b3af6d9e80194066bd2195) Change-Id: Ia6ccc7ff3e3a7cfb346449c1335e7a045688aebf Reviewed-on: https://gerrit.openafs.org/14974 Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit e01db4d01e6215628edcd13ae76392629424fd97 Author: Andrew Deason Date: Tue Jun 2 13:12:14 2020 -0500 afs: Move osi_GetTime out of param.h Most platforms currently #define osi_GetTime in their param.h. This is really redundant, since the definition of osi_GetTime almost never changes for a given platform, so we end up with many copies of the same osi_GetTime definition for a given platform. Move osi_GetTime out of param.h for these platforms, and define it in osi_machdep.h instead, which is where most platform-specific definitions go. For DFBSD, we don't have an osi_machdep.h at all yet, so create a new one to contain the osi_GetTime definition. Currently we don't build libafs at all on DFBSD, but do this anyway so we don't lose the existing osi_GetTime definition. For NBSD, we were providing (conflicting!) definitions for osi_GetTime in param.h and in osi_machdep.h. Just remove the definitions in param.h, since those should have been getting overridden by the osi_machdep.h definition. Reviewed-on: https://gerrit.openafs.org/14237 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk (cherry picked from commit a5c3dfe99fa1831e3b416e89f52a03fd1cf9f73d) Change-Id: I3afff0c1b4c14649cc072d555d0c3ebd6de8a0fe Reviewed-on: https://gerrit.openafs.org/14972 Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit f792585297f597c5ac6b53afb89d9e66cc387845 Author: Mark Vitale Date: Tue May 5 11:26:00 2020 -0400 UKERNEL: remove redundant declaration of osi_GetTime Commit c861bb0d779b54236b63eda87d9dfaf7792d1659 "Additional UKERNEL headers, prototyping and other fixes" added the following lines to src/rx/rx_prototypes.h: #if defined(UKERNEL) && !defined(osi_GetTime) extern int osi_GetTime(struct timeval *tv); #endif However, this appears to be redundant with the declaration in src/afs/afs_prototypes.h: #ifdef UKERNEL ... extern int osi_GetTime(struct timeval *tv); ... #endif which was added much earlier with commit 8f2df21ffe59e9aa66219bf24656775b584c122d "pull-prototypes-to-head-20020821". Remove the redundant declaration in rx/rx_prototypes.h. No functional change is incurrred by this commit. Reviewed-on: https://gerrit.openafs.org/14192 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 03f44172180563cb9d12d79e5512aae815fee899) Change-Id: I2e562f0e25bf4dd0f47f952782792585a8e7fc20 Reviewed-on: https://gerrit.openafs.org/14975 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit c45808df7c97ff4656d7592c7fef437bd07e9163 Author: Mark Vitale Date: Mon May 18 14:19:25 2020 -0400 Convert all osi_timeval_t to osi_timeval32_t Since commit 130144850c6d05bc69e06257a5d7219eb98697d8 "xstat: cm xstat time values are 32 bit", OpenAFS has had two timeval definitions: osi_timeval_t and osi_timeval32_t. Since they are functionally equivalent, convert all references to osi_timeval_t to osi_timeval32_t. This makes clear that this struct is always expected to contain 32-bit members for tv_sec and tv_usec. There are still a few platforms where osi_timeval32_t is mistakenly defined with 64-bit members; these will be addressed in future commits. No functional change should be incurred by this commit. Reviewed-on: https://gerrit.openafs.org/14215 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk (cherry picked from commit c6eff25be9fc959f666b33425c9ee2635224826e) Change-Id: I55a2ac3d7fb65c3b14aded755cd81056a3775f74 Reviewed-on: https://gerrit.openafs.org/14971 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 00232a56dddd05d257f18e280efcd3ee43f1e2dc Author: Mark Vitale Date: Mon May 4 17:35:05 2020 -0400 UKERNEL: remove dead code osi_SetTime osi_SetTime has been dead code since the original IBM code import. Remove it from the tree. No functional change is incurred by this commit. Reviewed-on: https://gerrit.openafs.org/14191 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit d6101128664918e6fcefbaeb68c4c1d439851411) Change-Id: I8a406e4199b959f7470b53882ee143efb8723d7c Reviewed-on: https://gerrit.openafs.org/14973 Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 7bead34f357ec10f287062206f4056dbfe8adfdb Author: Cheyenne Wills Date: Thu Jun 2 11:18:59 2022 -0600 clang-10: use AFS_FALLTHROUGH for case fallthrough Clang-10 will not recognize '/* fallthrough */' as an indicator to turn off the fallthrough diagnostic due to the lack of a 'break' in a case statement. Clang-10 requires the '__attribute__((fallthrough))' statement to disable the diagnostic. In addition clang-10 is finding additional locations where fall throughs occur. Determine if the compiler supports '__attribute__((fallthrough))' to disable the implicit fallthrough diagnostic. Define a new macro 'AFS_FALLTHROUGH' that will disable the fallthrough diagnostic. Set it as a wrapper for the Linux kernel's 'fallthrough' macro if available, otherwise set it as a wrapper macro for '__attribute__((fallthrough))' if the compiler supports it. Update CODING to document the use of AFS_FALLTHROUGH when needing to fallthrough between case statements. Replace the '/* fallthrough */' comments with AFS_FALLTHROUGH, and add AFS_FALLTHROUGH as needed. Replace some fallthroughs with a break (or goto) if the flow was was just to a break (or goto). e.g. case x: case x: somestmt; somestmt; break; case y: case y: break; break; Correct a mis-indented brace '}' in src/WINNT/afsd/smb3.c Note, the clang maintainers have rejected the use of comments as a flag to turn off the fall through warnings. Reviewed-on: https://gerrit.openafs.org/14274 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit 16f1b2f894c28614df0f096be8232b1176e87c70) [cwills@sinenomine.net Note the fallthrough case in asetkey.c that exists in the original master commit is not present 1.8.x] Change-Id: I4d92d519bd168ac111f46d37bcf7dca7021e5463 Reviewed-on: https://gerrit.openafs.org/14970 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 97b8fe13831d575ada7ea85c794637d1b4dd3493 Author: Cheyenne Wills Date: Thu Jun 2 10:56:39 2022 -0600 Add more 'fall through' switch comments Commit a455452d (LINUX 5.3: Add comments for fallthrough switch cases) added the special /* fall through */ comment to various switch/case blocks, in order to avoid implicit-fallthrough warnings from causing the build to fail when building the Linux kernel module. In this commit, add additional /* fall through */ comments to the rest of the tree where falling through is intentional. Add a "break;" in one place in dumptool.c where falling through seems like a mistake, and flag certain functions as AFS_NORETURN to avoid needing to explicitly break or fallthrough. Check for the availability of the -Wimplicit-fallthrough compiler flag and use it when --enable-checking is set, to prevent additional cases from creeping into the tree. Note: the -Wimplicit-fallthrough compiler flag was added in gcc 7. Reviewed-on: https://gerrit.openafs.org/14125 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 929d501421579290ce1d4f9aabe45980e5458a9a) Change-Id: I57d19d715fe61e9125b0b9efc8ae36934001bb10 Reviewed-on: https://gerrit.openafs.org/14969 Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 249461a7bbe0668137dcafb455c1c0593d90e503 Author: Andrew Deason Date: Tue Mar 31 21:19:18 2020 -0500 vos: Properly print volume transaction flags Currently, the code in 'vos status' treats the 'iflags' and 'vflags' of a transaction like an enumerated type; that is, we only check if 'iflags' is equal to ITOffline or ITBusy, etc. But both of these flags fields are bitfields; any combination of the relevant flags could theoretically be set. Practically speaking, we only ever set at most one of the flags in 'iflags', but if anything ever did set more than one flag, our output would look broken (we'd print "attachFlags:" without any flags). For 'vflags', multiple flags are often set at once: the most common combination is VTDeleteOnSalvage|VTOutOfService. So currently, we usually print "attachFlags:" without any actual flags, since the 'vflags' field isn't exactly equal to VTDeleteOnSalvage (instead it's set to VTDeleteOnSalvage|VTOutOfService). And if we ever did see just VTDeleteOnSalvage set by itself, the way the switch() cases fall through to each other, we'd print out that _all_ flags are set. To fix all of this, just test for the individual flag bits instead. Reviewed-on: https://gerrit.openafs.org/14126 Tested-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk (cherry picked from commit f841c189a53f3a6bcf5c25336e4e0ad5362036e2) Change-Id: Id57d2569bbaa94bb9e7e621cdd16c1e171899362 Reviewed-on: https://gerrit.openafs.org/14968 Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit ee428c60eba4c632de6e8a958a81745a12c76208 Author: Michael Meffie Date: Thu Jun 2 10:48:49 2022 -0600 autoconf: attribute type checks Check for function attributes by type and update src/afs/stds.h to conditionally include the attributes detected, instead of checking for specific compilers and compiler versions. This allows attributes to be used when building under Solaris Studio. Reviewed-on: https://gerrit.openafs.org/12963 Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 1f29c9f05f53966df1bbd9ece479155f78f995e0) Change-Id: I6163e3ebf73c6616dfd3de78e76b14b5907bd4df Reviewed-on: https://gerrit.openafs.org/14967 Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit b075d032c994959fbe84006104f88a5bcf34fd2b Author: Michael Meffie Date: Thu Jun 2 10:47:46 2022 -0600 autoconf: check for format __attribute__ to avoid warnings Building with Solaris Studio generates a ludicrous number of warnings in the form: roken.h, line ...: warning: attribute "format" is unknown, ignored Modern Solaris Studio supports several GCC-style function attributes, including the `noreturn' attribute, however does not support the `format' attribute. Currently, configure defines HAVE___ATTRIBUTE__ when the `noreturn' attribute is available. roken headers conditionally declare printf-like functions with the `format' function attribute when HAVE___ATTRIBUTE__ is defined, leading to the warning messages when building under Solaris Studio. Unsupported function attributes generate warnings, not errors. Fix these warnings by defining HAVE___ATTRIBUTE__ if and only if the `format' attribute is supported by the compiler, instead of checking for `noreturn'. Note that the `format' type is currently the only attribute used by roken at this time. Reviewed-on: https://gerrit.openafs.org/12956 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit f9b3cf888304d42c2a1a8472fdeeab68a7347859) Change-Id: I7ae19fa3d7d90e67d6eb63ef9b51a74a215e9273 Reviewed-on: https://gerrit.openafs.org/14966 Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 96bc48a5730b2dcc14f2abaa8cdb5e433cedbdcd Author: Andrew Deason Date: Sat Apr 4 22:35:07 2020 -0500 Use autoconf-archive m4 from src/external Switch to using the m4 macros from autoconf-archive in our src/external mechanism, instead of manually-copied versions in src/cf. The src/external copy of ax_gcc_func_attribute.m4 is identical to the existing copy in src/cf, so that should incur no changes. There are also a few new macros pulled in, but they are currently unused. Increase our AC_PREREQ in configure.ac to 2.64, to match the AC_PREREQ in some of the new files. Reviewed-on: https://gerrit.openafs.org/14135 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk (cherry picked from commit ca847ddf35e336a8bc3159ce4b26f0162417bbd5) Change-Id: Ifa43b3869e426fada5bd925b0ae002a0f6436232 Reviewed-on: https://gerrit.openafs.org/14944 Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit e2dc2e062886e2cbd10139bbaef8230801153d12 Author: Autoconf Archive Maintainers Date: Tue Apr 7 10:23:16 2020 -0500 Import of code from autoconf-archive This commit updates the code imported from autoconf-archive to 24358c8c5ca679949ef522964d94e4d1cd1f941a (v2019.01.06) New files are: m4/ax_append_compile_flags.m4 m4/ax_append_flag.m4 m4/ax_check_compile_flag.m4 m4/ax_gcc_func_attribute.m4 m4/ax_require_defined.m4 Reviewed-on: https://gerrit.openafs.org/14138 Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit d8205bbb482554812fbe66afa3c337d991a247b6) Change-Id: Ibc18f5ddef8b63ba258fa666ada60577a845aa8f Reviewed-on: https://gerrit.openafs.org/14943 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Stephan Wiesand commit 666510fff2909f81279828cb63cf57dbf74cd29e Author: Andrew Deason Date: Sat Apr 4 22:28:21 2020 -0500 Add autoconf-archive to src/external Add autoconf-archive to the src/external mechanism, so we can more easily import and update the AX_* m4 macros we pull in from autoconf-archive. Commits are imported from . We already have a copy of ax_gcc_func_attribute.m4 in the tree, so include that in the list of files. While we're here, also include a few more macros for checking compiler flags, which will be used in subsequent commits. Reviewed-on: https://gerrit.openafs.org/14133 Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit a072c65bba86cbcd81157e354d3719ac41a2c97d) Change-Id: I785607be9abe85e43287c4880103a365e264473b Reviewed-on: https://gerrit.openafs.org/14942 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Tested-by: BuildBot Reviewed-by: Stephan Wiesand commit e8a2fb80228820ca2c38cb910a129c0a2e436df5 Author: Michael Meffie Date: Fri Mar 16 20:41:35 2018 -0400 autoconf: import gcc function attribute check macro 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 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit b818854f19e33315d1b6453b72a55b54d740e976) Change-Id: I6305bf70715048da7da0d605d4ad4bf5551291c0 Reviewed-on: https://gerrit.openafs.org/14988 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Tested-by: BuildBot Reviewed-by: Stephan Wiesand commit fb767628e7249630b12f709a2af526be0dd133b9 Author: Andrew Deason Date: Sun Dec 22 00:43:07 2019 -0600 FBSD: Use GENERIC kernel headers by default 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 Reviewed-by: Benjamin Kaduk (cherry picked from commit a9c1939eeb36372872f3258a9ae7259a564332c3) Change-Id: I456871c2b55cd3fc1eef7bf68011a725e253b902 Reviewed-on: https://gerrit.openafs.org/14921 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 84324f434d298736e93948ef7cabf3df0d106131 Author: Andrew Deason Date: Wed Jan 1 17:09:24 2020 -0600 FBSD: Avoid recursive osi_VM_StoreAllSegments lock 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 Reviewed-by: Benjamin Kaduk (cherry picked from commit bdd4a0c78b1acaf1c947ca53d16159ef95cc9840) Change-Id: I9f279cef6aef9beff6636edc0cd7cfa5f3d36cfa Reviewed-on: https://gerrit.openafs.org/14920 Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 873dfea8bfdafbbeb9ca965680f3cf793ce14628 Author: Mans Nilsson Date: Thu Dec 16 21:36:22 2021 +0100 Add sysname, files and header entries for FreeBSD 12.3 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 Reviewed-by: Benjamin Kaduk (cherry picked from commit 7a6192276b3779205fa8bc8c141eda41cf28e37e) Change-Id: Id66f9fe5663b33671ba1b9e68b8715a5eacd5da2 Reviewed-on: https://gerrit.openafs.org/14878 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 0453c15b2a2cbef3afacb87a2c5622fc0c539f3e Author: Michael Meffie Date: Tue Aug 4 10:34:07 2020 -0400 tests: Accommodate c-tap-harness 4.7 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 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit 624219a1b2192e5c7b6b45e2cbe784a9c5f33a96) Change-Id: I3a1ed224a6271918711bdd520094df348d7f8cae Reviewed-on: https://gerrit.openafs.org/14880 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand commit 613c71829866efd922759647064e5a2944d5a968 Author: Russ Allbery Date: Mon Aug 3 20:59:25 2020 -0400 Import of code from c-tap-harness 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 Tested-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit 3f377aa117273eba5c77ad652c0b086446b3f874) Change-Id: I7b72d9ebd34d3bb5a05268339e136bb1b4309b92 Reviewed-on: https://gerrit.openafs.org/14879 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand Tested-by: Stephan Wiesand commit dea63972a3bbb889fb978e75540825d8e6786590 Author: Andrew Deason Date: Fri Mar 5 22:20:35 2021 -0600 dir: Explicitly 'make all' in src/dir/test 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 Tested-by: BuildBot (cherry picked from commit c0b7367253eb6c346d577e099a0b0172d4d24ff3) Change-Id: I3c1cc73d88471a31ce2d95325c8dafe797d1c43d Reviewed-on: https://gerrit.openafs.org/14911 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 2d4f2625fce8fdc3491148c51404197de5c4ffc4 Author: Mark Vitale Date: Tue Mar 5 23:11:38 2019 -0500 dir: make dtest buildable again 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 Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 192a2ff49af5dbbb4f8175eec7cb63bfe97e444e) Change-Id: I92df1068c0c071ac643bd8c43eb7e63efdf4f09b Reviewed-on: https://gerrit.openafs.org/14910 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand Tested-by: Stephan Wiesand commit a083a277a7f2407c2378b634c37a6fb13770baf1 Author: Michael Meffie Date: Thu Dec 27 09:32:35 2018 -0500 build: declare test targets as phony Modern versions `make` will not build the 'test' target since a directory exists with the same name. $ grep -C1 '^test:' Makefile test: cd test; $(MAKE) $ make test make: 'test' is up to date. Declare these targets as .PHONY to force make to build the test programs even when the 'test' directory is present. Also use '&&' to concatenate commands instead ';' to avoid running the second command when the first fails. Reviewed-on: https://gerrit.openafs.org/13419 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 0bd55a02bb5707b1b8b26347d5cb6ad71765f622) Change-Id: I4bc8c09720a19658afbab733ea74332083bb29f4 Reviewed-on: https://gerrit.openafs.org/14909 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 97449810aca0448c50e1afa162a24b1cad99a62b Author: Andrew Deason Date: Fri Apr 16 11:11:35 2021 -0500 rx: Remove delays in multi_End_Ignore 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 Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk (cherry picked from commit 002b031d01e3c0f2ad3e1069b98800c3a7228bd5) Change-Id: Ic49c0810bdc9643600a5c060bef4a669798afaf3 Reviewed-on: https://gerrit.openafs.org/14815 Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 7658c64177af38081d61abae63203c8c98b9c95e Author: Andrew Deason Date: Thu Apr 4 16:18:57 2019 -0400 fs: Avoid unnecessary cell DNS lookups 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 Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 4a150387e3151ecdfca8b4f7c732a1e876968279) Change-Id: Ia81eb1e067fe399949d3ea8ae1957e87f6698753 Reviewed-on: https://gerrit.openafs.org/14814 Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 73ebdb11ef16d4f7ead62ce1265c0f59d1a97452 Author: Mark Vitale Date: Fri Jan 29 01:00:56 2016 -0500 afs: clarify cold and warm shutdown logic 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 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (cherry picked from commit a2e03e74c4959f72c90288ec85a40c037c9c6243) Change-Id: I9271c1161f419ea02b9fe43ec46219dce19c9d50 Reviewed-on: https://gerrit.openafs.org/14813 Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 0ef2427d12bb3c07a6dd66ac07bbfe958871e8d4 Author: Michael Meffie Date: Fri Oct 18 13:43:36 2019 -0400 warn when starting without keys 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 Reviewed-by: Cheyenne Wills Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 042f809ccfe12bafed73aa4eb4db2c86737e0b22) Change-Id: I280d3c83b4576684f2035f79d94966bc5a174681 Reviewed-on: https://gerrit.openafs.org/14594 Reviewed-by: Mark Vitale Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit 07c43cb949010b32bec9c7e7769e6b7b40c871ee Author: Cheyenne Wills Date: Thu Jun 2 13:45:27 2022 -0600 autoconf: Remove/update obsolete autoconf macros 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 Reviewed-by: Andrew Deason Reviewed-by: Benjamin Kaduk (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 Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit ec106b0768dc2ce54c48bf5d9799a966ba29a0a9 Author: Pat Riehecky Date: Wed Sep 19 15:51:00 2018 -0500 configure.ac: Add missing double include guard This is primarily a sanity check (identified by clang-tidy). Reviewed-on: https://gerrit.openafs.org/13333 Reviewed-by: Cheyenne Wills Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit ec45ae60536190c2f5fbf272a9acfe0a85824e24) Change-Id: I6cf42d3645fa2669971a3adcd320397afb4cf2bd Reviewed-on: https://gerrit.openafs.org/14964 Reviewed-by: Michael Meffie Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa Reviewed-by: Stephan Wiesand commit f8a2aceb05914908b6a9d3e03c75e3a0c5e1a55c Author: Cheyenne Wills Date: Tue Dec 22 11:06:42 2020 -0700 afs: Cleanup afsincludes.h indentation Clean up the indentation of preprocessor statements Remove commented out code. Reviewed-on: https://gerrit.openafs.org/14471 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 031ebf43a8d4db79ee1aa9aff571094354c548b1) Change-Id: I04c86b8ac8735ec50bf955bb418bb81ee5105afd Reviewed-on: https://gerrit.openafs.org/14931 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand commit 7a03627a64789b6c5fb44def81d4d39df3587d9d Author: Cheyenne Wills Date: Tue Dec 22 11:03:33 2020 -0700 afs: Clean up VNOPS/afs_vnops_attrs.c indentation 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 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 873a5d9e8835b969370f1f031acef60745a0fff8) Change-Id: Ia3c41652e99c44164dec852b0f8ab2f103e8e3c1 Reviewed-on: https://gerrit.openafs.org/14930 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand commit f92508b5f7cbf9562f841d226cc9cd9f345c020b Author: Cheyenne Wills Date: Wed Dec 23 13:25:31 2020 -0700 afs: Clean up afs_init.c indentation 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 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit d7469128ceefbd96b61f32f62fd1e11c3674dac8) Change-Id: Iccf5587e02b3caf0ec6725dc554255366b879d9e Reviewed-on: https://gerrit.openafs.org/14929 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit 97dd85ba97799fe97d424bbdbad9ced6e582ebaa Author: Mark Vitale Date: Sun May 10 22:13:13 2020 -0400 DARWIN: remove vestigial etap_event_t typedefs 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 Reviewed-by: Marcio Brito Barbosa Reviewed-by: Benjamin Kaduk (cherry picked from commit 145c90bdbeeff4ea95acacd7dc110f0c6fcba281) Change-Id: I96cdfe756cb8917079a7cc46d6186e69337caf0d Reviewed-on: https://gerrit.openafs.org/14928 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand commit 8db804eb1ec3f6a4b41dafff31f4805688a3da60 Author: Andrew Deason Date: Thu Jul 18 16:21:10 2019 -0500 afs: Handle osi_NewVnode failures 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 Reviewed-by: Yadavendra Yadav Tested-by: BuildBot (cherry picked from commit ea9e5e8519dc486cfb019447ee5d695de104079d) Change-Id: I2a3c5aac44a57093caee4008b86420ed05c66eb7 Reviewed-on: https://gerrit.openafs.org/14927 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand commit dfc2626e2aac0904c954915ed1d474030414cb78 Author: Mark Vitale Date: Fri Oct 5 10:39:23 2018 -0400 rx: remove rx_atomic bitops The rx_atomic bitops were introduced with commit 1839cdbe268f4b19ac8e81ae78548f5c78e0c641 ("rx: atomic bit ops"). The last (only) reference to them was recently removed with commit 5ced6025b9f11fadbdf2e092bf40cc87499ed277 ("rx: Convert rxinit_status to rx_IsRunning()"). Remove the now unreferenced bitops. This commit is comprised of partial or complete reverts of the following commits: ae4ad509d35 rx: fix rx_atomic warnings under Solaris (partial) c16423ec4e6 rx: fix atomics on darwin (partial) 9dc6dd9858a rx: Fix AIX test_and_set_bit (complete) 1839cdbe268 rx: atomic bit ops (complete) Note: The rx_atomic bitops for Linux systems are known to be broken due to incorrect casting of rx_atomic_t into the unsigned long operand expected by the native Linux bitops. The failure modes include silent overruns on little-endian and incorrect results on big-endian. Do not merely revert this commit in order to bring these bitops back into the tree. Reviewed-on: https://gerrit.openafs.org/13390 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit d0dbd0f12119f0e874ba30adec81061ac6ae27c7) Change-Id: I214ec09c07fb35a4d1dbf9719ec3861bde931638 Reviewed-on: https://gerrit.openafs.org/14926 Tested-by: BuildBot Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand