Andrew Deason [Wed, 22 Dec 2010 05:02:45 +0000 (00:02 -0500)]
HPUX: Put __HP_CURSES back in
We need __HP_CURSES to be defined in order to get the _maxx WINDOW*
field among other things. Define it on HPUX again (it was taken out as
part of 4a6a00d6f45bd0ac94e2eb05adee41552073643a).
Simon Wilkinson [Thu, 16 Dec 2010 10:46:43 +0000 (10:46 +0000)]
rx: Make rx_atomic.h a shared header
Copy rx_atomic.h into the shared header directory so that it can be
used by other modules within the AFS build. Note that we can't actually
install this header onto the system (and it cannot be included by
headers which are installed) because it uses autoconf defines to control
its behaviour.
Andrew Deason [Tue, 21 Dec 2010 15:31:39 +0000 (10:31 -0500)]
LINUX: Avoid unnecessary afs_ShakeLooseVCaches
Before some of the NewVCache refactoring, we only called
afs_ShakeLooseVCaches when afs_vcount was over (or equal to)
afs_maxvcount. Do this again, so we only try to shake loose vcaches
when we need more vcaches. Otherwise, we will call
afs_ShakeLooseVCaches every single time we want a new vcache when
dynamic vcaches are disabled (such as 2.4 Linux), and we log a warning
when we can't free any (which is likely when there are only 1 or 2
vcaches in use).
Andrew Deason [Fri, 3 Dec 2010 23:20:54 +0000 (17:20 -0600)]
LINUX: Reduce stack depth on recursive symlink res
Instead of calling vfs_follow_link inside afs_linux_follow_link
ourselves, we can just resolve the next step of the symlink resolution
and set the result in nd_set_link(), freeing the string in
.put_link().
For kernels without a usable symlink text cache, this reduces call
depth when resolving a path containing many symlinks by two frames per
layer of indirection, allowing for more deeply-nested symlink paths to
be usable.
Andrew Deason [Mon, 20 Dec 2010 22:29:37 +0000 (17:29 -0500)]
Cache bypass: remove ifdefs under src/afs/LINUX24
Same as commit 9657695d34badaac654227be8c731a1512f2106b, but for
LINUX24. Remove the AFS_CACHE_BYPASS references in LINUX24, since it
is always enabled. Also remove messages about a "cache bypass patched
module".
Derrick Brashear [Tue, 21 Dec 2010 13:58:31 +0000 (08:58 -0500)]
DARWIN: make growlagent build not run afoul of ._ fun
in some cases a git checkout would promptly merge the ._ file away,
meaning a subsequent build would fail. just use the developer tools
to set an icon instead of clever tricks.
Ben Kaduk [Mon, 20 Dec 2010 00:33:28 +0000 (19:33 -0500)]
FBSD7: Don't sleep with the glock
On FreeBSD 7.X, vinvalbuf() can (will) sleep; this results in a panic
when the kernel is configured with WITNESS and we hold the glock around
it.
Drop the glock in this case.
Ben Kaduk [Sun, 19 Dec 2010 04:52:44 +0000 (23:52 -0500)]
Bring FBSD 7.X client back to life
Having been untested for quite some time, we had several
places that needed more conditionals to compile on FreeBSD 7.
Now we compile and start on 7.3-RELEASE, but have locking issues
under actual use.
It seems that we are also incompatible with the Heimdal 0.6.3 in
the base system -- aklog is unable to actually obtain the needed
credential when compiled against that kerberos implementation;
using MIT krb5 1.6.3 from ports works without incident.
Ben Kaduk [Sun, 19 Dec 2010 05:06:13 +0000 (00:06 -0500)]
FBSD: StopListener glocking fixup
afs_osi_Sleep requires the glock (so that it can sleep on it); we
dropped the glock earlier in osi_StopListener because soshutdown and
soclose can sleep, but we must (unconditionally!) acquire it for our
loop waiting on rxk_ListenerPid.
Ben Kaduk [Mon, 20 Dec 2010 00:29:17 +0000 (19:29 -0500)]
Zero rx_multi_lock before initializing it
FreeBSD's kernel debugging facilities will panic if it detects
an attempt to re-initialize an already-initialized lock, as detected
through some particular bits being nonzero. Zero everything out
before starting, to prevent this panic.
Jeffrey Altman [Sat, 18 Dec 2010 23:39:07 +0000 (18:39 -0500)]
Windows: fs chmod and display mode in fs examine
Make use of the new pioctl VIOC_GETUNIXMODE and VIOC_SETUNIXMODE
operations to display the current mode in fs examine and permit
setting the mode with "fs chmod". The mode string parsing makes
use of Vincent Archer's code from Minix. The required copyright
statement and license is attached to parsemode().
afsconfig-windows.h gains definitions for various mode symbols
that are not defined by Visual Studio runtime headers.
Jeffrey Altman [Mon, 20 Dec 2010 14:59:43 +0000 (09:59 -0500)]
Windows: clear mountPointStringp on status change
If the data version of the cm_scache_t changes, we must clear
the mountPointString. Otherwise, if the object is a mountpoint
or symlink, cm_HandleLink() will not attempt to build the new
target string. The Windows CM never updates the contents of
a mountpoint or symlink. It always destroys the old and creates
a new one. However, the Unix CM simply updates the link data.
Apparently, the Windows clients have never noticed.
Anders Kaseorg [Sat, 6 Nov 2010 07:03:19 +0000 (03:03 -0400)]
Linux: Fix AFS_NORETURN violation with osi_AssertFailK
Commit d86f0c44d3c5910a6b54895484dc0286eac9bc73 changed the
AFS_LINUX26_ENV implementation of osi_AssertFailK so that it returns,
contradicting its AFS_NORETURN prototype, in an effort to make the
following BUG() display the right line number. To fix this, move the
returning implementation into its only caller, the osi_Assert macro.
This fixes possible compiler misoptimizations due to
rx_kcommon.c:255:1: warning: ‘noreturn’ function does return
Change-Id: Ibbcc630037002ce4659e2e6a36b39d271f9bdc58 Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/3276 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
Simon Wilkinson [Mon, 25 Oct 2010 10:26:51 +0000 (11:26 +0100)]
opr: Add new queue implementation
Add a new queue implementation for OpenAFS. This has a similar calling
form as the current RX queue implementation, but is implementated using
type safe functions, and supports structures with multiple queue
headers. This permits threading a structure onto multiple queues at the
same time.
The eventual intention is that this queue implementation will replace
both rx_queue and the Unix cache manager afs_q.
Andrew Deason [Thu, 9 Dec 2010 00:16:14 +0000 (18:16 -0600)]
Add ioctl-based AFS calls for Solaris 11
Switch from using syscall-based AFS calls to ioctl-based AFS calls,
since syscall 65 was repurposed in some kernels in Solaris 11 and
OpenSolaris. Update the provided afs init script to accomodate the
additional steps needing for starting the AFS client.
Partially based off of some work by Derrick Brashear.
Andrew Deason [Wed, 8 Dec 2010 20:57:13 +0000 (14:57 -0600)]
DAFS: Avoid logging harmless LEAVE_OFF failures
The DAFS volserver can create temporary destroyMe volumes, which it
then tells the fileserver to keep offline with an FSYNC_VOL_LEAVE_OFF
message. When the fileserver doesn't know that the volume exists,
currently it responds with SYNC_DENIED, which causes the volserver to
log the error with a "negative response on circuit FSSYNC" message.
These are harmless, though, since leaving a volume offline that the
fileserver does not know about is a no-op. So return the SYNC_FAILED
code instead, which does not get logged, and is more consistent with
some other FSYNC handlers like FSYNC_VOL_DONE.
Andrew Deason [Wed, 8 Dec 2010 18:41:44 +0000 (12:41 -0600)]
DAFS: Fix VOL_QUERY_VOP error codes
Volumes in the VOL_STATE_DELETED state effectively do not exist. So,
when receiving an FSYNC_VOL_QUERY_VOP request for a volume, report
FSYNC_UNKNOWN_VOLID for a volume in the VOL_STATE_DELETED state.
Similarly, if the volume exists but on a different partition, we
should return the FSYNC_WRONG_PART reason code.
This allows volumes to be usable by the volume server in some corner
cases. For example, when a volume X exists on partitions A and B, and
the volserver deletes X on B. The fileserver then puts volume X in the
DELETED state, allowing checkouts over fsync, but FSYNC_VOL_QUERY_VOP
reports that no vop exists.
With this change, FSYNC_VOL_QUERY_VOP will instead report that the
volume does not exist, and so FSYNC_VerifyCheckout can succeed for
such volumes.
Change-Id: I6c4f7deead745ddba44963a9f66a9f2ef25686a5
Reviewed-on: http://gerrit.openafs.org/3493 Reviewed-by: Tom Keiser <tkeiser@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
Andrew Deason [Thu, 9 Dec 2010 19:02:16 +0000 (13:02 -0600)]
DARWIN: Fix setpag syscall error detection
Darwin uses the same variable as the return value for
ioctl_afs_syscall, and as the last 'out' parmater, so the return value
for ioctl_afs_syscall will always overwrite whatever is written to the
last 'out' parameter. Instead, record two different variables, and
allow the returned error to overridte the error set as the last
parameter.
Christof Hanke [Sat, 4 Dec 2010 08:09:59 +0000 (09:09 +0100)]
Fix mech of building export on AIX
Presently, the distinction between 32Bit and 64Bit AIX is done by
inserting a "#" (comment-sign) into the Makefile.
This fails on some AIX-installations. Thus, just use normal
conditionals for distinguishing betwenn 32 and 64 bit.
Andrew Deason [Wed, 8 Dec 2010 17:40:24 +0000 (11:40 -0600)]
Fix AUD_HOST callers
Servers using the AUD_HOST audit message should give the host IP in
network-byte order, as that is how the auditing code interprets it.
Fix the users of AUD_HOST that do not do so.
Andrew Deason [Tue, 7 Dec 2010 19:31:36 +0000 (13:31 -0600)]
auth: Return SuperUser identity for localauth
The caller expects identity to be populated when we return 1. So for
localauth, give it an identity. Don't set uname, and in fact, move the
uname declaration so that it is clear that it's not used for most of
this function.
Andrew Deason [Tue, 7 Dec 2010 16:50:31 +0000 (10:50 -0600)]
SOLARIS: Free vcache mappings on shutdown
Right before shutdown, go through all of our vcaches and flush them,
freeing any pages associated with the vcaches. If we don't do this,
pages associated with our vcaches may still be around after we
shutdown and the module is unloaded, causing a panic when the kernel
tries to deference the page's vnode.
Abstract out afs_freevfs() following the gafs_foo/afs_foo convention
from the vnode ops, since we're calling this in two different places.
Andrew Deason [Mon, 6 Dec 2010 20:27:22 +0000 (14:27 -0600)]
RX: Always define kernel XDR symbols to be AFS XDR
Always define xdr_foo to afs_xdr_foo when we're in the kernel.
Otherwise, we can get warnings that our xdr_foo symbols are colliding
with the xdr_foo symbols from the kernel.
Andrew Deason [Mon, 22 Nov 2010 02:29:11 +0000 (21:29 -0500)]
Remove unreached lines
Fix some macros to eliminate unreached trailing empty statements (such
as: "{code = foo; goto error;};"), and other oddities causing
"statement not reached" warnings. Also eliminate a couple of code
blocks that were never reached.
Andrew Deason [Mon, 6 Dec 2010 19:29:31 +0000 (13:29 -0600)]
roken: Export rk_daemon, not daemon
We never export a function called 'daemon'. We only export a function
called rk_daemon, and the define daemon to rk_daemon. So, only include
rk_daemon in the map file, since that is the only symbol that will
appear.
Andrew Deason [Thu, 12 Aug 2010 19:38:55 +0000 (14:38 -0500)]
libafs: Set tvcp->callback before BulkStatus
When we call InlineBulkStatus or BulkStatus, we currently do not touch
tvcp->callback for any of the vcaches before making the call. This can
cause us to not notice an InitCallBackState issued by the fileserver
before the BulkStatus call returns, since the InitCallBackState
handler looks at tvcp->callback to determine what vcaches to clear
callbacks for. In turn, this can cause us to think we have a callback
agreement with the fileserver on one of the BulkStatus'd files, when
the fileserver does not actually have such a callback agreement.
So, set tvcp->callback to the server we are contacting, so if we get
an InitCallBackState call from that fileserver, the CBulkFetching
state will be cleared, and we will correctly discard the callback
information for that vcache.
Stefan Kueng [Fri, 3 Dec 2010 20:24:33 +0000 (21:24 +0100)]
Windows: afs_shl_ext folder bkgrnd context menu
Make the context menu handler also work for folder backgrounds
and on Win7 for library folder backgrounds
For folder backgrounds, the shell passes the PIDL of the folder
instead of a data object. Extract the path from that PIDL. Also
extended the register function of the dll to add the required
registry keys.
Jeffrey Altman [Wed, 1 Dec 2010 23:47:29 +0000 (18:47 -0500)]
Windows: Remove fallback from GetCaps to GetTime
If the file server responds to RXAFS_GetCapabilities with
RXGEN_OPCODE the server is up and there is no need to fallback to
RXAFS_GetTime. Remove the code that performs the extra work.
Andrew Deason [Fri, 3 Dec 2010 22:39:57 +0000 (16:39 -0600)]
LINUX: Define zero_user_segment
When the kernel does not have the zero_user_segments function, we
define it ourselves. Also define the zero_user_segment function, since
we use it, and a kernel lacking zero_user_segments will also lack
zero_user_segment.
Change-Id: I5c786d2af27227793a7a2768d1af76ccd2d6a415
Reviewed-on: http://gerrit.openafs.org/3432 Tested-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Matt Benjamin <matt@linuxbox.com> Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
OpenBSD: Remove duplicate assignment of COMMON_INCLUDE in libafs
When building libafs, the make file variable COMMON_INCLUDE is
assigned a value in two places: Makefile.common.in and
MakefileProto.OBSD.in. The assignment in the latter place is both
wrong and unnecessary. Remove it.
The netinet/in.h header file requires the inclusion of sys/types.h
(or some portion thereof). Most systems include it implicitly
within netinet/in.h. Some, such as OpenBSD, do not. In kopenafs.c,
sys/types.h is included after netinet/in.h which is fine in most
cases but means that, as a result, it will not compile on OpenBSD.
Moving sys/types.h before netinet/in.h solves this problem (and
should cause no problems on any other system).
Matt Benjamin [Wed, 3 Nov 2010 21:02:19 +0000 (17:02 -0400)]
unix cm rx-oblivious connection pooling
Implements a connection pool for Rx client connections with the
same credentials. The code trivially avoids the limit on Rx
call channels, without touching Rx directly. The conn call limit
is known to be hit in cache-bypass, and probably other use cases,
so there is an incentive to address it potentially sooner than
larger Rx changes are ready to merge.
Upgrade to exclusive lock before calling find_preferred_connection.
Unset trace option. Fix a warning around modular increment of
select_index, we'll go with the change suggested by Marc, I don't
see a real need to save the value mod CVEC_LEN.
because of how we configure afsdb, we can end up needing libresolv
but not configuring it for threaded code. link it in. at the same time,
make sure the link can succeed on e.g. macos
The osi_PostPopulateVCache() routine in the OpenBSD version of
osi_vcache.c tries to use the non-existent variable "vc" instead
of "avc". This fixes it.
OpenBSD: Fix use of mstat Length field in osi_vm.c
The code for osi_VM_FlushPages() in osi_vm.c for OpenBSD incorrectly
tries to access field "m.Length" in the vcache structure "avc"
instead of "f.m.Length".
Ben Kaduk [Sun, 28 Nov 2010 04:25:03 +0000 (23:25 -0500)]
FBSD: clean up rx_socket teardown
We had previously been waiting for the SO_ISDISCONNECTED flag
to show up in the so_state field, but the flags are not really
used for stateless protocols such as UDP, and that flag never
shows up. Even with a full three-second wait, the rxk_Listener
sometimes still failed to fully terminate, preventing the reuse
of the rx port for a restarted afsd.
Copy from Solaris and loop until rxk_ListenerPid is zero, doing
bogus one-byte NetSends in the body of the loop.
Change-Id: I6a5ad4509549fa64c551af642ef5867602b182c0
Reviewed-on: http://gerrit.openafs.org/3391 Reviewed-by: Matt Benjamin <matt@linuxbox.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
Asanka C. Herath (9):
Windows: Registry based configuration
Rename get_entry() -> _krb5_config_get_entry()
Deal with quoted strings when reading lists of config strings
Add missing export and calling convention annotations
Windows: Build and export localtime_r
Windows: Older Windows SDKs need <winsock2.h>
More compatibility macros
Increase KBR5_BUFSIZ to 2048 and use it in config_file.c
Deal with backslash escaped quotes
Love Hornquist Astrand (3):
provide symbol renameing for sha512 and sha384
less exit with failures
add random abstraction
Simon Wilkinson [Wed, 1 Dec 2010 17:42:23 +0000 (17:42 +0000)]
Build and use roken's mkstemp
Add roken's mkstemp to the build on all platforms, either through
configure (Unix) or explicitly (Windows). Change all callers so
that mkstemp is used unconditionally, rather than falling back
to more risky alternatives.
This is based on original change from Russ Allbery submitted as
http://gerrit.openafs.org/2146
OpenBSD: Use Darwin version of afsi_SetServerIPRank() for OpenBSD 4.7 and above.
With OpenBSD 4.7, the ia_subnet and ia_subnetmask fields have been removed
from the in_ifaddr structure as part of a cleanup that considers them
unnecessary. Thus, the version of afsi_SetServerIPRank() that OpenBSD was
using no longer compiles. On the other hand, the Darwin version of this
routine seems suited to OpenBSD's needs since it doesn't use those fields
so we'll use that version for OpenBSD 4.7 and above instead.
Darwin: Assign correct value to myDstaddr in afsi_SetServerIPRank()
The value in sin->sin_addr.s_addr that's assigned to myDstaddr in the
Darwin version of afsi_SetServerIPRank() is in network byte order but
really needs to be in host byte order.
Note: This patch assumes that change I66f5c790d8c55b359e3550b6d71f3abe040a2820
has been previously installed. The patch fails otherwise.
Change-Id: I3078da1efb94f87f84dbe357f3272d908818256b
Reviewed-on: http://gerrit.openafs.org/3402 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
DARWIN: Fix processing using rx_ifaddr_* macros in afsi_SetServerIPRank()
The macros rx_ifaddr_address, rx_ifaddr_netmask, and rx_ifaddr_dstaddress
all expand to a call to memcpy() which returns the destination address as
its return value. The test in the DARWIN version of afsi_SetServerIPRank()
for completion when using this macro, however, seems to assume that success
returns zero, which is wrong and results in myAddr, subnetmask, and
myDstaddr always being set to zero. This patch corrects this behaviour.
Marc Dionne [Wed, 24 Nov 2010 00:08:24 +0000 (19:08 -0500)]
Cache bypass: switch to rx_Readv
Tests show that cache bypass doesn't scale very well past a few
concurrent processes, with a lot of lock contention in the RX
layer. Switching the implementation to the iovec based rx_Readv
alleviates much of this.
Also take advantage of the fact that the upper layer readpages
only sends down contiguous lists of pages, and issue larger read
requests and populate the pagecache pages from the iovecs we
get back. The loop logic is changed significantly to accomodate
the new pattern.
Read throughput is improved by about 30-40% for some parallel read
benchmarks I use. Along with some other tweaks, it can allow the
throughput to be more than doubled.
Andrew Deason [Thu, 9 Sep 2010 14:41:40 +0000 (09:41 -0500)]
vos: Improve release recovery on timed-out trans
When a portion of 'vos release' takes long enough that a transaction
on one or more RO sites times out, it retries to release to those
sites. However, it does not take into account the situation where the
transaction on the original RO clone has also timed out, which it
usually will have if we took a long time to get to the ForwardMulti
stage for any reason.
Add a check to see if the clone RO transaction has timed out, and if
so, recreate the transaction on it. Check if the volume appears to
have changed at all, and if it has, bail out.
Jeffrey Altman [Fri, 26 Nov 2010 07:55:03 +0000 (02:55 -0500)]
Windows: NSIS installer requires the architecture for CL=1400
The NSIS installer at present is 32-bit only. Production releases
of OpenAFS have always been performed using the CL=1310 compiler
so it wasn't noticed that src/WINNT/install/NSIS/NTMakefile did
not define the ARCH (architecture) for the purpose of identifying
which redistributable runtime library installer should be
integrated into the build. For the CL=1310 compiler there are
not prebuilt installers for OpenAFS to integrate.
Jeffrey Altman [Fri, 26 Nov 2010 07:51:16 +0000 (02:51 -0500)]
Windows: make use of AFSDEV_BIN and set the PATH
ntbuild.bat defines AFSDEV_BIN which is set to the list of
directories from which executables required for the build
process will be executed. However, this value was never used
to modify the PATH environment variable. Make it do so.
Christof Hanke [Sun, 21 Nov 2010 22:01:53 +0000 (23:01 +0100)]
check curses-libs by configure
Presently, the used curses-library are determined by OS.
The leads to a build error when no curses-headers are installed.
Use configure to test if curses.h or ncurses.h is present.
ncurses takes precedence over curses.h.
If neither the curses- nor ncurses-libs are available, do not build
afsmonitor and scout.
A summary at the end of the configure should make this clear to
everyone.
The variable TXLIBS has been renamed to LIB_curses.
Christof Hanke [Sun, 17 Oct 2010 06:54:06 +0000 (08:54 +0200)]
Add output-table to libafsutil
This adds the complex structure Table to libafsutil.
All binaries linking to libafsutil can use this to store their output
in the table. This table can be sorted by a predefined column.
The available output formats are ASCII, CSV and HTML.