vos zap currently prints a warning message when a VLDB entry is found
for the volume being zapped:
$ vos zap fs.example.com vicepa 1234
Warning: Entry for volume number 1234 exists in VLDB (but we're zapping it anyway!)
However, vos only checks whether the VLDB entry exists at all, and
doesn't check the location being zapped. If the VLDB entry exists, but
it does not reference the specific server and partition being zapped,
the warning message is still printed, which is confusing.
Update vos zap to print the warning message only when zapping a location
that exists in the VLDB entry, and to print the location we checked. The
warning now looks like:
$ vos zap fs.example.com vicepa 1234
Warning: Entry for volume 1234 on server fs.example.com /vicepa exists in VLDB (but we're zapping it anyway!)
Change-Id: I382d9b3a5960deb06e7774b8ab6a8b36b92cc0a6
Reviewed-on: https://gerrit.openafs.org/15849
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Fix various issues so that building the documentation in doc/xml works
for objdir builds:
- set srcdir=@srcdir@ like all other Makefile's, so VPATH is set
correctly via Makefile.config
- Pass "--path '@abs_builddir@'" to all xml/xsl processors, so they
can find the generated version.xml (otherwise they only look in
srcdir)
- Pass --output when building PDFs, so the generated PDF doesn't go in
srcdir
- Specify $(srcdir) for $(BOOK).xml and generate-xml.pl
- Change generate-xml.pl to find pod2refentry in srcdir instead of '.'
Change-Id: Id09595dba6e70e3d367a26e279446844750d1fd4
Reviewed-on: https://gerrit.openafs.org/15856
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Get rid of our custom bozo_Log() logging interface, and use the
ViceLog/OpenLog logging function that the rest of the tree uses.
This has a side effect of the log now staying open between logging
messages. Previously, the log was open and closed every time we called
bozo_Log(), so log rotations would take effect almost immediately.
With this commit, we now reopen the log about every 5 minutes by
BozoDaemon (BOZO_LOGOPEN_INT).
Change-Id: I35545e4ac067a3339893d31e301e2cdfd5fefec0
Reviewed-on: https://gerrit.openafs.org/14582
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
The setvbuf() function is part of C89, and we require C89 support
from our platforms. Remove the configure check and the corresponding
conditional logic. (As it happens, we were calling setvbuf() without
the conditional elsewhere anyway, via the setlinebuf() macros, so
we should not see any additional breakage from this change.)
Change-Id: Iff850bfbafdb9a17f50410d309d9d9e9be3fa951
Reviewed-on: https://gerrit.openafs.org/15841
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
It is only used in cronbnodeops.c.
Change-Id: I9b1c5b6d62c32fa53724e7096f29354694f90a7e
Reviewed-on: https://gerrit.openafs.org/15831
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
FreeBSD commit 478368ca410fbfe4ec98e187cae6317bf3d29498 (vfs:
eliminate v_tag from struct vnode) removed the v_tag field from struct
vnode. We only use this when printing out info about a vnode, so just
show "[]" when the v_tag field has been removed.
Change-Id: I112e38fd87f049421db08f43081fa7e25aaf3061
Reviewed-on: https://gerrit.openafs.org/15172
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
FreeBSD commit 1493c2ee62b8cbd8dbe70670b9108b4b9c36e032 (Make
vop_symlink take a const target path.) changed the 'target' argument
of vop_symlink to be a 'const char*' (from 'char*'). This causes a
warning:
.../src/afs/FBSD/osi_vnodeops.c:1099:44: error: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
afs_symlink(VTOAFS(dvp), name, ap->a_vap, ap->a_target, NULL,
^~~~~~~~~~~~
.../src/afs/afs_prototypes.h:1328:37: note: passing argument to parameter 'atargetName' here
struct vattr *attrs, char *atargetName,
Just cast to 'char*' explicitly to get rid of the warning.
Ideally we would change afs_symlink() to accept a 'const char*', but
that involves a lot of changes to cross-platform code; keep things
simple for now.
Change-Id: Iaa2d18a3168827c45908d44328f90425c9d1cb12
Reviewed-on: https://gerrit.openafs.org/15171
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
FreeBSD commit 19e09f447fd9bbbc7e8b0271dfee7c74e9417047 (Remove
obsoleted KPIs that were used to access interface address lists.)
removed if_addr_rlock() and related functions. Instead, callers are
supposed to enter the net epoch, which is what if_addr_rlock() was
doing before it was removed. Change our callers to do this, adding new
wrappers AFS_IF_ADDR_*() to do the right thing.
Ideally we would enter the net epoch just once, outside of the parent
for() loop, but doing this on each entry makes it simpler to handle
the if_addr_rlock and non-if_addr_rlock cases.
Change-Id: I36817dd54098e830e15ce6b796bf1714fa9c2753
Reviewed-on: https://gerrit.openafs.org/15170
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
FreeBSD commit a68cc388790587b330a01380a0c1864fb9ff3f1e (Mechanical
cleanup of epoch(9) usage in network stack.) changed NET_EPOCH_ENTER()
and related macros so that we must pass in a struct epoch_tracker.
Previously these macros declared their own epoch_tracker in the macro
and used it; to keep things simple, change our RX_NET_EPOCH_*() macros
to do the same, since our callers are all simple and fine to declare
vars in.
Change-Id: I1564ba7dd6e0dacc3a4532fe03709e74f3c1e019
Reviewed-on: https://gerrit.openafs.org/15168
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
FreeBSD commit cc3593fbd953e2eeec72dbca05e77632817cba0b (vfs: rework
vnode list management) removes VI_FREE. Our only user of VI_FREE is
some extra debug logging, so just pretend the flag isn't set if
VI_FREE isn't defined.
Change-Id: I77cc13683602bc1c1b920331847153371fbf4969
Reviewed-on: https://gerrit.openafs.org/15167
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
FreeBSD commit 756a5412798b7de1709bb1de2db5ba2a5908cba3 (Allocate
pager bufs from UMA instead of 80-ish mutex protected linked list.)
removed getpbuf() and related functions; callers are supposed to use UMA
allocator functions instead. Use a private zone allocated by
pbuf_zsecond_create() like other filesystems do, and make our callers go
through new abstractions afs_getpbuf() and afs_relpbuf() to use the
right functions.
Change-Id: I303e9f848485481adb94ef5c7db5885f22288003
Reviewed-on: https://gerrit.openafs.org/15165
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
FreeBSD commit b249ce48ea5560afdcff57e72a9880b7d3132434 (vfs: drop the
mostly unused flags argument from VOP_UNLOCK) removed the second
argument to VOP_UNLOCK(). Change all callers to go through a
AFS_VOP_UNLOCK() wrapper, and use the 1-argument version when
appropriate. Get rid of the extra unlock_vnode() wrapper in osi_vm.c;
one layer of indirection is enough.
Change-Id: I9929833bb567391a2a1df95a41a3772cdaf4da2c
Reviewed-on: https://gerrit.openafs.org/15164
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
FreeBSD commit abd80ddb9474948fb291becc395d72b40927a32b (vfs:
introduce v_irflag and make v_type smaller) removed the VI_DOOMED
flag, moving the flag to a different field and name. Use the new
VN_IS_DOOMED() macro instead.
Change-Id: I6f064f3313d28abee34481a499cd69890f151f91
Reviewed-on: https://gerrit.openafs.org/15163
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
FreeBSD 13 no longer ships with a standalone assembler (e.g.
/usr/bin/as). But clang can be used as an assembler, so just set AS to
$CC if we don't find an assembler.
Change-Id: I2a30e9ca8a3e2c200a5495e2f996bee27cbb2328
Reviewed-on: https://gerrit.openafs.org/15161
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
FreeBSD commit 6fa079fc3f5e7e120f166420c6f0c60f701ba9ae (vfs: flatten
vop vectors) changed how the .vop_default field in struct vop_vector
works. Previously, we just set .vop_default to a default set of
function pointers (default_vnodeops), and any caller would use that if
any of our function pointers were NULL. After commit 6fa079fc3f,
instead all declared struct vop_vector's must call
vfs_vector_op_register(), which merges the .vop_default contents into
the main struct vop_vector, and so callers can call the needed
function pointer unconditionally. Most filesystems use
VFS_VOP_VECTOR_REGISTER() to do this, which arranges for
vfs_vector_op_register() to be called on boot or module load.
If we don't call vfs_vector_op_register(), then we get a kernel panic
when mounting AFS, since various vnode ops are NULL (such as
vop_lock1). So to fix this, call VFS_VOP_VECTOR_REGISTER() when
available.
Change-Id: I6137e3ed0b21fbda5c3d3df300dfe9ae4cb3925d
Reviewed-on: https://gerrit.openafs.org/15173
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
FreeBSD commit a92a971bbb94ad5b44e2a5bbdc669ad3ae762c8d (vfs: remove
the thread argument from vget) dropped the third arg from vget(),
since it was effectively required to always be the current thread. Use
a small wrapper AFS_VGET() to select the right macro to call.
Change-Id: I9efb0c53d2051555b8c835e991cc3e360982fa3c
Reviewed-on: https://gerrit.openafs.org/15169
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
FreeBSD commit 20d59403961d531467cfab22163f49c131cc8b55 (kernel:
deprecate Internet Class A/B/C) makes it so netinet/in.h only defines
IN_CLASSA() and related macros for non-kernel code (or if
IN_HISTORICAL_NETS is defined). Define IN_HISTORICAL_NETS to restore
the macros for now, so we can still use them in-kernel.
Change-Id: I69c354a88506409ab99b5441c76368c0607c6165
Reviewed-on: https://gerrit.openafs.org/15166
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Add sysnames and param.h files for FreeBSD 13.0 and 13.1.
Note that our param.h does differ from the FreeBSD 12 param.h, in that
AFS_64BITUSERPOINTER_ENV is defined for both UKERNEL and non-UKERNEL.
Otherwise, afs_pointer_to_int() causes warnings when building UKERNEL
(due to newer clang):
.../src/afs/afs_icl.c:680:39: error: cast to smaller integer type 'afs_uint32' (aka 'unsigned int') from 'pthread_t' (aka 'struct pthread *') [-Werror,-Wpointer-to-int-cast]
ICL_APPENDINT32(logp, (afs_int32) osi_ThreadUnique());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
.../src/afs/afs_osi.h:201:28: note: expanded from macro 'osi_ThreadUnique'
^
.../src/afs/UKERNEL/sysincludes.h:230:30: note: expanded from macro 'osi_getpid'
^
.../include/afs/stds.h:282:37: note: expanded from macro 'afs_pointer_to_int'
^
.../src/afs/afs_icl.c:523:41: note: expanded from macro 'ICL_APPENDINT32'
(lp)->datap[(lp)->firstFree] = (x); \
^
Change-Id: I525c2df5981427d3ad1105030331c06fb7a59d78
Reviewed-on: https://gerrit.openafs.org/15160
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Our two 'goto tryagain;' cases in afs_root() have a couple of
refcounting problems:
- If vget() returns an error, but any of the cases in the first if()
statement are true (such as, afs_globalVp does not have CStatd set),
we'll vput() and afs_PutVCache(), but vget() didn't grab a
reference, since it returned an error. So we'll put references we
don't actually have.
- If we enter the first if() block when vget() returns a success, we
vput() the reference we got from vget(), but we also put an
additional reference by calling afs_PutVCache(). If afs_globalVp
still points to this same vcache, this can cause afs_globalVp to
point to a vcache without a ref held for it.
Because of this, if afs_globalVp loses CStatd while we're waiting for
the vnode lock, this can cause the afs_globalVp vcache to not have any
refs held for it, which causes all sorts of other possible problems,
where the usecount for afs_globalVp can drop to 0 when we don't expect
it to.
To fix these issues, remove the extra afs_PutVCache(), and check for
an error from vget() before doing the other afs_globalVp-related
checks.
The relevant code path involved here can be stressed by frequently
causing lookups via /afs/..., while at the same time causing frequent
callback breaks on the root vnode. This can be achieved by using an RW
volume as the root volume (with non-dynroot), and having another
client constantly modify the root directory in that volume while a
FreeBSD client constantly does /afs/... lookups in separate pids.
Thanks to tcreech@tcreech.com for reporting and helping investigate
the relevant issue.
Change-Id: I812d063b3d60ac6eb841863cc7fba3e152393910
Reviewed-on: https://gerrit.openafs.org/14206
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
FreeBSD commit 67d0e29304805e43b17e5c27e5a6c566d800a24c (Replace
OBJ_MIGHTBEDIRTY with a system using atomics...) removed the
OBJ_MIGHTBEDIRTY flag, effectively replacing it with the
vm_object_mightbedirty() function. Use the new function.
Change-Id: Ic4dd47896dd60e4371ffba65648bc6c2e94c1542
Reviewed-on: https://gerrit.openafs.org/15162
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Commit 81ea6544 (FBSD: avoid vrefl()) removed our reference to
vrefl(), since it was only introduced with FreeBSD 11.0. However, it
was replaced with calls to vref() and vrele(), the latter of which can
lock the vnode, and generally is allowed to sleep.
Many osi_vnhold callers hold AFS_GLOCK, which is a non-sleepable lock,
so this can cause a panic if the vnode is VI_DOOMED and locked by
another thread.
To avoid this on at least modern FreeBSD releases, use vrefl() when it
is available (since <https://reviews.freebsd.org/D4953>).
Change-Id: I535af9d58380bb1fd108b8a953b6c26a1c818d94
Reviewed-on: https://gerrit.openafs.org/14796
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
In commit:
'Linux 6.5: Replace generic_file_splice_read' (0e06eb78f2)
we check the version of Linux to determine to use the newer
filemap_splice_read() or the older generic_file_splice_read().
openSUSE 15.6 uses a Linux 6.4 kernel, but is also including the
Linux 6.5 commit:
'splice: Remove generic_file_splice_read()' (c6585011bc)
When this commit included in Linux 6.4, the kernel module fails to
build.
In order to handle the case where Linux distributions are including the
(c6585011bc) commit in earlier kernels, we need to see if
generic_file_splice_read() is present; if not, we should use the newer
filemap_splice_read().
With the (0e06eb78f2) commit there was a preference for using
generic_file_splice_read() over filemap_splice_read() until Linux 6.5
(which contained additional updates surrounding filemap_splice_read()).
See the (0e06eb78f2) commit for additional details.
With this commit, we are still preferring generic_file_splice_read()
when it is available on kernels less than Linux 6.5.
Change-Id: Idfc75e474d4e21a9375ee115dad0929bad482e27
Reviewed-on: https://gerrit.openafs.org/15846
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
DirAccessOK() currently uses two static vars (lastTime, lastResult) to
cache the result of the function to avoid overly-frequent stat()s. These
are not documented as being protected by any locks. Currently they
cannot be accessed by two different threads at the same time; the only
callers are:
- SBOZO_GetInstanceInfo(), which calls it with BNODE_LOCK held
- main(), which calls it before our rx service threads are started
But this is fragile and not documented. To avoid potential issues in the
future, document DirAccessOK() as requiring BNODE_LOCK, assert that we
have BNODE_LOCK in DirAccessOK(), and acquire BNODE_LOCK before calling
DirAccessOK() from main().
While we're here, move the declarations for the two static vars so
they're next to each other, so it's a little more obvious that we have
some static variables here.
Change-Id: I4e0e55cd8a7ebbb681e4da937efcc9c37633e3ab
Reviewed-on: https://gerrit.openafs.org/15837
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
The grammar.y file uses a series of strcat's to build the accesslist
from the parsed tokens. There is no checking to see if the result
exceeds the size of the output buffer.
Replace the strcpy/strcat's with a simple snprintf that concatenates
the tokens, and check to see if the snprintf failed.
If there was an error concatenating the tokens, emit a message.
NOTE: With --enable-checking a build error occurs on an Ubuntu 24.04
system, where the default _FORTIFY_SOURCE is set to 3 (hardened). The
build produces the following:
...
inlined from ‘yyparse’ at ./grammar.y:130:26:
/usr/include/.../string_fortified.h:130:10: error: ‘__builtin___strcat_chk’ writing 2 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
130 | return __builtin___strcat_chk (__dest, __src, __glibc_objsize (__dest));
...(repeated for the other uses of strcat)...
The build error can be duplicated by setting _FORTIFY_SOURCE to 3.
Change-Id: I97e8a562f12d2a9f60a31d3b5a6f77a8458e7275
Reviewed-on: https://gerrit.openafs.org/15845
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
The section 3 man pages are missing in the AdminRef document, so add
section 3 to the Makefile and perl script which generates the AdminRef
doc.
Currently, the only man page in section 3 is the AFS::ukernel, so only
one page is missing.
Change-Id: I3c7401f2eeafa505b9de4545b9d9c4b5cfd617e2
Reviewed-on: https://gerrit.openafs.org/15828
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
The bosserver global bozo_isrestricted is often accessed without any
locks. It's a simple boolean that doesn't need coordination with
anything else, but on pthreads, accessing this from different threads is
technically undefined behavior. To avoid this, convert bozo_isrestricted
to be an rx_atomic_t, which can be accessed safely from different
threads.
Access this global through the new functions bozo_IsRestricted() and
bozo_SetRestricted(), to make it easier to change how we access this
global in the future, if we need to. Change the name of the global to
bozo_restricted and declare it 'static', to try to make sure we haven't
left behind any old users.
Do the same thing for the bozo_restdisable global, too (renamed to
bozo_restricted_disabled), except don't add accessor functions, since
this is only used in a small number of places.
While we could instead make these globals be protected by a lock (such
as BNODE_LOCK()), using atomics is a little simpler, since we don't need
to worry about whether we have obtained the relevant lock.
Change-Id: If8d8dcc2103b084bebb152440ddd52b85cfa26b0
Reviewed-on: https://gerrit.openafs.org/15779
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
The global variables nextRestart and nextDay are only referenced in
BozoDaemon(), a function that never returns. There is no reason for
these to be globals, so move them to be local variables to make it
obvious that there are no concerns with locking, and no possible issues
with accessing these vars from different functions or different threads.
Change-Id: I38a8fc2227455dc3d7bc2899aa20cfa5475b4ad4
Reviewed-on: https://gerrit.openafs.org/15835
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Adjust our bos and bosserver code to accommodate pthreads:
- Add a new lock (bozo_logLock) to serialize writes to the log.
- Add a global lock (bnode_glock) in bosserver, which is held for all
code that touches bnodes and processes. Acquire this lock for all
entry points into the relevant bosserver code (including all SBOZO_
RPC entry points).
- Make bproc "sleep" using opr_cv_timedwait on bproc_cv/bnode_glock,
and interrupt bproc's sleep by signalling bproc_cv instead of via
IOMGR_Cancel.
- Handle signals via opr softsig in bosserver.
- Use spawnprocve_sig to clear the signal mask when we spawn a
new process, so any mucking around with the signal mask doesn't
leak to the child processes.
- Use sleep() instead of IOMGR_Sleep() in bosserver and bos.
Using a single global lock for the bnode subsystem is a heavy hammer,
but this greatly simplifies the code changes required for pthread
support. Single-core performance has so far been fine for bosserver,
so the practical benefits of finer-grained locking approaches are
small.
Change-Id: I4bf741e04a6f87a1551dd831a20851b56b10d910
Reviewed-on: https://gerrit.openafs.org/10286
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
The AdminRef is a collection of OpenAFS man pages in a single document.
Unfortunately, the man pages are not listed in any particular order, but
rather just the order found by reading the unsorted directory entries.
Change the generate-xml script so the man pages are in sorted order in
the generated AdminRef document. Instead of writing the man page
references after processing each page, save each entry in a list, and
then sort the list after all the pages have been processed.
Also, check the exit code of the pod2refentry script so errors are not
ignored while generating the AdminRef document.
Change-Id: I624485e4efd1fb0c08642b379a12c946f5793336
Reviewed-on: https://gerrit.openafs.org/15827
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
The commit:
"opr: replace MIN/MAX macros with opr_min/opr_max"
(Change I2d7b54193ec91f7ead9c5c5f714d9a8bc7533bf7)
replaced all uses of the MIN and MAX macros with opr_min and opr_max.
The include for sys/param.h and sys/sysmacros.h in rx_packet.h are no
longer needed for MIN/MAX.
Remove the preprocessor conditionals and the includes for param.h and
sysmacros.h.
Change-Id: I8f287b012e17ec5cfd6a44525ecdb5e525e21be5
Reviewed-on: https://gerrit.openafs.org/15823
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
A prior commit:
"opr: replace MIN/MAX macros with opr_min/opr_max"
(Change I2d7b54193ec91f7ead9c5c5f714d9a8bc7533bf7)
replaced all uses of the MIN and MAX macros with opr_min and opr_max.
As a cleanup and to resolve a failure when building the Linux kernel
module with Linux 6.11, remove all the defines for MIN and MAX.
The Linux 6.11 commit:
'minmax: make generic MIN() and MAX() macros available everywhere'
(1a251f52cf)
standardized and consolidated the definitions of the MIN and MAX macros
within the Linux kernel by defining them in an include file that is
widely used already (linux/minmax.h).
With the above Linux commit, the kernel module fails with a redefined
error from the compiler:
"./include/linux/minmax.h:329: error: "MIN" redefined [-Werror]"
Change-Id: Ibcf186d56b3bdeaaf2dc05afe865049182b2ddce
Reviewed-on: https://gerrit.openafs.org/15814
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Introduce new macros, opr_min() and opr_max(), to avoid collisions with
existing MIN()/MAX() macros defined elsewhere.
Within OpenAFS, the MIN/MAX macros are defined in the platform specific
param.h include file. This same file is where AFS_{platform}_ENV is
defined, which is used throughout the OpenAFS source to determine which
platform specific headers are to be used. This can lead to collisions
if platform provided headers define MIN or MAX.
Introduce opr_min and opr_max, using the same definitions that have been
used for MIN and MAX. Put the definitions in opr.h, which is already
included in most of the code that uses the MIN or MAX macros.
Replace all uses of MIN and MAX with opr_min and opr_max.
Add or move the include for afs/opr.h as needed.
Note, this commit does not replace the min()/max() macros.
A later commit will remove the defines for MIN and MAX (which will
correct a Linux 6.11 build failure due to a collision).
Change-Id: I2d7b54193ec91f7ead9c5c5f714d9a8bc7533bf7
Reviewed-on: https://gerrit.openafs.org/15813
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
tests/rx/perf-t and tests/rx/simple-t contain an identical section of
perl code for checking the exit status of the relevant server process.
The spacing around some string concatenations are missing some spaces.
Add the missing spaces.
Thanks to sahilcdq@proton.me and cwills@sinenomine.net for pointing
these out.
Change-Id: Ieca3e6e5eabbd1c65c07edc33f1a884fc0fac248
Reviewed-on: https://gerrit.openafs.org/15848
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Sahil Siddiq <sahilcdq@proton.me>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Commit 004c797daa (tests: Introduce 'make check TESTS=test/name')
removed various $(TESTS) makefile variables from the tests/ directory,
so we can run 'make check TESTS=test/name' and not interfere with the
build.
Later, commit 236cb51b83 (rx: Cleanup and build src/rx/test) changed
src/rx/test to be built by default, but src/rx/test/Makefile.in uses a
variable called $(TESTS).
As a result, now building with 'make check TESTS=test/name' fails, for
example:
$ make check TESTS=rx/simple
[...]
cd src && cd rx/test && make all
make[1]: Entering directory `.../src/rx/test'
make[1]: *** No rule to make target `rx/simple', needed by `test'. Stop.
make[1]: Leaving directory `.../src/rx/test'
To avoid this, rename $(TESTS) to $(BINS), just like commit 004c797daa
did. Also rename the related $(TH_TESTS) to $(TH_BINS) for consistency.
Change-Id: I2cdd4545ee99eb4ed69e8f55341e0ba4dc34d5f3
Reviewed-on: https://gerrit.openafs.org/15847
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Add a test case to rx/simple-t to cover the scenario where the server
aborts the call. To cause an abort, send a message with simple-client
that is longer than MAX_SIZE.
Change-Id: I77a3c74352e7e0226666454ca0646f2419469ab8
Reviewed-on: https://gerrit.openafs.org/15844
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Sahil Siddiq <sahilcdq@proton.me>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
This adds a new test, rx/simple, which runs a simple rx client against a
server process. It does not make use of rxgen-generated RPCs, but
instead runs as a single stream of data on an rx call.
The client creates a new connection to this service and sends a string.
The server performs a simple transformation (rot13) and returns the new
string back to the client.
This commit adds the simple-client and simple-server programs, as well
as the "simple-t" script test driver. These programs serve as a very
simple example of using Rx, as well as a basic functionality test.
Co-developed-by: Andrew Deason <adeason@sinenomine.net>
Change-Id: I78862ecb75a9bb3ccbfef049d11a95182c5e0278
Reviewed-on: https://gerrit.openafs.org/15780
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
afsd prints output to the stdio streams. Usually afsd is run by an init
script or systemd unit, so the output is not directed to the terminal
and the stdio streams are buffered.
When afsd forks child processes, the forked processes inherit the
buffered streams and this causes the output to be duplicated in the
child proceses. For example, when running afsd from systemd, the
journal contains duplicated output messages:
# systemctl start openafs-client
...
... systemd[1]: Starting openafs-client.service - OpenAFS Client Service...
... afsd[292192]: afsd: All AFS daemons started.
... afsd[292170]: afsd: All AFS daemons started.
... fedora systemd[1]: Started openafs-client.service - OpenAFS Client Service.
To avoid the duplicated messages, and to ensure output is captured in
the event of a crash, set the stdout and stderr streams to be unbuffered
using setvbuf() when the afsd process starts.
Thanks to Mark Vitale for diagnosing this issue and to Andrew Deason for
suggesting the use of setvbuf() to set the stream buffering.
Change-Id: I57faac38f6667d431557793ce06a11b7f390a414
Reviewed-on: https://gerrit.openafs.org/15829
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
When systemd tries to stop openafs-client.service during system
shutdown, our 'umount /afs' will fail if someone else is accessing
/afs. The openafs-client.service unit is then marked as deactivated
(and failed), and the shutdown sequence proceeds.
After all services have been stopped, systemd-shutdown tries to kill
all remaining processes with SIGTERM and then SIGKILL, waiting
DefaultTimeoutStopSec seconds (default: 90) for them to die. If there
are unkillable processes running (for example, afsd), this results in
at least a 3-minute delay.
It's hard to make sure there are no processes accessing /afs during
the shutdown sequence, since that could include processes outside of
defined systemd units. So some processes may be shutting down in
parallel with openafs-client.service, and so it's a race whether there
are /afs-using processes when we try to umount /afs.
To avoid the most common cases of this, retry our umount during
openafs-client's ExecStop for $UMOUNT_TIMEOUT seconds (default: 30),
to give other /afs-using processes a chance to go away. Only do this
if the system is shutting down (according to 'systemctl
is-system-running'), so users don't see a long delay running
'systemctl stop openafs-client' during normal system operation.
Written in collaboration with cwills@sinenomine.net.
Change-Id: I5755dbf4cddf4204ed6836f9f4f21c00133fcb39
Reviewed-on: https://gerrit.openafs.org/15633
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Our openafs-client.service systemd unit currently has some unfortunate
behaviors:
- If someone runs 'systemctl stop openafs-client' and someone is using
/afs, our umount will fail, and systemd will consider the
openafs-client unit failed and deactivated. Trying to stop the unit
again won't do anything, and trying to start the unit will fail
because of our 'fs sysname' check. The client can then only be
stopped by manually running umount/rmmod.
- If our kernel module is already initialized (because afsd failed
during startup, or someone 'umount'd /afs without unloading the
kernel module), running 'systemctl start openafs-client' will try to
start afsd with an already-initialized kernel module, which will
either fail or cause errors/panics.
To improve this situation, change our startup sequence to unload the
kernel module if it's already loaded (and then load it again right
afterwards). This should guarantee that we won't use an
already-initialized kernel module when we run afsd. This also means we
will fail during startup if the kernel module cannot be unloaded for
any reason (for example, if the client is already running but the 'fs
sysname' check somehow didn't detect this).
Also change our 'fs sysname' check to return success if the client is
already running, instead of failure. This means that after a failed
'stop', the user can run 'start' and then 'stop' again to try and stop
the client. Just running 'stop' again still won't do anything, which
is not ideal, but that's just how systemd works.
Move our 'afsd -shutdown' and 'rmmod' steps into ExecStopPost, so they
may get run in some additional corner cases for a
partially-initialized service.
Add --verbose to a few commands, to make it a little clearer what's
happening in what order in systemd logs.
If we cannot unload the openafs kernel module when stopping (because,
for example, we couldn't 'umount /afs' because it was in use), log some
information about how the user can actually get the client stopped.
Change-Id: I78463160a1835137efaeeb0f27bb19c78171e9da
Reviewed-on: https://gerrit.openafs.org/15647
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Giving NULL as the second argument to realpath isn't supported by some
platforms, including Solaris 10. Pass an allocated buffer instead.
Change-Id: Iec1268906d6a032e1b38b120e54fa5d9c31102c6
Reviewed-on: https://gerrit.openafs.org/15438
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Convert all C files in src/tests to include afsconfig.h and
afs/param.h as the very first includes, like the rest of the tree
does.
Remove references to config.h and HAVE_CONFIG_H; we don't use those.
Change-Id: I07166de1b0c80bf11a91a0758b32fb77cdf779d8
Reviewed-on: https://gerrit.openafs.org/15437
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Since commit: "afscp: Link against opr/roken/hcrypto" (4eeed830fa) added
libroken to the list of libraries used for building in src/tests, the
copy of snprintf.c in src/tests is no longer needed.
Remove snprintf.c from src/tests and update Makefile.in to remove
references to snprintf.o and use the appropriate set of libraries for
the build targets.
Change-Id: I4e67f38d22a4f2e487ad51af752e55ab23a6a526
Reviewed-on: https://gerrit.openafs.org/15341
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
In order to simplify a future change, introduce a Makefile macro that
defines the common libs used.
Add COMMON_LIBS which will initially be set to just $(LIBS).
Replace $(LIBS) with $(COMMON_LIBS) through the rest of the file. Add
$(COMMON_LIBS) to the afscp target.
In addition, split the long lines containing the list of libraries.
There are no functional changes in this commit.
Change-Id: Iaf1ef92fdc7fa6ec4adc0582f714416255c1c972
Reviewed-on: https://gerrit.openafs.org/15396
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Move the logic in our Exec* commands in our openafs-client.service
unit file into a helper script: openafs-client-systemd-helper.sh. This
makes it easier to control our increasingly-complex startup/shutdown
checks (and makes them easier to read), and reduces the clutter in our
openafs-client.service unit file.
This commit does not intentionally change any of our startup/shutdown
behavior yet; this just moves the existing logic into a script.
Update openafs.spec.in to install the helper script.
Change-Id: Iccbb4f7b28b840ee0c38b2cc57d899a1bda8b3e2
Reviewed-on: https://gerrit.openafs.org/15634
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Our openafs-client.service systemd unit file contains a deprecated
option, KillMode=none. Using this option results in the following
message with systemd version 246 or later:
/lib/systemd/system/openafs-client.service:22: Unit configured to
use KillMode=none. This is unsafe, as it disables systemd's
process lifecycle management for the service. Please update your
service to use a safer KillMode=, such as 'mixed' or
'control-group'. Support for KillMode=none is deprecated and
will eventually be removed.
Without this option, if someone runs 'systemctl stop openafs-client'
and the client fails to shutdown (e.g., because files are accessing
/afs), systemd will try to kill all of our afsd processes. Our afsd
processes usually either cannot be killed, or will cause unstable
behavior if they are killed (because e.g. AFSDB requests cannot be
fulfilled).
If systemd cannot kill all of our afsd processes, it will wait for a
timeout before reporting an error. By default, it waits 90 seconds
before sending SIGTERMs, and another 90 seconds before sending
SIGKILLs. This means that by default, if someone is using /afs,
'systemctl stop openafs-client' will hang for 3 minutes (!), even
though we know immediately that we cannot stop the client.
One way to avoid this is using KillMode=none, which skips killing our
processes and waiting for any timeouts. To avoid using a deprecated
option, switch to using KillMode=process.
With KillMode=process, after a failed 'stop', systemd will only try to
kill the 'main' pid run by ExecStart. The 'main' pid is detected by
systemd either automatically by some heuristic (with
GuessMainPID=yes), or by a pid file (when PIDFile= is set). If we
disable GuessMainPID and don't set PIDFile, systemd will not try to
terminate any of our processes on shutdown.
systemd will still try to kill our other remaining processes using
SIGKILL, but we can disable that with SendSIGKILL=no. To be safe, also
specify KillSignal=SIGCONT to make sure systemd doesn't actually
forcibly kill any of our afsd processes.
None of this matters during a successful client shutdown, since then
all of our afsd processes go away after a successful unmount, and
there's nothing to cleanup.
Our behavior during a failed 'stop' is still not ideal. After a failed
'stop', systemd will flag the service as "failed (Result: exit-code)".
This is similar to a service that is stopped successfully
(deactivated), and running 'systemctl stop' on it again does nothing.
Running 'systemctl start openafs-client' will try to start the service
again, but this will fail because of the ExecStartPre check that runs
'fs sysname', and the service will still be considered
failed/deactivated. The only way to fix the situation is for an
administrator to run the shutdown sequence manually, unmounting /afs
and removing the kernel module themselves, and then starting the
client again.
That behavior is unfortunate, but seems difficult or impossible to
avoid with a single systemd service.
Change-Id: Ibed2971f72e4cde2cbeaeefc3ac14325ac8f84e1
Reviewed-on: https://gerrit.openafs.org/15613
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
The SRCDIR_PARENT shell variable is set to the configure process current
working directory. It is used during configure to set the top level
directory variables used in the build; TOP_OBJDIR, TOP_INCDIR,
TOP_LIBDIR. It is also used during configure to specify the path to
generated programs.
However, this variable is redundant with the TOP_OBJDIR variable and the
name can be confusing, since the top build directory is not the source
parent directory when doing out-of-tree (objdir) builds.
Remove the SRCDIR_PARENT variable and set the top directory variables
early in configure. Use TOP_OBJDIR to indicate the path to generated
tools.
Change-Id: Iaf1ce7707e73dd3c8fdf849c9767e8b84401d5a7
Reviewed-on: https://gerrit.openafs.org/15816
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Since the original IBM code import, vol_listLock and vol_sleep_cond have been defined and
initialized, but never used; remove them.
No functional change is incurred by this commit.
Change-Id: Id0e735de5495120035d7a77fd08ee16d33dae8ba
Reviewed-on: https://gerrit.openafs.org/15140
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Since the original IBM code import, h_CheckHosts has zeroed 'zerofid'
but it is not referenced by any other code.
Remove the vestigial code.
No functional change is incurred by this commit.
Change-Id: I56ff2977bd210f2a37abf0b25f5e3aba2da19d85
Reviewed-on: https://gerrit.openafs.org/15101
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
When running afsd with the -memcache option, afsd_run will skip certain
AFSOP_* syscalls that are not needed for a memory cache, e.g.
AFSOP_CACHEINFO and AFSOP_VOLUMINFO. However, afsd -debug output still
misleadingly mentions these syscalls, as if they were about to be
invoked.
For AFSOP_CACHEINFO, this has been true since the original IBM code
import. For AFS_VOLUMEINFO, this was introduced with commit
1307b89188 memcache-no-volitems-20050113.
In order to avoid misleading debug output when running -memcache, move
the afsd_debug() calls under their respective AFSCALL_INIT_MEMCACHE
conditional clauses.
Change-Id: Id13b5fc7c39ccc0836204ecf213f0fe68f666889
Reviewed-on: https://gerrit.openafs.org/15566
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>