Derrick Brashear [Thu, 17 Feb 2011 05:04:06 +0000 (00:04 -0500)]
linux: defer vcache evictions when sleep would be needed
because we're only willing to loop 100 times worth of "sleeps",
on a machine with heavy vcache demands we can end up just growing
the list huge. in the first pass, just clean up as many entries which
do not require sleeping as needed. if we need more entries, make
a second pass.
Jeffrey Altman [Wed, 9 Mar 2011 12:51:02 +0000 (07:51 -0500)]
Windows: handle rx busy call channel
Register an error code for rx busy call channel detection.
Force a retry whenever CM_RX_BUSY_CALL_CHANNEL is received
by cm_Analyze(). Log the event to both the internal trace
log and the Windows Event Log along with the server address.
Andrew Deason [Mon, 7 Mar 2011 17:08:26 +0000 (11:08 -0600)]
RX: Avoid timing out non-kernel busy channels
When we encounter a "busy" call channel (indicated by receiving
RX_PACKET_TYPE_BUSY packets), we can error out a call with
RX_CALL_TIMEOUT to try and get the application code to retry the call.
However, many RX applications are not aware of this, and will just
fail with an error upon receiving a single busy packet.
So instead, make this behavior optional, and only do it if the
application tells us what specific error it expects to receive when a
busy call channel is detected. Enable this behavior for the Unix cache
manager, as it can cope with receiving an RX_CALL_TIMEOUT error in
this scenario.
Andrew Deason [Wed, 16 Feb 2011 03:23:06 +0000 (21:23 -0600)]
aklog: Do not include XCFLAGS twice
In aklog, we set MODULE_CFLAGS to XCFLAGS and some other things.
However, when using AFS_LDRULE or AFS_CCRULE, CFLAGS will contain
MT_CFLAGS, which contains XCFLAGS. The end result is that the contents
of XCFLAGS appear twice in the compilation invocation, breaking some
platforms like HP-UX where the order of XCFLAGS relative to other
things is a bit fragile.
Fix this by removing XCFLAGS from the MODULE_CFLAGS definition.
Jeffrey Altman [Sat, 5 Mar 2011 19:34:05 +0000 (14:34 -0500)]
vol: FILE* to FD_t except logging and special ops
Replace all use of FILE* with FD_t. Switch from afs_open to OS_OPEN.
In the process:
afs_flush and afs_fsync -> OS_SYNC
afs_stat which is used to obtain the file size -> OS_SIZE
afs_close or close -> OS_CLOSE
Etc. While cleaning up, use afs_stat_st macro when declaring
a struct stat because the structure and function are not guaranteed
to be the same name on all platforms.
These changes permit Windows to build the vol package without
the use of the C runtime library.
Jeffrey Altman [Sat, 5 Mar 2011 19:25:34 +0000 (14:25 -0500)]
vol: consolide afs_xxxx macros in ihandle.h
Various definitions of afs_open, afs_stat, etc. were
scattered across the .c sources within the vol package.
Consolidate them all in ihandle.h which is included in
all of the files and contains the OS_xxxx macros which
will substitute for many afs_xxxx calls in future patchsets.
Simon Wilkinson [Fri, 11 Feb 2011 11:53:26 +0000 (11:53 +0000)]
Clarify the role of XCFLAGS and simplify MT_CFLAGS
Tidy up the build system by making it clear that XCFLAGS is included
for every build type. Also clean up MT_CFLAGS so that it doesn't
statically include XCFLAGS, and remove the common AFS_PTHREAD_ENV
define that's needed by every architecture.
This fixes the problem that we had where directories built with the
pthread or shared build rules weren't being compiled with checking
enabled, as well as hopefully making the tangle of defines easier to
understand.
Marc Dionne [Sat, 29 Jan 2011 17:48:02 +0000 (12:48 -0500)]
ubik: cleanup DB lock usage in SDISK_SendFile
Some failure paths can return from SDISK_SendFile with the
database lock still held. Other failure paths will cause
setlabel to be called without holding the lock.
Rework the failure paths so we always release the DB lock before
returning, and always hold it when calling setlabel.
Commit 335ccb40 introduced positional I/O support for the fileserver,
but didn't handle the largefile versions of preadv and pwritev. As a
result, the fileserver cannot handle files of more than 2Gb in size.
Fix this by using preadv64 and pwritev64 where O_LARGEFILE is defined,
in the same way as for all other I/O primitives.
Simon Wilkinson [Sun, 6 Mar 2011 16:06:36 +0000 (16:06 +0000)]
Disable vectored positional IO if no 64bit support
In order to support vectored positional I/O, and large files, we
need there to be an implementation of preadv64 and pwritev64. If
this isn't present, then just disable HAVE_PIOV.
Jeffrey Altman [Sat, 5 Mar 2011 15:06:50 +0000 (10:06 -0500)]
volser: restore diskPartition[64] lock_fd comment
The diskPartition[64] wire structures contain an int to represent
the file descriptor. This field is too small to represent the
Windows file descriptor which is a 64-bit HANDLE. A comment had
been added by Rod Widdowson. Restore it.
The conversion to uvldbentry produced too many negative side
effects. Revisit support for multi-homed servers when vos
is executed from a machine that can only see a random subset
of the addresses assigned to the server in the future.
Andrew Deason [Fri, 4 Mar 2011 17:35:06 +0000 (11:35 -0600)]
viced: Set HWHO_INPROGRESS in CheckHost_r
When we are probing a host in CheckHost_r, set the HWHO_INPROGRESS
flag on the host, so other threads know that the host is locked while
we are waiting for a probe response, and the h_threadquota mechanism
can work correctly.
Jeffrey Altman [Wed, 2 Mar 2011 19:06:48 +0000 (14:06 -0500)]
Windows: avoid use of cm_buf for MPs and Symlinks
In the Windows cache manager, the symlink and mount point
target strings are stored in the cm_scache_t mountPointString
and are not accessed out of the cm_buf_t for offset zero
except when populating the mountPointString. As a result,
every mountpoint and symlink object that is read into the cache
wastes a cm_buf_t which could otherwise be used to store
additional file or directory data.
Add cm_GetData() function which is similar to cm_GetBuffer()
except that it reads data from the file server into an arbitray
memory location instead of a cm_buf_t object. Use cm_GetData()
to read directly into the cm_scache_t object.
In addition, further optimize the communication with the
file server by using cm_GetData() to perform a RXAFS_FetchData
RPC to obtain both the target string and the status information
instead of RXAFS_FetchStatus which only returns the status
information in cases where there are no outstanding callback
registrations on the object. RXAFS_FetchStatus is still used
when a callback is active in order to obtain access permissions
for new users.
Andrew Deason [Fri, 25 Feb 2011 22:58:30 +0000 (16:58 -0600)]
vol: Check for blank vnode in VAllocVnode_r
When we alloc a vnode in VAllocVnode_r, we look up that vnode in the
vnode cache, to see if a vnode struct already exists for it. If it
doesn't, we check the vnode index to ensure that the vnode actually is
not in use (among other things). However, we do not perform the same
check for a vnode already in the cache. Add this check, to make sure
that we don't allocate an already-used vnode number, even if the
bitmap is screwed up.
Andrew Deason [Fri, 25 Feb 2011 22:01:32 +0000 (16:01 -0600)]
DAFS: VnLock after VnWaitQuiescent in VAllocVnode
In VAllocVnode, we write-lock the newly-allocated vnode. In DAFS,
however, we need to VnWaitQuiescent_r before VnLock'ing, since VnLock
in DAFS just sets the writer tid/pid. So, in VAllocVnode, move the
VnLock call to after we wait for quiescence, so we don't stomp over
the vnode when someone else has it write-locked.
Andrew Deason [Fri, 25 Feb 2011 20:43:09 +0000 (14:43 -0600)]
DAFS: Wait for exclusive ops in VFreeBitMapEntry_r
VAllocBitmapEntry_r puts the volume in an exclusive state and drops
VOL_LOCK when traversing the volume bitmap and updating the bitmap.
So, VFreeBitMapEntry_r must ensure the volume is not in an exclusive
state, to make sure that VAllocBitmapEntry_r is not updating the
bitmap at the same time. Do so, by waiting for the volume to come out
of exclusive state at the beginning of VFreeBitMapEntry_r.
Andrew Deason [Wed, 2 Mar 2011 20:11:43 +0000 (14:11 -0600)]
vol-salvage: VOL_DONE deleted volumes
When the salvager deletes a volume (because it is an invalid RO clone,
or because there is no data associated with the volume), we should
inform the fileserver that the volume is gone. Otherwise, the volume
in the fileserver can get put into an error state (in DAFS) when it
tries to attach the volume, preventing anything from creating or using
that volume.
Andrew Deason [Wed, 2 Mar 2011 21:39:51 +0000 (15:39 -0600)]
DAFS: Clear salvage stats on VOL_DONE
When we VOL_DONE a volume, the volume has been deleted, so the salvage
stats/information are no longer relevant. Clear them out, so we don't
think the volume is still salvaging.
Andrew Deason [Wed, 2 Mar 2011 21:02:40 +0000 (15:02 -0600)]
DAFS: Allow LEAVE_OFF for DELETED volumes
When a volume is VOL_STATE_DELETED, it effectively does not exist to
other programs over FSSYNC. So, do not prevent someone from issuing a
FSYNC_VOL_LEAVE_OFF for a VOL_STATE_DELETED volume.
Andrew Deason [Wed, 2 Mar 2011 20:10:33 +0000 (14:10 -0600)]
vol-salvage: calloc volume summary structs
Calloc volume summary structs instead of malloc'ing them, in
vol-salvage.c. This way, new fields added to struct VolumeSummary will
be known to be zeroed by default, without needing to update all of the
allocating callers.
Andrew Deason [Thu, 3 Mar 2011 22:02:47 +0000 (16:02 -0600)]
viced: Check vnode length on read and write
When reading or writing a file vnode, check that the length of the
vnode in the vnode index matches the size of the on-disk file
containing the data for the file. If it does not match, take the
volume offline (and for DAFS, demand-salvage it).
Andrew Deason [Wed, 2 Mar 2011 19:12:25 +0000 (13:12 -0600)]
Give a default reason in *sync-debug
If no -reason is given for fssync-debug calls, we currently just
transmit garbage to the fileserver or salvageserver. Instead, give a
default (the *_WHATEVER constant), so we do something consistent.
Simon Wilkinson [Tue, 1 Mar 2011 14:01:46 +0000 (14:01 +0000)]
ptuser/hpr: Don't check for a KeyFile
ptuser and viced's hpr were checking for a KeyFile before calling
ClientAuthSecure. If a KeyFile doesn't exist, then they would display
a warning message, and use an rxnull connection.
However, ClientAuthSecure will return a rxnull connection if it can't
find a KeyFile. So, simplify all of this to just use ClientAuthSecure,
which knows better than we do what keys are usable and which aren't.
Simon Wilkinson [Tue, 1 Mar 2011 13:59:19 +0000 (13:59 +0000)]
ptserver: Always set up Ubik security
ptserver was checking for the existence of a suitable KeyFile before
setting up Ubik's security classes. This is uneccessary, because the
behaviour of the afsconf_* functions when a KeyFile doesn't exist
is the same as Ubik's default mechanisms.
So, simplify (and future proof) the code by removing the KeyFile check.
libafscp provides the ability to accomplish many of the functions of an AFS
client without a running afsd cache manager. It is being introduced into
the OpenAFS source tree in order to improve the capabilities of several
utilities but may have additional benefits for testing clients and servers
and for use on platforms which do not have afsd support.
Simon Wilkinson [Tue, 1 Mar 2011 00:11:01 +0000 (00:11 +0000)]
volser: Rename putshort and putint32
dumpstuff.c defines macros for putshort and putint32. However, the
name 'putshort' conflicts with a macro defined on Linux in resolv.h
(which is included by roken.h)
Just rename putshort to afs_putshort and putint32 to afs_putint32 to
solve this problem
Simon Wilkinson [Tue, 1 Mar 2011 00:08:12 +0000 (00:08 +0000)]
roken: Fix out-of-tree libroken builds
The libroken configuration script is supposed to support using a
libroken which is installed out of the OpenAFS tree, but which isn't
in the standard search paths, by using --with-roken=/path/to/base
This didn't previously work. Fix this so that it works correctly,
and also fix a few problems with libafshcrypto, which assumed that
LDFLAGS_roken would always be -L$(TOP_LIBDIR)
The ucontext header is only included in lwp.h for platforms that use
ucontext as a means for context-switching in LWP. The preempt module
needs the ucontext header for signal handling on some platforms (at
least Solaris). So, ucontext.h may not be included by lwp.h on these
platforms, if that platform does not use ucontext for LWP
context-switching. So we need to explicitly include ucontext.h in
preempt.c.
In testing, this change causes RXAFS_EndStoreData to intermittently
fail with an RX_CC_UNMARSHALL error code. The error is returned
when the first 32bit word is read from the RX stream from the server.
Before this happens, the call is not in an error state.
As this problem makes the cache manager unusable for other
development, back the changeset out for now.
Andrew Deason [Thu, 17 Feb 2011 17:57:53 +0000 (11:57 -0600)]
LINUX: Include key-related headers in osi_compat.h
Include keyring-related headers in osi_compat.h, so we get the proper
types defined for keyring-related functions. Also only define
keyring-related functions if we have keyring support.
Simon Wilkinson [Fri, 25 Feb 2011 01:30:02 +0000 (01:30 +0000)]
auth: Rework PickClientSecObj
When called in localauth mode, this function was using
afsconf_GetLatestKey to check that the machine has a key file. However,
the ClientAuth and ClientAuthSecure functions then go on to do exactly
the same thing.
Instead, pick up on ClientAuth returning a rxnull security layer, and
trigger the NOTFOUND error based on that, rather than on the absence of
an old-style key file.
Simon Wilkinson [Fri, 25 Feb 2011 01:28:30 +0000 (01:28 +0000)]
auth: Fix use of expires in PickClientSecObj
The expires pointer was being zeroed in PickClientSecObject, rather
than zeroing the value pointed to. This meant that we would never
return any expiry time for the selected token.
Simon Wilkinson [Fri, 25 Feb 2011 01:23:38 +0000 (01:23 +0000)]
auth: Correctly write empty keyfiles
The new key handling code was creating empty keyfiles that were 0
bytes in length. The correct format for an empty keyfile is a file
containing a single 0 word (the number of keys in the file). Update
the code to write this form of empty KeyFile.
Simon Wilkinson [Fri, 25 Feb 2011 01:21:38 +0000 (01:21 +0000)]
auth: GetLatestKey should allow NULL return values
Existing callers in the code use
afsconf_GetLatestKey(dir, NULL, NULL) to check for the existence of
a key file. We need to permit NULL values for the return pointers
to this function.
Also update the tests to check for this behaviour.
Simon Wilkinson [Thu, 24 Feb 2011 13:52:40 +0000 (13:52 +0000)]
tests/auth: Refactor common code
Pull the common code for creating a configuration directory out of
the keys and superuser tests into a single file. This both cleans up
the existing tests, and makes it easier to add new ones.
The USE_UCONTEXT was a temporary fix until someone wrote a reasonable
test of the user context swapping functions. While these are present
on many operating systems, they simply aren't complete. This test
correctly fails on IRIX, MacOS and some versions of Linux (in particular,
ppc 32-bit binaries on a 64-bit processor).
Andrew Deason [Mon, 21 Feb 2011 18:39:48 +0000 (12:39 -0600)]
rx: Reset fd_set in LWP rxi_Sendmsg
When we select() on the socket fd in rxi_Sendmsg, we do not reset the
fd_set, and just use the same memory for any necessary subsequent
select()s. However, if the select returned on EINTR, the fd_set may be
cleared, and so we may try to select() on an empty fd_set forever. To
be sure that we don't do that, reset the fd_set to the socket fd every
time.
Andrew Deason [Sun, 20 Feb 2011 03:14:11 +0000 (21:14 -0600)]
HPUX: Fix osi_debug.c includes
osi_debug.c was trying to include fcrypt.h and private_data.h. But the
former is in the rx subdirectory, and the latter is in src/rxkad. So,
specify a more complete path for fcrypt.h, and put src/rxkad in the
include list for osi_debug.c so we can build again.
Simon Wilkinson [Mon, 21 Feb 2011 00:29:33 +0000 (00:29 +0000)]
budb: Only have one build rule for budb_errs.c
budb had two build rules that could produce budb_errs.c, but only
one of them also produced budb_client.h. This led to problems with
parallel makes, as depending on which rule fired first, budb_client.h
might, or might not, exist.
Rework all of this so that it's cleaner. Instead of producing two
copies of the error table, just make budb_client.h a static file,
and include the dynamically generated budb_errs.h from it. This
reduces code duplication, and means that we have to run compile_et
one less time.
Andrew Deason [Fri, 18 Feb 2011 21:49:03 +0000 (15:49 -0600)]
LINUX: Replace dcache.h for fs.h in config tests
When detecting if we have certain Linux kernel features, we only
include dcache.h. On some kernel versions (at least 2.4.27),
compilation fails if we include dcache.h directly (due to e.g.
list_head not being defined), which causes false negatives in tests
such as the test for dcache_lock. If we instead include fs.h, which
includes dcache.h, the tests succeed when they should succeed. So, use
fs.h instead of dcache.h.
Change-Id: I43fbbc7e5a952d9effbbac16adb9891c36f729bd
Reviewed-on: http://gerrit.openafs.org/3989 Tested-by: BuildBot <buildbot@rampaginggeek.com> Tested-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Reviewed-by: Derrick Brashear <shadow@dementia.org>
Simon Wilkinson [Sat, 19 Feb 2011 18:04:43 +0000 (18:04 +0000)]
osconf: pic_regex.o is now regex_pic.o
pic_regex.o was renamed as regex_pic.o in
commit 43b8bcf2a7c7dfd855a9f2bf274a93289a4941c6, but osconf.m4's
definied of REGEX_OBJ_PIC wasn't updated at the same time. Fix that.
Andrew Deason [Thu, 17 Feb 2011 20:33:07 +0000 (14:33 -0600)]
Document dropbox permissions
Document the behavior and potential problems with granting 'il' rights
to create dropboxes. Do this in the manpage for 'fs setacl' and
chapter 4 of the User Guide.
Simon Wilkinson [Fri, 18 Feb 2011 00:36:33 +0000 (00:36 +0000)]
RedHat packaging: Use %{dist} not %{osver}
There's a standard mechanism for defining a RPMs target
distribution in the Fedora and RedHat worlds. This is to use the
%{dist} macro, and to insert it at the end (not the beginning) of
the release field.
Move over to using this standard mechanism, and modify the build
system to match. Note that this means that RPM names have now
changed slightly.
Andrew Deason [Thu, 17 Feb 2011 21:47:00 +0000 (15:47 -0600)]
afsd: Make mountdir check kernel-specific
Checking if the /afs directory exists only makes sense for the kernel
afsd. The libuafs afsd does not care if the mount directory actually
exists on the machine or not, since it may not interact with the mount
directory path on the local machine at all.
So, make the mountdir check code be a new afsd function
(afsd_check_mount), and have it stat() the mount directory only in the
kernels-specific afsd.
just try to give up callbacks at shutdown. at this point if
you're running 1.4.5 or older, you're sad anyway.
Change-Id: I7d9e9f1de45980f064bccaab338499789aa40646
Reviewed-on: http://gerrit.openafs.org/3404 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org>
Marc Dionne [Sat, 22 Jan 2011 21:04:47 +0000 (16:04 -0500)]
ubik: Abstract common code in ContactQuorum* functions
These functions are mostly identical except for the arguments and the
called operation. Move as much common code as possible to an iterator
function and a return code check function. The DISK_WriteV case is
treated a bit differently since it can fall back to using DISK_Write.
This reduces code duplication and shoud simplify maintenance and
future changes. There should be no functional changes.
fileserver: dropbox mode shouldn't allow readback from anonymous
if you're writing files as anonymous, don't let them be read back.
things which potentially need to page back in will just have to be
authenticated, or lose.
Andrew Deason [Thu, 17 Feb 2011 18:37:49 +0000 (12:37 -0600)]
shlib-build: Add -p option
Add a -p option to shlib-build option to generate "plain" shared
objects. That is, shared objects that are intended to be e.g.
dlopen()'d, and are not intended to be libraries dynamically linked to
from other code. Such shared objects do not need a library name,
version numbers, export lists, etc.