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.
Andrew Deason [Thu, 17 Feb 2011 21:15:06 +0000 (15:15 -0600)]
afsd.fuse: Force internal mount dir to /afs
Commit 1f1545dfb708b6f70065da58b44676b8eafef772 made it so the
argument given to -mountdir sets the internal mount directory.
However, afsd.fuse assumes that the mount dir is always /afs
internally. So, use the uafs_setMountDir function to reset the
internal mount dir to "/afs", so afsd.fuse can work with non-/afs
mountpoints.
Andrew Deason [Thu, 17 Feb 2011 21:14:41 +0000 (15:14 -0600)]
UKERNEL: Add uafs_setMountDir
Replace the function uafs_mountWithDir with uafs_setMountDir, and
adjust the one caller. This allows libuafs users to manually set the
mount dir after e.g. the mount dir is set from afsd options.
Andrew Deason [Wed, 16 Feb 2011 21:58:41 +0000 (15:58 -0600)]
Fix PIC CFLAGS
Commit 8eca6a1153eb7768c2f29ea2d48f01f6988cbfe3 just used -fPIC to
generate position-independant code. However, the flag to turn on PIC
varies depending on the compiler, and is not always -fPIC. Just use
SHD_CCRULE instead, which will get us the correct PIC flags.
Simon Wilkinson [Wed, 16 Feb 2011 20:41:02 +0000 (20:41 +0000)]
Add CCRULE variants for each build type
Add explicit LWP, PTH and SHD variants of the CCRULE variable for
LWP, pthreaded and shared-library builds respectively. This allows
Makefiles which support building more than one target type to use
these rules directly, rather than brewing their own.
Modify all of the AFS_CCRULE definitions in the build type specific
Makefiles to reference these rules, so we aren't specifying things
twice.
Andrew Deason [Fri, 28 Jan 2011 17:11:20 +0000 (11:11 -0600)]
libuafs: Allow -mountdir to override uafs_Setup
For some reason, uafs_Setup accepts a parameter specifying the AFS mount
point, and we effectively ignore any -mountdir option specified in the
string arguments. Allow -mountdir to override the mount point specified
in uafs_Setup, by changing afs_mountDir &co during afsd_mount_afs().
Andrew Deason [Mon, 7 Feb 2011 19:13:31 +0000 (13:13 -0600)]
viced: Enforce lwps limit for -L
Previously, we only enforced the calculated lwp/thread maximum when
the -p argument was specified. When -L was specified, we set lwps to
128, which can be over the max of (effectively)
MAX_FILESERVER_THREAD-FILESERVER_HELPER_THREADS, depending on the
value of MAX_FILESERVER_THREAD.
Instead, enforce the lwps min/max after all code to set the lwps has
run.
Simon Wilkinson [Mon, 13 Sep 2010 12:54:32 +0000 (13:54 +0100)]
rfc3961: Add a kernel rfc3961 implementation
Add the necessary mechanisms to build Heimdal's libkrb5/crypto_*.c in
the kernel. This provides the kernel module with a RFC3961
implementation.
In theory this could also be used to provide a RFC3961 implementation
on top of an EVP-based crypto library in userspace, but at the moment
we're just using Heimdal directly for this.
Simon Wilkinson [Sun, 12 Sep 2010 17:40:08 +0000 (18:40 +0100)]
hcrypto: Add hcrypto EVP support to the Unix CM
This commit adds the files which are necessary to support hcrypto's
EVP interface to the Unix cache manager build. Only a small number
of EVP ciphers and hashes are currently supported -
* aes_128_cbc
* aes_256_cbc
* sha1
Note that the EVP interface is the only supported mechanism to use
the AES cipher - directly calling the underlying crypto functions
is not recommended and may break at any time.
Andrew Deason [Wed, 16 Feb 2011 15:49:03 +0000 (09:49 -0600)]
Makefile whitespace fixes
Some "make"s get tripped up by recipe lines starting with anything but
a tab character. Most of the time we start ours with tabs, but fix a
few instances where they begin with spaces.
Andrew Deason [Tue, 15 Feb 2011 23:21:49 +0000 (17:21 -0600)]
vol: Restore inode OS_READ/WRITE
Commit 335ccb4082657b7d0e4e9af1076356cf115642d2 removed the OS_READ
and OS_WRITE definitions for non-namei code. We need those definitions
to build the pread/pwrite emulation functions, so put them back in.
This allows us to build the inode fileserver backend when we do not
have native positional I/O.
Andrew Deason [Mon, 14 Feb 2011 19:53:11 +0000 (13:53 -0600)]
HPUX: Disable positional I/O
Some versions of HP-UX have the pread() and pwrite() functions, but
they behave in odd ways; most notably, ignoring the offset argument
when _FILE_OFFSET_BITS is defined to 64.
This is noted in recent gnulib documentation
<http://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/posix-functions/pwrite.texi>,
and slightly less clear references to pread() being broken can be
found on the development mailing list for git itself.
It is not completely clear what specific HP-UX versions are affected
by this. An autoconf run-time test may also be insufficient, because
the same binaries should be usable on machines with broken and
non-broken pread() implementations. So, to be safe, disable positional
I/O on HP-UX unconditionally.
RedHat: Change the defined initdir path to /etc/rc.d/init.d
On Red Hat systems, /etc/init.d is a symlink to /etc/rc.d/init.d. We
should use the actual path for packaging the init scripts, to avoid
any issues with package verification.
Andrew Deason [Mon, 13 Dec 2010 19:11:02 +0000 (13:11 -0600)]
Add PIC variant for libuafs
Build a libuafs that is built with PIC, so it can be used in shared
libraries on all platforms. Also build PIC variants for libafsutil and
libcmd, since we need them for a PIC libuafs anyway.
Simon Wilkinson [Sat, 1 Jan 2011 23:41:29 +0000 (23:41 +0000)]
auth: Rewrite KeyFile handling code
Extend the KeyFile API so that we can support arbitrary numbers of
different key types, each with their own key version numbers and
sub types. Completely rewrite the KeyFile implementation with this
in mind, but implement all of the "old" API in terms of the new one.
Given that the existing KeyFile is modified by third party programs,
we retain that as the storage location for all afsconf_rxkad keys.
Only keys with a type of 1, or above are stored in the new extended
keyfile.
Jeffrey Altman [Sat, 12 Feb 2011 16:52:12 +0000 (11:52 -0500)]
Windows: Fix GetIoctlHandle path construction
GetIoctlHandle() is used to construct the magic pioctl file
path used to initiate pioctl operations with the cache manager.
The first error introduced double directory separators. The
second error was testing an uninitialized value which could
have resulted in a missing directory separator.
Jeffrey Altman [Sat, 12 Feb 2011 16:45:15 +0000 (11:45 -0500)]
Windows: Fix symlink and mount point make \\afs\xxx handling
When processing a request to make a symlink or a mount point
in the afs root volume (\\AFS) the smb redirector will fail
the request because a server name by itself is not a valid path.
Therefore, we insert the "all" share component to refer to the
root volume as a valid path. \\AFS\foobar becomes \\AFS\all\foobar.
A recent change stripped the trailing slash from the string
returned by Parent(). This broke the test that determines
whether or not the provided path that failed the IsAFS() test
is in fact referring to the \\AFS server and requires the insertion
of the "all" share name.
This patchset permits the test to work with \\AFS or \\AFS\
and removes extraneous directory separators from the generated
path containing the "all" share.
Simon Wilkinson [Wed, 9 Feb 2011 19:37:18 +0000 (19:37 +0000)]
util: Actually install thread_pool_types.h
The action portion of the rule for thread_pool_types.h was missing,
so the file was never installed. As that file is a dependency for the
whole of the util directory, it would result in util being completely
rebuild with every make invocation.
Add the missing installation rule, so we don't rebuild quite so often!
Marc Dionne [Fri, 28 Jan 2011 00:07:32 +0000 (19:07 -0500)]
ubik: always prefer a dirty cache page for write transactions
If a write transaction is running concurrently with a read transaction,
a DRead in the write transaction may return a clean cache page brought
in by the read transaction, instead of a previously written dirty page
from the same transaction. This can result in loss of the written data.
Fix by making sure there is not a dirty version of the requested page
before returning a clean one.
Marc Dionne [Sat, 29 Jan 2011 00:41:32 +0000 (19:41 -0500)]
Linux: 2.6.38: Adjust for permission inode operation changes
The permission i_op has a new signature with a flags argument, and
must now deal with RCU path walking.
- Fix existing configure test for this i_op, it succeeds when it
shouldn't
- Add a new configure test for the new signature
- Make our permission i_op "RCU-walk aware" - return ECHILD if
called in that mode
Marc Dionne [Sat, 29 Jan 2011 00:03:39 +0000 (19:03 -0500)]
Linux: allow compile flags to be passed to AC_CHECK_LINUX_BUILD
Some linux autoconf tests require particular compile flags such as
-Werror. Add a parameter to the AC_CHECK_LINUX_BUILD macro that
lets the caller pass in any needed special flags.
Adapt a few existing tests that were still using AC_TRY_KBUILD
directly.
Andrew Deason [Thu, 3 Feb 2011 21:40:48 +0000 (15:40 -0600)]
ConvertROtoRW: Use old copyDate for creationDate
When we convert an RO volume to an RW, currently we just copy the
copyDate and creationDate from the RO metadata into the RW. But the
copyDate and creationDate fields have different meanings for RW and RO
volumes: for ROs, the creationDate is merely the last time the data
was updated from the RW during a release operation.
So, if the copyDate is older than the creationDate, use the copyDate
as the new RW creationDate instead. This will probably not match the
creationDate of the original RW, but it will be closer to it, and it
will more accurately represent the conceptual "created time" of the
new RW.
Doing this can avoid forcing an unnecessary full dump on a subsequent
release of the resultant RW volume, since the creationDate is more
accurate.
Jeffrey Altman [Mon, 7 Feb 2011 21:44:09 +0000 (16:44 -0500)]
Windows: correct pthread_xxx_init semantics
pthread lock and conditional initialization semantics
do not require that the lock structure be zeroed before
pthread_xxxx_init() functions are called. Since the Windows
CriticalSection initialization does require that the memory
be zeroed, the pthread_xxxx_init() functions must zero the
memory just in case before performing the CriticalSection
initialization.
Andrew Deason [Thu, 27 Jan 2011 19:13:21 +0000 (13:13 -0600)]
afscp: Fix -s option for writes
When writing to AFS with afscp, the -s option was sleeping before any
StoreData RPCs actually got issued to the fileserver. Move the sleep
to after we have done one rx_Read/rx_Write, so we sleep after starting
to contact the fileserver, to make sleeping while writing more
consistent with sleeping while reading.