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.
Andrew Deason [Mon, 31 Jan 2011 21:00:09 +0000 (15:00 -0600)]
Rx: Do not stop keepalives on ACKALL receipt
We need to still keep sending periodic keepalives after receiving an
ACKALL, since the call is not done yet. ACKALLs can be received when
the peer has received all data from us, well before the call has
finished. This is particularly noticeable for long-lived calls that
have little data transfer, such as AFSVolForward and
AFSVolForwardMultiple.
Jeffrey Altman [Mon, 31 Jan 2011 16:43:39 +0000 (11:43 -0500)]
Windows: No NCBRESET when probing Loopback after start
The Netbios NCBRESET command resets all of the Netbios state
associated with the LAN adapter including the name bindings.
In response to a detected LAN adapter IP address change, the
smb_LanAdapterChange() function is called to determine if any
Netbios LAN adapter bindings that were in use or should be in
use by afsd_service were altered. As part of the check,
lana_GetUncServerNameEx() is called which in turn calls
lana_FindLoopback() which in turn issued a lana_IsLoopback()
for each LAN adapter with the 'reset adapter' flag set to TRUE.
Calling lana_IsLoopback() with 'reset' equal TRUE was fine
when lana_GetUncServerNameEx() was only called from smb_Init(),
but it is not fine when called after the service is processing
calls. By resetting the adapter the binding of the netbios name
"AFS" (or "<MACHINE>-AFS") is removed and all outstanding calls
are canceled. If the SMB redirector attempts a reconnect during
the window before NCBADDNAM is called to re-bind the name, a
negative cache entry will be placed in the netbios name lookup
table that will prevent the SMB redirector from connecting to
the client for several minutes.
If the environment is one in which frequent IP address change
events are triggered, it is possible that the SMB redirector
will never be able to reconnect to the service.
This patchset adds a flag, LANA_NETBIOS_NO_RESET, to the
lana_GetUncServerEx interface which permits smb_LanAdapterChange()
to avoid the undesirable reset. This negative flag was selected
in order to avoid changing the current default behavior as the
lanahelper library is used by out of tree installers and it
is preferred that OpenAFS avoid breaking them unnecessarily.
Simon Wilkinson [Sun, 30 Jan 2011 20:54:30 +0000 (20:54 +0000)]
tests: Fix auth/superuser-t.c to work on Linux
Fix the superuser tests so that they can be run on Linux. This
requires explicitly including sys/wait.h so we can use waitpid,
and changing some initialisation ordering so that we initialise
the RX library before we try and fake an rxkad token.
Simon Wilkinson [Sun, 30 Jan 2011 18:35:28 +0000 (18:35 +0000)]
bozo: Fix linker problem on Linux
Some unconnected changes break the Linux linker when faced with this
library list. librx is included too early, and liblwp isn't included
after the second inclusion of librx. Reorder the library list to fix
this problem, and so it matches the library order in the rest of our
modules.
Jeffrey Altman [Sun, 30 Jan 2011 04:24:16 +0000 (23:24 -0500)]
Windows: out of order locks cm_CheckCBExpiration
The recent refactoring of cm_CheckCBExpiration introduced
a lock ordering error between the cm_scache_t rw lock and the
cm_scacheLock. This patchset fixes the error by dropping the
cm_scacheLock as each cm_scache_t is being processed.
Simon Wilkinson [Fri, 28 Jan 2011 15:01:21 +0000 (15:01 +0000)]
aklog: Use correct CFLAGS
The aklog Makefile was setting XCFLAGS, but then not actually using them
which meant that we never used the correct include path for the Kerberos
libraries, or defined ALLOW_REGISTER
Rod Widdowson [Fri, 28 Jan 2011 16:49:03 +0000 (16:49 +0000)]
Do not compare an FD_t < 0
FD_t is an abstract type. Invalid file decriptors are == INVALID_FD.
In most places this module does the right thing. Fix the last
stragglers where it is testing as less than zero.
Andrew Deason [Thu, 2 Dec 2010 23:13:17 +0000 (17:13 -0600)]
RX: Avoid retrying calls on busy channels
When we receive an RX_PACKET_TYPE_BUSY packet, we currently ignore it.
This is a problem when the server has a long-running call on that same
call channel that we don't know about, since we will then keep
retrying the call on the same channel and keep getting
RX_PACKET_TYPE_BUSY responses.
Try to avoid this by returning the RX_CALL_TIMEOUT error when we get a
BUSY packet and there are other free call channels available on the
conn. When the application gets the error and retries the call, we
avoid using the same call channel again where possible. When all of
the call channels appear busy, we revert to effectively the old
behavior of retrying the call on the same channel until we get an
RX_CALL_DEAD (or similar) error.
Jeffrey Altman [Thu, 27 Jan 2011 01:10:57 +0000 (20:10 -0500)]
Windows: Correct cm_volume locking
cm_volume_t flags was used for two categories of flags. The first
protected by the cm_volume_t->rw lock. The second protected by
the global cm_volumeLock. Separate the flags field into two
afs_uint16 fields and break the flag space into FLAG and QFLAG.
Add assertions to the volume LRU functions to ensure that they
are always called with cm_volumeLock write-locked.
Correct two locations where cm_AdjustVolumeLRU() was called
read-locked instead of write-locked.
Andrew Deason [Tue, 25 Jan 2011 16:46:38 +0000 (10:46 -0600)]
vol-salvage: Only delete bad vnodes during !check
In SalvageIndex, if check is true, we're only supposed to check for
consistency and not actually change anything (this is enforced by an
assert later on). The check for vnode magic consistency breaks this
assumption, and just always fixes the vnode.
Change this so we just error out if check is set, and the vnode magic
is wrong.
Rod Widdowson [Sun, 23 Jan 2011 14:29:51 +0000 (14:29 +0000)]
Windows: fix parameters and return value from nt_seek
SetFilePointerEx takes specific values
(FILE_BEGIN/FILE_CURRENT/FILE_END) whilse fseek requires SEEK_SET,
SEK_END, SEEK_CUR. It turns out that these overlap, but we should
not let that pass unchallenged.
SetFilePointerEx returns nonzero for success zero for failure. fseek
returns the other way around.
Neither of these changes currently matter, but we should fix them.
Rod Widdowson [Sun, 23 Jan 2011 10:59:28 +0000 (10:59 +0000)]
Windows: read and write take void* buffers, open takes a const char*
nt_read and nt_write were defined to take a char* buffer which was
then cast to a void *. Meantime every call of OS_READ and
OS_WRITE were casting to a char*.
Equally every call of OS_OPEN was passing down a const char*,
causing warnings.
This checkin fixes this:
nt_read : char* to void*
nt_write: char* to const void*
nt_open char* to const char*
OpenBSD: Eliminate complaint about built-in malloc.
With OpenBSD 4.8, OpenBSD now uses gcc 4. With its new
defaults, the OpenAFS compile of the kernel module now
complains incessantly about the conflict between the
built-in malloc versus the kernel version (which has
extra parameters). Therefore, set -fno-builtin-malloc
when compiling the kernel module to remove the noise
since the differences can't be reconciled otherwise.
Rod Widdowson [Sun, 23 Jan 2011 12:04:59 +0000 (12:04 +0000)]
Windows: remove faulty assumptions about device names in vol-salvage
The implementation has an assumption that all disk volumes have an
object name of \Device\HarddiskXXX (where XXX is a number). This is
wrong since the name is purely a convention and since about WXP they
have been called \Device\HarddiskVolumeXXX.
Either way it is spurious to assume the format and then try to compare
the XXX. This change just compares the strings. This is done in a
case insenstive manner which is the safer option. It is quite
feasible, but very unlikely that someone will uses 'case sensitively
different' object names.
OpenBSD: Make OpenBSD 4.7 param headers consistent
OpenBSD follows the policy of using a separate common
param file (post 1.4.x). However, when introducing support
for i386 OpenBSD 4.7, this was not done and a single param
config header file was created instead. This patch changes
the param files for OpenBSD 4.7 so that they are
consistent with the other OpenBSD versions by using a
separate common param header file.
Jeffrey Altman [Thu, 20 Jan 2011 07:15:18 +0000 (02:15 -0500)]
vol: fix CreateFile params nt_unlink and nt_open
nt_unlink: when opening a file handle to assign delete on close
status the caller must request DELETE permission.
nt_open: make sure that DELETE permission along with FILE_SHARE_DELETE
is requested if we wish to permit another CreateFile call in the future
to assign delete on close.
Change-Id: Ib971ecc098dbc5eb64dcbfed93c334397c9d8ac9
Reviewed-on: http://gerrit.openafs.org/3711 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
Jeffrey Altman [Thu, 20 Jan 2011 07:06:12 +0000 (02:06 -0500)]
vol: add comment nt_unlink cannot with fopen handles
On Windows, files opened via the CRT fopen or open
POSIX compatibility functions cannot be marked for delete
on close. Add a comment until such time as the use of
fopen and open on Windows can be replaced.