Andrew Deason [Wed, 20 Jul 2011 21:50:52 +0000 (16:50 -0500)]
libafs: Rate-limit hard-mount waiting messages
Limit how often we log "hard-mount waiting for XXX" messages. Without
this, it is possible for a client with hard-mounts enabled to spam the
kernel log rather excessively (in extreme cases this can even panic
the machine on at least some Linux).
To keep things simple, just log approximately one message per volume
per hard-mount interval.
Simon Wilkinson [Sun, 10 Jul 2011 12:56:21 +0000 (13:56 +0100)]
util: Don't use FT_GetTimeOfDay for MRAFS logs
FT_GetTimeOfDay creates an LWP dependency. For the purpose that we're
using it in serverLog.c, gettimeofday performs identically. So, just
use gettimeofday and reduce our dependencies.
In the startup function for each thread, set a thread name. This
can safely be done unconditionally as LWP builds turn the call into
a no-op. In general, the thread name parallels the name passed to
LWP_CreateProcess, but for Rx server threads, it additionally includes
the thread ID so that these threads can easily be distinguished. (I'm
not sure yet whether doing so will prove to be useful or counterproductive.)
Andrew Deason [Mon, 25 Jul 2011 16:12:37 +0000 (11:12 -0500)]
libafs: Add afs_conn refCount imbalance safeguard
If someone is putting back too many refs, we can detect so very
easily. If we see that such a thing is happening, give a warning and
bail out, instead of risking a panic or memory corruption.
libuafs: don't use a GNU-only feature in a common makefile
$(shell ...) is a GNU Make proprietary feature and shouldn't be used
OS-independent makefiles. There is no need to use it here; command
substitution in the shell is good enough.
because of how the root fid is created we can end up being dumb.
turns out we never want to bypass doing the full pass for root anyway
so just force fixup to not happen.
Andrew Deason [Fri, 22 Jul 2011 21:09:52 +0000 (16:09 -0500)]
libafs: Avoid duplicate afs_Analyze in bulk stat
In afs_DoBulkStat, we can call afs_Analyze multiple times for the same
set of connection objects. Since afs_Analyze puts its reference to the
given afs_conn and rx_connection structures, calling it more than once
can cause the reference counts on those objects to be lower than they
should be.
Instead of making another afs_Analyze call, just alter the error code
inside the normal do/while afs_Analyze loop, so the 'loop' afs_Analyze
call gets the appropriate error code from the first bulk stat'd entry.
Add --with-gssapi*, --with-libintl*, and --with-roken for the new
library location flags. Add --with-docbook2pdf and
--with-docbook-stylesheets for the automatic discovery of tools for
building the documentation. Expand and correct the descriptions of
--with-html-xml and --with-xslt-processor.
Clean and ignore additional build files for DocBook documentation
Depending on what generation method is used for the DocBook
documentation, additional build files may be created. One of those
(*.aux) will cause the build to break if one switches from
docbook2pdf to dblatex without deleting it. Update make clean
and .gitignore to remove and ignore these additional files.
Ben Kaduk [Sat, 23 Jul 2011 18:58:54 +0000 (14:58 -0400)]
FBSD: cast lkmnosys appropriately
lkmnosys is a function, and as such has its own prototype which
includes a named struct specific to it (struct nosys_args). When
comparing its address to an entry in the syscall table, we must
cast it to a sy_call_t to correctly do the comparison, lest gcc
warn us about comparing distinct pointer types without a cast.
This warning recently became an error due to bsd.kmod.mk, so it
causes the build to fail on 8.1 and earlier, which do not use
syscall_register() due to a conflicting entry for our syscall
in syscalls.master.
Simon Wilkinson [Sun, 10 Jul 2011 12:54:20 +0000 (13:54 +0100)]
util: Cleanup generation of dirpath.h
dirpath.h is only copied into place if it has changed. However, this
means that the timestamp of dirpath.h is never updated, causing make to
always trigger the buildrule, even if the rule eventually does nothing.
Instead, always copy in the new dirpath.h, which simplifies the make
rules, and stops make from always building.
Simon Wilkinson [Mon, 4 Jul 2011 09:03:50 +0000 (10:03 +0100)]
klog.krb5: Don't use ubik_PR_NameToID internal func
ubik_PR_NameToID is a low level function which requires a large amount
of setup from the caller. Instead, use pr_Initialize() and pr_SNameToId()
which do all of the work in a library.
Simon Wilkinson [Tue, 15 Jun 2010 15:51:42 +0000 (16:51 +0100)]
ptserver: Don't print undefined value
The readgroup utility printed the wrong variable when listing the
source group - instead of printing the group name, it tried to
print an arbitrary element from the list of group members. Fix it
to print the right thing.
Andrew Deason [Wed, 20 Jul 2011 20:33:41 +0000 (15:33 -0500)]
libafs: Remove unused volume "states" flags
VResort and VMoreReps are not referenced anywhere in the tree, so
remove their definitions. Keep VPartVisible for VICEP-ACCESS, but
lower it to the next unused bit.
the shimmed heimdal in Lion crashes on this call now.
the shim also exports diddly squat. fine, we pick over what
IS exported and use only calls available to us.
Andy Cobaugh [Fri, 15 Jul 2011 16:06:12 +0000 (12:06 -0400)]
rpm: remove postinstall message from openafs-client
Printing out information on how to configure cacheinfo and ThisCell
is a bit noisy, and pam_afs.so is probably not what most people
want to use nowadays.
During Windows OS shutdown the service may be given as little
as six seconds to shut itself down before it will be terminated.
Forced termination will leave the cache file in a dirty state.
This patchset makes several minor changes to reduce the overall
time required for shutdown:
1. do not wait for the IP address change notification thread.
by the time it terminates the ip address has been lost.
2. send give up all callbacks earlier.
3. reorder the daemon thread waits.
4. change the daemon thread loop sleep time to 500ms in order
to prevent the service from waiting up to 10 seconds for
the thread to notice a shutdown is in progress.
When computing whether or not to perform an offline volume
check it is critical that the 'lastBusyVolCheck' variable
be assigned the current time instead of 'lastVolCheck'.
By setting the wrong variable a new offline volume check is
performed every 10 seconds which is undesireable.
Add an explicit message that the shutdown sequence is complete.
This is necessary because during a Windows OS shutdown, the service
is frequently killed prior to the memory mapped file is fully released.
Andrew Deason [Tue, 19 Jul 2011 21:44:21 +0000 (16:44 -0500)]
Revert "afs: Use 64-bit inode numbers"
This reverts commit e1e008338639d6cc0d836ff8079e6fb42021ab9e. Using
64-bit inode numbers can make AFS largely inaccessible to 32-bit
programs that are not compiled with large file support, since the
inode number we provide is not representable in a 32-bit struct stat.
Using 64-bit inode numbers thus can break quite a few programs, and
has little benefit, so don't do it.
Ben Kaduk [Tue, 21 Jun 2011 02:46:01 +0000 (22:46 -0400)]
FBSD: update to using bsd.kmod.mk
We have for a long time had a cobbled-together kernel module build
system that essentially copied build arguments from a kernel build
in an ad hoc fashion, with lots of conditionals on architecture
and OS version. (We got it wrong, several times, too.)
Instead, use the supported mechanism for building kernel modules,
which allows us to remove a lot of code from the Makefile and gives
us some measure of future-proofing.
Ben Kaduk [Sun, 17 Jul 2011 20:24:12 +0000 (16:24 -0400)]
libafs: switch to hardcoded source names with CRULE
Most of the userspace tree uses AFS_CCRULE for how to compile
things. We cannot use this directly for libafs, since in the
general case kernel and userland code may need to be treated
with an entirely different compiler and compiler options.
Switching libafs fully to a (e.g.) LIBAFS_CCRULE would be a substantial
amount of work, and require a lot of testing. However, we can
stop passing -c $? (the out-of-date sources) in CRULE_{NO,}OPT
and add the source file after each invocation of the CRULEs,
an incremental step towards LIBAFS_CCRULE.
This has the extra advantage of not causing issues when integrating
with kernel module build systems that automatically add dependencies
to all object file targets. (In such cases, $? expands to multiple files
and 'gcc -o foo.o -c' bails out.)
Most of this change was automatically generated from the following
awk script:
==========
/[a-zA-Z_0-9].o:/ {path=$2;}
/^ \$\(CRULE_/ {print $0,path;}
!/^ \$\(CRULE_/ {print;}
==========
Ben Kaduk [Tue, 21 Jun 2011 02:35:08 +0000 (22:35 -0400)]
FBSD: use better casts in vop_advlock
In the bsd.kmod.mk world, the compiler bails when we cast a pointer
directly to int. Cast through intptr_t as the supported mechanism.
On amd64, this loses bits, but since this instance is just attempting
to use the value as a unique handle, it is probably okay for now.
However, it should be addressed more properly eventually, when
this locking implementation sees wider use.
Change-Id: I4fe8084c14a97dc4efc8d74e9971b1540c028e40
Reviewed-on: http://gerrit.openafs.org/5034 Reviewed-by: Matt Benjamin <matt@linuxbox.com> Reviewed-by: Garrett Wollman <wollman@csail.mit.edu> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
Ben Kaduk [Sat, 25 Jun 2011 04:33:41 +0000 (00:33 -0400)]
FBSD: Use correct path for ufsmount.h include
The two lines above it already used </ufs/ufs/...> correctly.
In the bsd.kmod.mk world, this will let us get rid of some
more symlink hackery in libafs, since the system's '@' symlink
will point to the system headers directly.
Michael Meffie [Thu, 14 Jul 2011 16:02:21 +0000 (12:02 -0400)]
audit: remove uneeded strncpy
In this caller to krb_realms, when no realms names are returned the
number of local realms is correctly set to zero, however the first
local realm buffer is filled with a placeholder string which is
not used. Remove the uneeded strncpy, which also makes this
section of code consistent with afs_is_foreign_ticket().
This section of code is duplicated by afs_is_foreign_ticket() and
should be consolidated in a subsequent patch.
Change-Id: I48f84934e7321769eebaf80c83b2c100fd026a6a
Reviewed-on: http://gerrit.openafs.org/5020 Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Tested-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
Apply a two-clause BSD license to src/util/pthread_threadname.c. Note
that the claim of copyright in this file refers to the derivative work
consisting of the original code combined with the text of the license.
Simon Wilkinson [Fri, 15 Jul 2011 16:14:27 +0000 (17:14 +0100)]
Make --enable-pthreaded-ubik do what it claims
The configure help text for --enable-pthreded-ubik says
"enable installation of pthreaded ubik applications"
This patch set makes the behaviour in the code match that. Instead
of controlling whether the pthreaded ubik code is compiled at all,
the configure option now just controls whether it is installed. This
means that we'll always build the pthread code, and so should reduce
the number of times it is inadvertently broken.
Simon Wilkinson [Wed, 13 Jul 2011 13:44:39 +0000 (14:44 +0100)]
rxkad: Suppress warnings for ticket5.c
rxkad's ticket5.c includes v5gen.c, a generated file from Heimdal.
This file contains a load of set-but-unused variable warnings. As we
currently have no way of portably suppressing just these warnings,
turn off warnings-as-errors for ticket5.c
Simon Wilkinson [Wed, 13 Jul 2011 13:42:11 +0000 (14:42 +0100)]
volser: fix set-but-unused variable warning
restorevol reads the magic number from the dump, then does nothing
with it. Rather than not reading it at all, just mark the variable that
it is read into as unused to supress the compiler warning.
Throughout cm_server.c, input parameters to functions that
are protected by cm_serverLock are dereferenced by assignment
during variable initialization prior to the cm_serverLock being
obtained. As a result there is a race which can result in
either list corruption or dereferencing freed memory.
Simon Wilkinson [Wed, 13 Jul 2011 13:35:48 +0000 (14:35 +0100)]
vol: Initialise list before error exit when cloning
The inode list wasn't being initialised before the first call into the
error handler. This makes it possible that we end up trying to discard
items from an uninitialised list, with all the chaos that would cause.
Fix things so that this list is correctly set up.
Simon Wilkinson [Wed, 13 Jul 2011 13:33:57 +0000 (14:33 +0100)]
volser: Actually return errors from ListOneVolume
The return code from GetVolInfo was being thrown away, and success
returned to the caller, regardless of the success of this function.
As GetVolInfo's exit codes aren't suitable for sending over the wire,
just return ENODEV if this function returns failure.
Simon Wilkinson [Wed, 13 Jul 2011 13:31:15 +0000 (14:31 +0100)]
Mark nearInode as unused
When we're building an inode fileserver, we use the nearInode hint.
The IH_CREATE macro just throws this hint away if we're building namei,
which leads to compiler warnings about set-but-unused variables. Just
flag nearInode as being potentially unused in order to suppress these
warnings.
Simon Wilkinson [Wed, 13 Jul 2011 13:23:22 +0000 (14:23 +0100)]
Don't split int64s when we don't need to
Now that we're always using an int64, and never a hyper_t, to represent
64bit integers, we can just print them out and assign them using the
native tools, rather than having to call SplitInt64. Simplify our code
to do so, which also avoids some gcc-4.6.0 warnings.
Simon Wilkinson [Wed, 13 Jul 2011 13:02:54 +0000 (14:02 +0100)]
uss: Remove unused variables
Remove assorted unused variables, both those used to capture error
returns, and so unused (but initialised) string pointers, to make
gcc 4.6.0 happier.
Simon Wilkinson [Wed, 13 Jul 2011 13:00:30 +0000 (14:00 +0100)]
libadmin: Remove unused error codes
A number of functions in the libadmin vos implementation set up
error values, and assign them to 0, but never actually use them
for anything (either further assignment, or returning to the user)
So, just remove these unecessary variables, and make gcc 4.6.0 a
little happier.
Simon Wilkinson [Wed, 13 Jul 2011 12:59:05 +0000 (13:59 +0100)]
bozo: Remove unused error codes assignments
This removes a couple of unreported error code assignments. Firstly,
the return from 'setsid' was being assigned to 'ec' and promptly
ignored, and secondly, the response from SendNotifierData was
being ignored. As there is nothing sensible to do with these error
codes, just ignore them properly.
Simon Wilkinson [Wed, 13 Jul 2011 12:57:12 +0000 (13:57 +0100)]
afsmonitor: Fix set-but-unused variable warnings
Tidy up the afsmonitor code to remove gcc 4.6.0's set-but-unused
variable warnings. These are all assignments to error code
values which are never checked, or reported.
Simon Wilkinson [Wed, 13 Jul 2011 12:55:39 +0000 (13:55 +0100)]
libafs: Remove support for length optimisation
At one point afs_StoreAllSegments had an optimisation to speed up
stores. However, that optimistation used the chunkLength without
taking appropriate locks, and was disabled. The variable assignments
which still exist from this code cause errors with gcc 4.6.0, so just
remove them.
Simon Wilkinson [Wed, 13 Jul 2011 12:48:07 +0000 (13:48 +0100)]
libafs: Remove unused DNLC LRU code
The LRU code in osi_dnlc_lookup has never been enabled in OpenAFS,
and causes compilation errors with gcc 4.6.0 - just remove the unused
code and its associated variables.
Simon Wilkinson [Wed, 13 Jul 2011 12:45:33 +0000 (13:45 +0100)]
libafs: Remove unused NAT markeddown code
Remove unused code which used to retry once when a server was
marked down due to a bad NAT. This code has never been enabled
in OpenAFS, and causes compile errors with gcc 4.6.0
util: introduce a common interface for setting thread names
A previous change added support for setting thread names/titles to
viced; this change moves the #ifdef spaghetti to src/util in
preparation for calling it from other places where it would be
useful. Two functions are defined, one for setting an arbitrary
thread's name (as might be done by the spawning thread) and one
for setting the current thread's name; the latter is also defined as
a macro for non-pthreads compilations so that it can be called
unconditionally (the interface does not reference any
pthread-specific data types). Note that some platforms, Mac OS X
in particular, do not allow setting the name of a different thread.
The two functions are defined as no-ops for Windows as our pthreads
emulation layer for Windows does not provide the needed mechanism.
Simon Wilkinson [Wed, 13 Jul 2011 10:53:57 +0000 (11:53 +0100)]
Add make dist and make srpm targets
Add targets to generate distribution tarballs, and srpms, from a tree.
These will generate packages for whatever the current HEAD of the tree
is - if the HEAD is a release tag, then the packages will be named for
that release, if the HEAD is between releases, then git describe will
be used to create an appropriate version identifier.
The tarballs are generated from the current git repository contents,
anything not checked in will not be included.
Remove pre-existing assert macro in hcrypto header.
The config.h header for hcrypto defines an assert macro for
use by RX. OpenBSD already has an assert macro definition so
this new one causes screaming by the compiler about
re-definition. This patch adds the directives to remove any
pre-existing definition of assert, if one exists, prior to
defining the new one.
Simon Wilkinson [Tue, 12 Jul 2011 00:45:10 +0000 (01:45 +0100)]
rpms: Fix handling of x86 architectures
Once upon a time, our specfile would assume that if you were
building for i386 you were building userspace, and that i586 or i686
implied doing a kernel only build. This is no longer the case, and
now everything on modern Fedora is built for i686, so we should adapt
the spec file for this.
Windows: always open dscp in smb_ReceiveNTTranCreate
There were two code paths in smb_ReceiveNTTranCreate that included
asserts in case the directory cm_scache_t object had not been
evaluated. RT129299 contains a report that at least one of
them had been tripped in production. There is no reason to avoid
evaluating the directory scp. It must exist in the cache and
obtaining a reference in all cases simplifies the logic of this
overly complex function.
viced: If platform supports setting a thread title, do so
Some pthread libraries support setting a name or title for individual
threads (analogous to setproctitle() for processes). This can be useful
for debugging and is sometimes published for use by utilities like ps
(again like setproctitle() for processes). The two most common variants
of this have the same signature with slightly different function names.
If either one is present, use it in viced (which already assigns a thread
name when compiled for LWP but ignores it in pthreads compilations).
Create a new lock daemon thread which performs regular
cm_LockCheck() calls. If a lock is deleted check the cm_scache_t
to see if the matching file server lock should be dropped. If yes,
drop it.
This effectively caches file server locks for two seconds after
they are released to provide a chance for subsequent local lock
requests on the same file to avoid a file server RPC. It also
ensures that windows processes do not thrash the file server and
force callback breaks.
OpenBSD: Add <sys/queue.h> header for <sys/lockf.h>
On OpenBSD, the <sys/lockf.h> header requires the TAILQ_* macros
which are defined in <sys/queue.h>. The latter is not automatically
included by <sys/lockf.h> . This patch makes sure that it is
available by putting it into the OpenBSD-specific param.h files
(so as not to impact any other OS).
Make viced.c look more like other source files by indenting nested
preprocessor directives. In a few case it made more sense to
eliminate the nesting. This should otherwise be a whitespace-only
chnage.
Change-Id: I895ea2f754f90a15daa73cea24d3da9576fff9c9
Reviewed-on: http://gerrit.openafs.org/4959 Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Tested-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Reviewed-by: Derrick Brashear <shadow@dementia.org>
When rx was converted to use pthreads, the code that allocates
a call to a connection channel in rxi_ReceivePacket() was not
made thread safe. The code prior to this patchset permitted a race
in the server connection case. The rx_connection channel assignment
in rxi_ReceivePacket() and the call destruction in rxi_FreeCall()
and rxi_DestroyConnectionNoLock() did not consistently protect the
rx_connection channel array using the conn_call_lock.
This race could result in rxi_ReceivePacket() operating on a
rx_call which was disconnected from the previously assigned
rx_connection.
In addition, the code in rxi_ReceivePacket() that was intended
to protect the allocation of a call using rxi_NewCall() to the
connection channel array was racy with itself.
This patchset consistently applies the conn_call_lock to protect
the allocation / deallocation of calls to the connection channel
array and in the process simplifies the logic in rxi_ReceivePacket()
as it is no longer necessary to protect against a null call pointer
since the race can no longer be lost.