openafs.git
12 years agovolinfo: accept -sizeonly for -sizeOnly
Michael Meffie [Fri, 27 May 2011 22:17:44 +0000]
volinfo: accept -sizeonly for -sizeOnly

For consistency, allow -sizeonly (all lowercase letters) to
request the size summary. The old option name, -sizeOnly is
available as an alias.

Define the command line option parameter positions and use
those to set and look up the options.

Change-Id: Ie6a780e02bfa35cd5399364bab614b260c391abc
Reviewed-on: http://gerrit.openafs.org/4741
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: accept vice partition id for -part option
Michael Meffie [Fri, 27 May 2011 16:22:34 +0000]
volinfo: accept vice partition id for -part option

Accept a partition id for the -part option. For example, -part a
is the same as -part /vicepa.

Change-Id: I59d9cb71a49bbfc631c7975a859ebc3e5eccdf1a
Reviewed-on: http://gerrit.openafs.org/4739
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: comments
Michael Meffie [Fri, 27 May 2011 15:29:33 +0000]
volinfo: comments

Add doxygen style comment headers.

Change-Id: Id8e18a102e8aa5fbb0a0e0f3c58983d93bf2bb50
Reviewed-on: http://gerrit.openafs.org/4738
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: fix file size data type
Michael Meffie [Fri, 27 May 2011 14:27:03 +0000]
volinfo: fix file size data type

Use afs_sfsize_t for file size instead of int.

Change-Id: If68fca11183cd7b3ecd3750609f1b989af7445f5
Reviewed-on: http://gerrit.openafs.org/4737
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: avoid exit on errors
Michael Meffie [Fri, 27 May 2011 01:58:11 +0000]
volinfo: avoid exit on errors

Instead of exiting on errors, try to carry on.

Change-Id: Ia8da9403c57c19ac25a3ef4dac36c3e71bd1be25
Reviewed-on: http://gerrit.openafs.org/4736
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: refactor mode variables
Michael Meffie [Tue, 24 May 2011 14:28:37 +0000]
volinfo: refactor mode variables

Untangle the various global mode variables, which became muddled when dsizeOnly
and saveinodes were introduced. DumpInfo now indicates the default mode and
DumpVnodes means print the vnode entries, not scan but sometimes print.  Remove
unused globals.

Change-Id: I9d331a19afede864ad1d23477f5e3948e59558ec
Reviewed-on: http://gerrit.openafs.org/4735
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: refactor volume and vnode handling code
Michael Meffie [Mon, 23 May 2011 02:53:46 +0000]
volinfo: refactor volume and vnode handling code

Refactor volume and vnode handling code for better
maintainability.  Move the code invoked by -saveinodes to a new
function. Remove an unneeded else clause in HandleVolumes.

Change-Id: I02d9392ce065f78e5e84b902668b5d84242d7f5a
Reviewed-on: http://gerrit.openafs.org/4734
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: refactor size counters
Michael Meffie [Thu, 26 May 2011 01:54:06 +0000]
volinfo: refactor size counters

Put the volume, partition, and server size counters into structures.

Change-Id: I3bb7a25b39e191b7717dc725604fe5fe1be8045c
Reviewed-on: http://gerrit.openafs.org/4733
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: refactor -sizeOnly printing
Michael Meffie [Wed, 25 May 2011 22:19:22 +0000]
volinfo: refactor -sizeOnly printing

Refactor the -sizeOnly output processing to reduce code
duplication and coupling with -saveinodes.

Change-Id: I4d1c53678732afebba83813be676a292e2d8e62c
Reviewed-on: http://gerrit.openafs.org/4732
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoEnable gencat for i386_fbsd_*
Ben Kaduk [Tue, 31 May 2011 19:25:35 +0000]
Enable gencat for i386_fbsd_*

The machines certainly have a /usr/bin/gencat, and I see nothing
in history to indicate a reason for this prevention.
Allow the 32-bit machines to build afszcm.cat and make packaging
more uniform between architectures.

Change-Id: If1017d28cc804d58cfb29019158ad5b3d70da9ac
Reviewed-on: http://gerrit.openafs.org/4760
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

12 years agovlserver: Add flags to extent address entries
Simon Wilkinson [Mon, 23 May 2011 05:24:09 +0000]
vlserver: Add flags to extent address entries

Add a "flags" field to the extent address entry so that we can store
per server bit flag information. Rename the header flags feel (and
corresponding macro) so that it's explicitly a header flag. Take
this opportunity to also fix this comment to clarify that the header
flags are not a copy of anything from the vlentry, but that they
must be at the same structure offset as the vlentry flags field (so
that something accessing an extent block as if it was a vlentry can
see what it is from the flags)

Change-Id: If8a4816418d9400fb971679c08b4777e7d83c983
Reviewed-on: http://gerrit.openafs.org/4776
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovlserver: Make space in extent block explicit
Simon Wilkinson [Mon, 23 May 2011 05:20:35 +0000]
vlserver: Make space in extent block explicit

The address entry side of the union within the extent addr block
actually has a significant amount of free space. It looks as though
the original author assumed that a UUID required 16 32-bit words,
rather than 16 octets, and sized the structure to match.

Make the free space within the structure explicit, so that it can
be used for future expansion

Verified with
  gdb vlserver
    (gdb) print sizeof(struct extentaddr)
    $1 = 128

Change-Id: If67f669fb298763f054ce82447a4513c59ef7526
Reviewed-on: http://gerrit.openafs.org/4775
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovlserver: Rationalise multi homed host processing
Simon Wilkinson [Thu, 19 May 2011 18:15:44 +0000]
vlserver: Rationalise multi homed host processing

The same code for getting extent structures for multi homed hosts
was scattered throughout vlprocs.c, sometimes with error handling,
and sometimes without. Rationalise all of this into a pair of
static inline functions, which do all of the hard work.

Change-Id: Ib0f55e5b5f455b07753409ebff2a5cd0ca188cda
Reviewed-on: http://gerrit.openafs.org/4774
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovlserver: Use correct memsets in vlentry convertor
Simon Wilkinson [Thu, 19 May 2011 17:56:27 +0000]
vlserver: Use correct memsets in vlentry convertor

The various vlentry_to_<blah> conversion functions have obviously
been copy and pasted from each other. However, the size of the
structure which is being zeroed has not been updated when we are
zeroing different structures. Fix this, so that we always clear all
of the structure that we are filling.

Change-Id: Ic822e1d2b17494574074c332c7680e94d4701c66
Reviewed-on: http://gerrit.openafs.org/4773
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovlserver: Clean up abort logic
Simon Wilkinson [Thu, 19 May 2011 17:53:27 +0000]
vlserver: Clean up abort logic

Clean up the failure logic in the server RPC handlers so that there
is always a single exit point upon aborts. This should make it much
easier to fix the various problems with cleaning up memory when
RPCs fail.

Change-Id: Ia5f8e97c37bf4aca1c8f2597a21eb54d1ba094fb
Reviewed-on: http://gerrit.openafs.org/4772
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovlserver: Use correct base value when replacing
Simon Wilkinson [Thu, 19 May 2011 17:19:29 +0000]
vlserver: Use correct base value when replacing

When we're removing existing address entries the code calculates
a base and index value for each entry that we're removing an address
from. However, it then _uses_ a previously calculated base value,
with the new index. This works fine if the old base and the new base
match, but if they don't, chaos will ensue.

Fix to always use matched base and index pairs.

Change-Id: Ia592abdc1c58b5cf5776bb24e67aee708275a9b0
Reviewed-on: http://gerrit.openafs.org/4771
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovlserver: Rename errorcode to code
Simon Wilkinson [Thu, 19 May 2011 16:57:30 +0000]
vlserver: Rename errorcode to code

The convention in the OpenAFS code is to use 'code' or 'ret' for
return values from functions. Rename 'errorcode' in vlprocs.c to
be in keeping with this convention.

Change-Id: Idffd6eccdd820cb602e5c7cd66ebaa4fbd37c6b5
Reviewed-on: http://gerrit.openafs.org/4770
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovlserver: Tidy up request counting
Simon Wilkinson [Thu, 19 May 2011 14:06:15 +0000]
vlserver: Tidy up request counting

Tidy up the counting of requests and aborts in the vlserver. Don't
hide a variable allocation within a macro, convert macros to inline
functions, and make it possible to not count particular operations
by passing in an opcode of 0.

Change-Id: Ifd26027ebb97a6039b6f7f7289ffbe166627390b
Reviewed-on: http://gerrit.openafs.org/4769
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoBuild system: Move install definitions to include
Simon Wilkinson [Sun, 14 Nov 2010 21:43:11 +0000]
Build system: Move install definitions to include

Move the definitions of the INSTALL_* variables out to
Makefile.config rather than replicating them in each file.

Change-Id: I5f74dcbf544a93716994418bee3be2c51a2a82d0
Reviewed-on: http://gerrit.openafs.org/4781
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoaklog: Remove Windows specific code from header
Simon Wilkinson [Sat, 4 Jun 2011 17:04:48 +0000]
aklog: Remove Windows specific code from header

When commit 3f54c934b9c933d5f34644a096c821375db17d97 removed all of
the Windows code from aklog, it missed the stuff in aklog.h. Get
rid of this too, for clarity.

Change-Id: I6d408ffc313d18fd512fa03494a15ec628f1e292
Reviewed-on: http://gerrit.openafs.org/4782
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoubik: Initialise global version lock before use
Simon Wilkinson [Sat, 4 Jun 2011 15:41:41 +0000]
ubik: Initialise global version lock before use

Commit e4ac552ab79be21d90397079eaf6be7050497752 introduced a global
version lock to ubik, but doesn't initialise this lock before make use
of it. On platforms which require that pthread mutexes are initialsed,
this causes an assertion failure.

Initialise this lock at the same time as we MUTEX_INIT all of our other
locks.

Change-Id: Ib5ef75d443101a823738fba55c0760cb1848dbcf
Reviewed-on: http://gerrit.openafs.org/4780
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agocmd: Reorder cmd_AddParmAtOffset arguments
Michael Meffie [Mon, 30 May 2011 18:23:49 +0000]
cmd: Reorder cmd_AddParmAtOffset arguments

Reorder the arguments of this recently introduced function to
make client code more readable.

Change-Id: I37f662f849bd96176230f75783e2a1c62d94b8c9
Reviewed-on: http://gerrit.openafs.org/4755
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoxstat: print collection values in debug mode
Michael Meffie [Mon, 13 Dec 2010 19:53:50 +0000]
xstat: print collection values in debug mode

Print the values of the integers returned in the collection data
when the -debug option is given to xstat_fs_test and xstat_cm_test
test programs. This allows us to at least see what the unformatted
values are when there is a mismatch in timeval sizes between the
host and client (aka the 32/64 bit xstat bug). This change could
break scripts which call the xstat test programs with the debug
option. New debug output are prepended with 'debug:' to be
easily ignored.

Change-Id: I12d8d27306c50fb9f35ade2a080b3bc20542b63f
Reviewed-on: http://gerrit.openafs.org/2878
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agofs: add support for relative ACL changes
Rainer Strunz [Sun, 17 Apr 2011 23:09:33 +0000]
fs: add support for relative ACL changes

This change permits "fs setacl" to change ACLs in a relative
manner, rather than just setting rights absolutely as it is
done now.

If a single plus (+) or minus (-) character is appended to
the rights' letters argument, the new rights are computed
relatively to the existing ones.

A few examples should make clear that behaviour:

old rights: rights set: new rights:
-----------------------------------------------
rl a+ rla
rlid idwa- rl
rla write- a
rl write- [none] (ie. entry deleted)
[any] read= rl

As shown in the last example, a '=' character got implemented
also (and for free) as an alternative writing of the current
and default behaviour of just setting an ACL.

FIXES 123962

Change-Id: If15a4ab3c69ec44a42c8746a0b93f5e8b785d61e
Reviewed-on: http://gerrit.openafs.org/4496
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agodir: Prototype and function name cleanup
Simon Wilkinson [Fri, 6 May 2011 09:40:38 +0000]
dir: Prototype and function name cleanup

Tidy up typing in the dir package, so that we have a specific type
for a directory file handle.

Also rename all of the functions to afs_dir_* globablly, rather than
just renaming for kernel code.

Change-Id: I6750a8eb9f0606d5debf9d677a92b9c8a63dbcf3
Reviewed-on: http://gerrit.openafs.org/4745
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

12 years agodir: Explicitly state buffer locations for data
Simon Wilkinson [Wed, 27 Apr 2011 18:24:56 +0000]
dir: Explicitly state buffer locations for data

DNew and DRead always returned directory page aligned pointers,
however the directory code further manipulates those pointers,
requiring the DRelease be able to fill a page when passed a pointer
to any address within that page. This is relatively straightforward
in the userspace implementation, but much more complex in the kernel,
where all of the directory pages are not necessarily contiguous.

Resolve this issue by making DNew, DRead and DRelease all return a
new structure, struct DirBuffer. This structure contains both a
pointer to the data, and an implementation specific private
pointer to data describing the page containing the address. The
directory code is free to play with the data pointer as it wishes,
as long as the private pointer to the page is passed through intact.

DRelease (and DVOffset) can then simply use the private pointer for
their operations, without having to walk page lists.

This new behaviour also requires changes to the directory functions
GetBlob, FindItem and FindFid which all return pointers to directory
data.

Change-Id: I8b8b003b789976b593a7c752969f47d55f4ee707
Reviewed-on: http://gerrit.openafs.org/4744
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agodoc: bos != vos
Simon Wilkinson [Mon, 30 May 2011 19:11:49 +0000]
doc: bos != vos

As it says on the tin

Change-Id: I2c03f51303d01ccc772c1fc0b2ed1dd0b176892d
Reviewed-on: http://gerrit.openafs.org/4764
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovos: Don't leak/overflow bulkaddrs
Simon Wilkinson [Tue, 31 May 2011 07:28:51 +0000]
vos: Don't leak/overflow bulkaddrs

The vos listaddrs command repeatedly reuses a bulkaddrs array. It
zeros it once (without freeing the allocated memory), and then
repeatedly uses it without zeroing in a loop. This means that the XDR
library assumes that a sufficiently large block is already allocated,
doesn't reallocate for the incoming data, or check limits.

This means that if the first call to VL_GetAddrsU returns a set of
addresses smaller than subsequent calls, we'll write past the end
of the array, causing memory corruption.

Fix this by freeing the arrays correctly with each pass of the call.

Change-Id: I540d369c1529ec3574548f42cbd48b6c2b38cebd
Reviewed-on: http://gerrit.openafs.org/4756
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agolibafscp: fix install/dest in sep. Objectdir
Christof Hanke [Wed, 1 Jun 2011 09:48:46 +0000]
libafscp: fix install/dest in sep. Objectdir

When compiling libafscp in separate objdir,
make dest and make install fail, because of wrong
pathes. Fix it.

Change-Id: Id2b672bce308609d99b343322babe890ec8d6a38
Reviewed-on: http://gerrit.openafs.org/4761
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoPort cache manager to NetBSD-5 and NetBSD-current
Jonathan A. Kollasch [Mon, 16 May 2011 14:30:24 +0000]
Port cache manager to NetBSD-5 and NetBSD-current

Change-Id: I3d1aa0b22bb8533718f48bd4424743299d5de019
Reviewed-on: http://gerrit.openafs.org/4661
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

12 years agomacos: bulkstat sysctl
Derrick Brashear [Thu, 26 May 2011 06:04:08 +0000]
macos: bulkstat sysctl

make bulkstat enable/disableable via sysctl

Change-Id: Ib1657964d62e402e96762394b7b61ed5e58a5fc9
Reviewed-on: http://gerrit.openafs.org/4723
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agomake bozo honor -rxbind correctly
Adam Megacz [Fri, 23 Mar 2007 19:14:41 +0000]
make bozo honor -rxbind correctly

Bozo needs to call rxInitHost() rather than rxInit() when -rxbind is
present. This patch causes it to read NetInfo/NetRestrict earlier in
the startup process so it can make that decision.

FIXES 57286

Change-Id: I17058f4e8e5c23fdfcfe56178d5edc5dcceafb7a
Reviewed-on: http://gerrit.openafs.org/4729
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agomacos: bulkstat caller reference handling
Derrick Brashear [Thu, 26 May 2011 05:39:18 +0000]
macos: bulkstat caller reference handling

if bulkstat is called and fakes up vnodes for non-dir cases, it can
guess wrong, and we end up needing to fix up the type by swapping
in a new vnode under the vcache. however, references are tracked on
the vnode, and more importantly, callers can know about the vnode;
unlinking a vcache from a vnode leaves null pointers to blow up on.

thing is, we shouldn't end up with a un-fixed-up vcache in use:
any caller of ProcessFS will notice if the vnode is the wrong type,
and fix it. so in order to reach CStatd, we have to fix it.
the only places where we can get a vcache in use not CStatd are:
FindVCache, LookupVCache, GetVCache where InReadDir. The last happens
only on Linux. LookupVCache doesn't happen anywhere that matters
(CForeign, or we immediately dispose...). FindVCache is only called
somewhere which won't lead to us fixing up during create, but that
vnode isn't returned to callers; we finalize in the result of create
and return the vnode that's linked to the vcache, which will be correct.

so, the only other place we can have a reference which won't immediately
get fixed up is in lookup, across the bulkstat call. if that's true,
and we return from bulkstat a non-CStatd vcache, lookup will fill in the
entry manually. so, if there are references remaining after we do a fixup,
unmark CStatd so the caller (presumably lookup, given the above) will give
back the vcache and retry, getting a corrected vnode as a result, with
the reference on the vnode we want it on.

Change-Id: I3b225c8d48067624f3cbac7b1f897e52193a8d55
Reviewed-on: http://gerrit.openafs.org/4722
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agolinux: add read_descriptor_t configure test and ifdef
Christof Hanke [Thu, 26 May 2011 05:46:32 +0000]
linux: add read_descriptor_t configure test and ifdef

With linux 2.6.8 the struct read_descriptor_t changed.
Add a configure-test and respective ifdef to deal with that.

Change-Id: Iff1a6252707cd2119bdc0382c641934119ea0422
Reviewed-on: http://gerrit.openafs.org/4719
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoautoconf: add test for typedef'd structs
Christof Hanke [Wed, 25 May 2011 20:16:59 +0000]
autoconf: add test for typedef'd structs

AC_CHECK_LINUX_STRUCT does not work for structs which are typedef'd.
The gcc will complain with "error: storage size of ‘_test’ isn’t known"
and fail the test.
Thus the new test-macro AC_CHECK_LINUX_TYPED_STRUCT.

Change-Id: Ib3e933c4e09a3e950ca8d8e7a66909d86f10cfdf
Reviewed-on: http://gerrit.openafs.org/4718
Reviewed-by: Christof Hanke <christof.hanke@rzg.mpg.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoFBSD: VIMAGE support
Ben Kaduk [Thu, 26 May 2011 05:11:14 +0000]
FBSD: VIMAGE support

Starting in FreeBSD 8.0, there is support for multiple virtual
network stacks (generally to be exposed to separate jail(8) environments).
It is enabled as a kernel configuration option, so our builds against
GENERIC have not failed, but we fail to build when options VIMAGE
is present.  Fix our variable references accordingly.

Change-Id: I679361b8ea62b0eae90c0aa61287dfc2dd189481
Submitted-by: Hiroki Sato of freebsd.org
Reviewed-on: http://gerrit.openafs.org/4721
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agotests: Make -flag the first parm in command-t
Andrew Deason [Mon, 23 May 2011 22:04:20 +0000]
tests: Make -flag the first parm in command-t

Move the -flag parameter to be the first parameter, to test more of
the positional argument handling.

Change-Id: I637c58e8c76bfc23919f29a1c598084275426773
Reviewed-on: http://gerrit.openafs.org/4710
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agotests: Use symbolic constants in command-t
Andrew Deason [Mon, 23 May 2011 21:51:59 +0000]
tests: Use symbolic constants in command-t

Change-Id: I1d7e47edc97dcdb855ad5ca732a2f015741c9d18
Reviewed-on: http://gerrit.openafs.org/4709
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agotests: Correctly pass string args in superuser-t
Andrew Deason [Mon, 23 May 2011 20:42:10 +0000]
tests: Correctly pass string args in superuser-t

We need to give a NULL pointer for string OUT arguments, so XDR knows
to allocate a new string. Also free the string each time so it gets
set back to NULL.

Change-Id: I1eb0c63dc4019b855a2cbecd9e35393f2fbb0fd7
Reviewed-on: http://gerrit.openafs.org/4708
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agocmd: Add cmd_OptionAsUint
Simon Wilkinson [Mon, 25 Apr 2011 13:35:56 +0000]
cmd: Add cmd_OptionAsUint

Add an accessor function which can return a unsigned int for an
option value.

Change-Id: I33bc9a2618191ca60b95086624100b54efb05ab2
Reviewed-on: http://gerrit.openafs.org/4652
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agocmd: Fix parsing positional args
Andrew Deason [Mon, 23 May 2011 22:11:28 +0000]
cmd: Fix parsing positional args

If the first parameter of a libcmd syntax is a flag, cmd_Parse was
skipping over positional arguments, since j will be 0 at this point
(the j variable is only used if we're processing an explicit switch).
Effectively revert this area to what it was before
a2f1ca5fd52ac2fb7e68b101bbe3da9878c10474 so such positional parameters
work again.

Also move the j variable to inside the only block in which it is used,
to try and avoid such mistakes in the future.

Change-Id: Ifa52cecf50a3f561c70de351a9ebd026e90eeeab
Reviewed-on: http://gerrit.openafs.org/4711
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoWindows: ChangeLog for 1.5.9906 (1.6.0pre6)
Jeffrey Altman [Mon, 23 May 2011 17:26:20 +0000]
Windows: ChangeLog for 1.5.9906 (1.6.0pre6)

Change-Id: Ie799849d3e538b98afc49e6003b6b0f595308da5
Reviewed-on: http://gerrit.openafs.org/4706
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoReplace uintptr_t type cast with uintptrsz in afs_vcache.c
Antoine Verheijen [Tue, 17 May 2011 15:40:15 +0000]
Replace uintptr_t type cast with uintptrsz in afs_vcache.c

A recent change (commit 80fe111f0044aa7a67215ad92210dc72cb7eb2c0)
to afs_vcache.c contains a call to afs_warn() whose second parameter
contains a "(uintptr_t)" type cast as part of a double type cast.
This presents an issue on some systems, such as OpenBSD, where this
object type is defined in a header that is not presently included.
This change modifies that type cast to instead use the AFS-internal
"(uintptrsz)" type which should provide the same effect.

Note that an earlier version of this patch ateempted to remove the
"offending" type cast as redundant but it was pointed out that some
systems require this kind of cascading type cast when casting pointers
to integers to deal with possible size issues.

Change-Id: Iea81b2be1050a1c929978a99c518d86c6d1f2118
Reviewed-on: http://gerrit.openafs.org/4671
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

12 years agocmd: Include aliases in help output
Simon Wilkinson [Sun, 24 Apr 2011 19:28:02 +0000]
cmd: Include aliases in help output

Include any command aliases in the output from the -help option

Change-Id: Ifb2ac96d9ba6fc64bffff69bac9480a6b7e8568e
Reviewed-on: http://gerrit.openafs.org/4651
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: print namei filenames of index files
Michael Meffie [Sun, 22 May 2011 00:56:23 +0000]
volinfo: print namei filenames of index files

On namei fileservers, also print the namei filenames of the volume special
files when the -header flag is given.

Change-Id: I90112f13d0f39348ee3862fdbdb55074e8877108
Reviewed-on: http://gerrit.openafs.org/4696
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: remove code duplication in HandleVolumes
Michael Meffie [Sat, 21 May 2011 16:06:43 +0000]
volinfo: remove code duplication in HandleVolumes

Reduce duplicate code for processing volume header files when printing header
details (-header) and calculating the volume size (-sizeOnly).

Change-Id: I1f1d3b3d065901379c289065dfa1999e249662a4
Reviewed-on: http://gerrit.openafs.org/4695
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: fix volume aux totals output
Michael Meffie [Sat, 21 May 2011 16:38:03 +0000]
volinfo: fix volume aux totals output

Do not print the volumes aux totals prematurely when running
volinfo with the -headers flag on an namei fileserver. Instead
print the aux totals only once after the link table size is found.

Change-Id: I4538e2fc8978530fd2e8593e0b343a2497c7a764
Reviewed-on: http://gerrit.openafs.org/4694
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: print errors to stderr
Michael Meffie [Sat, 21 May 2011 11:28:41 +0000]
volinfo: print errors to stderr

Print volinfo errors messages to stderr instead of a mix of stdout
and stderr. Print a consistent program name.

Change-Id: Ifadae52d56a75ff7d73d639ff1dd893b1a926a28
Reviewed-on: http://gerrit.openafs.org/4693
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: fix size totals when saving inodes
Michael Meffie [Fri, 20 May 2011 18:44:39 +0000]
volinfo: fix size totals when saving inodes

Fix the volume size calculation when volinfo is invoked with
both -sizeOnly and -saveinodes at the same time.

Change-Id: Ifafe6a128918500ac6fd5f9a1e39de2d4aff785d
Reviewed-on: http://gerrit.openafs.org/4691
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agodoc: document volinfo -filenames option
Michael Meffie [Fri, 20 May 2011 17:53:48 +0000]
doc: document volinfo -filenames option

Add the namei -filenames option to the volinfo man page.

Note this option as implemented implies the -vnode flag, but for
consistency with the other fields that modify the default mode
output, it is documented to be accompany the -vnode flag.

Change-Id: I7cc5cdf5e74e65ca25ecc086e550a468b803b971
Reviewed-on: http://gerrit.openafs.org/4690
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoAdded -dryrun
Jeff Blaine [Thu, 19 May 2011 03:49:52 +0000]
Added -dryrun

Added missing information about -dryrun option

Change-Id: I17f9e8c54c1d12c84476c9d19da48b0a5219e623
Reviewed-on: http://gerrit.openafs.org/4680
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agovolinfo: fix -filenames option check
Michael Meffie [Wed, 18 May 2011 17:42:27 +0000]
volinfo: fix -filenames option check

Fix the logic for checking the presense of the volinfo -filenames
option.  The original patch inadvertently added the -filenames
check as an if-else cause to the -orphaned flag check, which
prevents filenames from being printed when listing orphaned
vnodes.

Change-Id: I070d796e7ea9c0f5df9cf92a17eaa4004444d423
Reviewed-on: http://gerrit.openafs.org/4689
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agomacos: bulkstat redux
Derrick Brashear [Fri, 20 May 2011 18:13:01 +0000]
macos: bulkstat redux

simplify the logic which can require sleeps in various vcache
resolution paths. instead of the two-pass system we had before,
just guess using the even/odd hack what type a vnode will be.
if a vnode turns out to be a link and thus we are wrong, we
do a fixup later. other callers who "race" with bulkstat
(which is a supported feature, otherwise you'd have to block
callbacks) will also call through a fixup to get the correct
backing vnode type. this is necessary as the KPI doesn't
let us change the type of a vnode after it's been created.

side effect: eliminate many of the ugly cases where we had been
sleeping waiting for a vnode to be finalized even before bulkstat.

Change-Id: Ib888fa5577d48354725ea72305765e4341bc2366
Reviewed-on: http://gerrit.openafs.org/4677
Tested-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agodynroot: mark vnode types on dynroot vnodes
Derrick Brashear [Fri, 20 May 2011 18:10:49 +0000]
dynroot: mark vnode types on dynroot vnodes

when we create a vnode using a dynroot fid, we weren't bothering
to update the type from the default (typically VREG); most
dynroot vnodes are actually VDIR...

Change-Id: I1c54e8c2a3c7ffd234f3247d38730062484fec87
Reviewed-on: http://gerrit.openafs.org/4686
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoSOLARIS: Reset syscalls on mod_install failure
Andrew Deason [Thu, 19 May 2011 22:02:35 +0000]
SOLARIS: Reset syscalls on mod_install failure

If our call to mod_install fails for any reason (for example, if the
afs entry is missing from /etc/name_to_sysnum), we may still have set
the sysent structures for setgroups and ioctl to point at libafs code.
So calls to those syscalls will cause a panic, since the code they
point to is no longer loaded.

To avoid this, just reset the sysent entries back to what they were if
we fail to load, just like we do when unloading the module.

Change-Id: Ia0d6691780c749a0f550e640783c093ae45604ac
Reviewed-on: http://gerrit.openafs.org/4685
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

12 years agolibafs: Implement unixuser RW locks
Andrew Deason [Thu, 5 May 2011 20:10:54 +0000]
libafs: Implement unixuser RW locks

Currently code dealing with changing unixuser structs does not obtain
any locks protecting the contents of the unixuser struct, though some
functions like afs_GetUser have a parameter indicating what type of
lock should be obtained. This can result in the token data for a user
being changed at the same time another thread tries to use the token
data.

To ensure mutual exclusion of such operations, add a lock field to the
unixuser struct, and actually lock it according to the intentions of
the relevant code.

Change-Id: Idd66d72f716b7e7dc08faa31ae43e9a23639bae3
Reviewed-on: http://gerrit.openafs.org/4636
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

12 years agolibafs: Always use anonymous VL connections
Andrew Deason [Mon, 16 May 2011 18:45:49 +0000]
libafs: Always use anonymous VL connections

afs_NewVolumeByName was using the areq given by the caller for
afs_SetupVolume, which may represent authenticated credentials. Give
afs_SetupVolume &treq instead, which will be anonymous, so we don't
have to deal with rxkad for VL lookups.

Change-Id: Ie990028133173c312d2e5d9de4baa82b99cfdf7d
Reviewed-on: http://gerrit.openafs.org/4666
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoHide -noexecute in favor of -dryrun
Jeff Blaine [Thu, 19 May 2011 01:46:52 +0000]
Hide -noexecute in favor of -dryrun

Makes all previous -noexecute arguments hidden (still callable)
and replaces them with -dryrun whose help text has been made
common where appropriate instead of the 3 previous ways the
argument was explained.

Change-Id: I0ef3daa88dc771d972131358dc6e8a23ecd5a33b
Reviewed-on: http://gerrit.openafs.org/4678
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoauth: failback to afs3-vlserver for afs3-prserver
Jeffrey Altman [Wed, 18 May 2011 17:51:53 +0000]
auth: failback to afs3-vlserver for afs3-prserver

If the DNS SRV lookup is for afs3-prserver or afs3-kaserver,
fallback to a lookup for afs3-vlserver since those services
are traditionally hosted on the same machine as the vlserver.

FIXES 129887

Change-Id: Iec553415cd4f491ea5c32923c4023619bf6320e8
Reviewed-on: http://gerrit.openafs.org/4676
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoWindows: lock protected fields must be 32-bit
Jeffrey Altman [Mon, 16 May 2011 01:56:17 +0000]
Windows: lock protected fields must be 32-bit

It is not safe to protect two 16-bit fields in a structure
with different locks.  Switch to using 32-bit fields.

Increment the cm-memmap version number since the data structure
sizes changed and the cache file must be invalidated.

Change-Id: I867b4b85b4fd9fe0083ad9d0559311f1c287513f
Reviewed-on: http://gerrit.openafs.org/4660
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoWindows: add lock assertions to cm_buf.c
Jeffrey Altman [Mon, 16 May 2011 01:53:56 +0000]
Windows: add lock assertions to cm_buf.c

add lock assertions to cm_buf.c in hopes of detecting why
periodic buf_scacheHashTable corruption is being detected.

Change-Id: I247ad7090a9484ae76b2e56f6f53ef8ee5af1abc
Reviewed-on: http://gerrit.openafs.org/4659
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoWindows: test return from krb5_cc_start_seq_get
Jeffrey Altman [Mon, 16 May 2011 01:51:14 +0000]
Windows: test return from krb5_cc_start_seq_get

If krb5_cc_start_get fails when using Heimdal, the cursor
is invalid and it is not safe to pass it into subsequent
functions.

Change-Id: I65193fb63c33ddcbf741c21b40128785404ea920
Reviewed-on: http://gerrit.openafs.org/4658
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

12 years agodoc: -afsdb uses SRV records
Ken Dreyer [Mon, 16 May 2011 23:53:43 +0000]
doc: -afsdb uses SRV records

afsd's -afsdb option now uses DNS SRV records (RFC 5864). Update the manpages
to reflect this.

Change-Id: I944df36717b53d8545765bde68c309e0229cfc79
Reviewed-on: http://gerrit.openafs.org/4670
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoviced: Don't VTakeOffline_r without glock
Andrew Deason [Mon, 16 May 2011 20:16:30 +0000]
viced: Don't VTakeOffline_r without glock

We don't have the volume glock, so don't call _r functions.

Change-Id: I7779412fdf1333941d320234e64000dfbfed0f4f
Reviewed-on: http://gerrit.openafs.org/4669
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agoviced: Check vnode length on Rename and Link
Andrew Deason [Mon, 16 May 2011 20:02:14 +0000]
viced: Check vnode length on Rename and Link

Commit 2578555d7e08131bf2fe4cdd0aa4b32567a76eb2 added vnode length
checks when we create or remove vnodes, but not during Rename and Link
operations (when vnodes are neither created nor destroyed). Add the
check in Rename and Link.

Change-Id: I8008380a2b9e286d2dcdabaed5ceba97909dbb37
Reviewed-on: http://gerrit.openafs.org/4668
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agodoc: Add aklog_dynamic_auth manpage
Andrew Deason [Fri, 15 Apr 2011 19:18:57 +0000]
doc: Add aklog_dynamic_auth manpage

Add a manpage for the aklog_dynamic_auth LAM module.

Change-Id: Ibb8583401d565ca0caea7688ac797aa85a0d6869
Reviewed-on: http://gerrit.openafs.org/4485
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agoviced: Enable NAT ping on hosts
Andrew Deason [Thu, 12 May 2011 15:57:09 +0000]
viced: Enable NAT ping on hosts

Turn on NAT ping on the Rx connection for the callback channel for
hosts. This should help improve behavior for clients behind NATs and
stateful firewalls, even for clients that predate NAT ping
functionality.

Change-Id: I0f8e801c2225560192de9c09bfa06d0387e29af3
Reviewed-on: http://gerrit.openafs.org/4646
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoviced: h_SetupCallbackConn_r in removeAddress_r
Andrew Deason [Thu, 12 May 2011 15:21:09 +0000]
viced: h_SetupCallbackConn_r in removeAddress_r

removeAddress_r has some code that is identical to the
h_SetupCallbackConn_r function. Call the function instead.

Change-Id: I3416dd1b5c94f0e836c2461771389045994e7152
Reviewed-on: http://gerrit.openafs.org/4645
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agodasalvager: unlink fsstate.dat when standalone
Andrew Deason [Fri, 6 May 2011 18:12:17 +0000]
dasalvager: unlink fsstate.dat when standalone

If the DAFS salvager is running in a standalone mode, unlink the
fileserver's fsstate.dat file if any volumes change. Otherwise, volume
data could have changed and the fileserver will retain callback
promises for the data in those volumes until it tries to attach the
volume. This way, callbacks are broken via callback state
reinitialization.

A better solution is to record which volumes have changed, and the
fileserver can break callbacks for them on startup. But this at least
eliminates a regression from non-DAFS behavior.

Change-Id: Ie443e7d43705c3015d21bd3cad1b1e05c88562be
Reviewed-on: http://gerrit.openafs.org/4638
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agocmd tests: Initialise string retval
Simon Wilkinson [Sun, 24 Apr 2011 19:29:37 +0000]
cmd tests: Initialise string retval

The cmd_OptionAsString function attempts to free the previous value
of the string passed to it. Make sure that we initialise the return
value to NULL before passing it in in the test suite.

Change-Id: I8500d5e6812f4d1655fc50618db472c745604e41
Reviewed-on: http://gerrit.openafs.org/4653
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agolibafs: Flush vcaches in afs_shutdown
Andrew Deason [Tue, 10 May 2011 19:16:06 +0000]
libafs: Flush vcaches in afs_shutdown

Currently, a few platforms (linux, linux24, solaris, irix) flush all
vcaches during shutdown. However, they do this before calling
afs_shutdown(), resulting in afs_FlushVCache queueing VCBs and
possibly trying to give the callbacks back to the server.

Instead of this, perform the flushes in afs_shutdown itself, so we do
this after we try to give up all callbacks to all servers, and we do
this while afs_shuttingdown is set, so we don't try to queue VCBs.
This also consolidates some of the duplicated code to flush all
vcaches, and now does this for all platforms.

Change-Id: I69c9e0862972f18ecc29ff709943d9a77f2db0a9
Reviewed-on: http://gerrit.openafs.org/4641
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agolibafs: GiveUpAllCallBacks at shutdown again
Andrew Deason [Tue, 10 May 2011 18:45:26 +0000]
libafs: GiveUpAllCallBacks at shutdown again

Commit cee2c677d7de66a510d05978e3b41dcd5d8aca78 caused the cache
manager to give up all callbacks at shutdown. But
76158df491f47de56d1febe1d1d2d17d316c9a74 removed the call to
afs_FlushVCBs in afs_shutdown. Put it back.

Change-Id: I74b815af485482ab83b9115772e4f4221a731f3e
Reviewed-on: http://gerrit.openafs.org/4640
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agolibafs: Do not write-lock afs_xserver on ICBS
Andrew Deason [Tue, 10 May 2011 17:54:53 +0000]
libafs: Do not write-lock afs_xserver on ICBS

Our RXAFSCB_InitCallBackState* handler currently write-locks
afs_xserver when it clears the SCAPS_KNOWN flag for the relevant
server. However, the afs_xserver lock is for protecting the global
list and hash table of server structures, and is not necessary to
acquire in order to modify the flags of an individual server struct.
For instance, CkSrv_GetCaps does not acquire any locks to modify the
server flags.

Taking this lock conflicts with a read lock on afs_xserver acquired by
afs_FlushVCBs when it traverses the list of server structures.
afs_FlushVCBs may contact a server that then calls InitCallBackState
on us, causing a deadlock if ICBS waits for the afs_xserver lock.

So, avoid locking afs_xserver in this case, to avoid that deadlock.

Change-Id: Id4dea74ce85726a3da07f738e301600f46059297
Reviewed-on: http://gerrit.openafs.org/4639
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoFix misspelling of writable as writeable
Russ Allbery [Sun, 15 May 2011 07:32:40 +0000]
Fix misspelling of writable as writeable

Caught by Lintian in the strings in the butc binary, so I did a global
search for any other occurrences.

Change-Id: I5d5b433e716a62dc43d1c5376841e41d49e29ba5
Reviewed-on: http://gerrit.openafs.org/4657
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoLinux: fix reading files larger than the chunk size
Marc Dionne [Sun, 15 May 2011 00:57:12 +0000]
Linux: fix reading files larger than the chunk size

Commit 2571b6285d5da8ef62ab38c3a938258ddd7bac4e fixed an issue with
the use of tmpfs as a disk cache and ftruncate() on files in AFS.
But it introduced a problem reading larger files as reported in
RT ticket 129880.

What should be compared against the current cache file size is the
offset into the current chunk, not the overall offset for the whole
file.

FIXES: 129880

Change-Id: I93008c8d0b1d70785b0b8a2e4289a04ac06cbbef
Reviewed-on: http://gerrit.openafs.org/4656
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agorpm: Really undefine %dist
Andy Cobaugh [Wed, 11 May 2011 21:02:40 +0000]
rpm: Really undefine %dist

rpmbuild --eval '%undefine dist' wasn't sticking on redhat 5.x. I think
the correct way to undefine this is to --define 'dist %undefined'

Some redhat 5.x installs have %dist defined depending on what else has been
installed.

Change-Id: I9ad6854a337c2085bb2db5e5f98e7d2f9889c4e4
Reviewed-on: http://gerrit.openafs.org/4643
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoLinux: fix permission op test for certain compilers
Marc Dionne [Sat, 14 May 2011 17:19:52 +0000]
Linux: fix permission op test for certain compilers

Some compilers complain that _inode is used uninitialised here.
Since this test requires -Werror, it causes the test to fail
and our permission op to be used in RCU mode, leading to lockups.

Initialise it to make the compilers happy.

Fixes a lockup seen on kernels 2.6.38+ on Gentoo and Debian.

Change-Id: Id6325e3a5a918906d547d241a39de777fb394fdc
Reviewed-on: http://gerrit.openafs.org/4654
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoafscp: tellmeaboutyourself stub wants host byte order
Derrick Brashear [Thu, 12 May 2011 14:59:53 +0000]
afscp: tellmeaboutyourself stub wants host byte order

we get network byte order addresses from rx_getAllAddr; swap back
to host order.

Change-Id: Id0c5e70399422593c574958f905984c9edf8e6d4
Reviewed-on: http://gerrit.openafs.org/4644
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

12 years agoWindows: always try afs/cell@USER-REALM first
Jeffrey Altman [Mon, 9 May 2011 14:46:46 +0000]
Windows: always try afs/cell@USER-REALM first

In the KFW_AFS library, always try afs/cell@USER-REALM
first, even when KFW_AFS_klog() is called with an explicit
realm mapping for the cell.  An afs service principal from
the user's realm is always preferred.  No cross realm and
if the realm is AD, the ability to avoid the inclusion of
a PAC.

Change-Id: Ia29085e03d7c8a7c05e0c8d7991bc48b780b84fa
Reviewed-on: http://gerrit.openafs.org/4633
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoWindows: support dotted names in aklog
Jeffrey Altman [Mon, 9 May 2011 14:45:33 +0000]
Windows: support dotted names in aklog

Do not reject dotted principal names if the registry
configuration states that they should be accepted.

Change-Id: I675bec085f61ae2f5dc1cfd93a811655f87e0577
Reviewed-on: http://gerrit.openafs.org/4632
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agolibafs: Put back GetCapabilities user reference
Andrew Deason [Thu, 5 May 2011 22:13:21 +0000]
libafs: Put back GetCapabilities user reference

afs_GetCapabilities gets a user reference for the conn for the
GetCapabilities call. Put the ref back so we don't leak refs.

Change-Id: I46304ea13c3d78216641f468718b23b665d046ff
Reviewed-on: http://gerrit.openafs.org/4626
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

12 years agolibafs: Get rx conn ref with afs conn ref
Andrew Deason [Thu, 5 May 2011 16:18:08 +0000]
libafs: Get rx conn ref with afs conn ref

When we get a reference to an afs_conn with afs_Conn and its variants,
we assume we can use the tc->id rx connection without holding any
locks. However, if tc->forceConnectFS gets set, the tc->id connection
can be destroyed and recreated out from under us. So, to avoid using a
possibly freed rx connection, grab a reference to the rx connection at
the same time as we grab a reference to the afs conn. And also put
back the same reference with afs_PutConn.

Change-Id: I442886ee89c6f3fa609e47261317e647e124eecc
Reviewed-on: http://gerrit.openafs.org/4625
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoWindows: replace CYGWIN envvar with CYGWINDIR
Jeffrey Altman [Fri, 6 May 2011 13:49:52 +0000]
Windows: replace CYGWIN envvar with CYGWINDIR

The environment variable CYGWIN (starting with cygwin 1.7.1) is
now used by CYGWIN to set configuration parameters for the cygwin
runtime library.  OpenAFS used it to indicate the location of the
Cygwin install directory.  Since there is a conflict, rename CYGWIN
to CYGWINDIR.

Change-Id: I98f6a7095ede4c6a91dd71d48312b0d1a55b8091
Reviewed-on: http://gerrit.openafs.org/4629
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoWindows: change log for 1.5.9905
Jeffrey Altman [Fri, 6 May 2011 00:36:38 +0000]
Windows: change log for 1.5.9905

Change-Id: If230ae5f0dcb811954130e118fc0ae81dc396111
Reviewed-on: http://gerrit.openafs.org/4627
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

12 years agolibafs: Correct afs_LoopServers flags
Andrew Deason [Thu, 5 May 2011 16:37:12 +0000]
libafs: Correct afs_LoopServers flags

AFS_LS_DOWN was actually checking up servers, and AFS_LS_UP was
checking down servers. Fix the handling of the 'adown' flag so we do
the right thing. Also make afs_FlushVCBs use the symbolic name for
adown.

Change-Id: I601faf1bb712a2f76f0bb2447530af38111a71fd
Reviewed-on: http://gerrit.openafs.org/4624
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agovol: switch to rk_closesocket
Jeffrey Altman [Wed, 4 May 2011 23:53:22 +0000]
vol: switch to rk_closesocket

Use roken's rk_closesocket instead of #ifdef AFS_NT40_ENV
conditional tests.

Change-Id: I3602705cea61f07b0e05c633ab57125e43cde506
Reviewed-on: http://gerrit.openafs.org/4623
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoafscp: use closesocket when closing sockets
Jeffrey Altman [Wed, 4 May 2011 18:41:03 +0000]
afscp: use closesocket when closing sockets

close() is not portable to platforms where a socket is
not a file descriptor.

Change-Id: I7077643f45b969f8aa274f4fbb0dfbf375d6542f
Reviewed-on: http://gerrit.openafs.org/4620
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoFurther fix gssapi.m4 for Heimdal without libroken
Russ Allbery [Mon, 2 May 2011 21:54:35 +0000]
Further fix gssapi.m4 for Heimdal without libroken

The gssapi.m4 fix for Heimdal without libroken was incomplete.  It now
doesn't attempt to link with libroken when probing for GSS-API
symbols.  Thanks, Antoine Verheijen.

Change-Id: Ie994c321f68d7ffba96d2cf31dcf287be8546121
Reviewed-on: http://gerrit.openafs.org/4607
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agoNetBSD: DEBUG can not typically be defined
Jonathan A. Kollasch [Mon, 2 May 2011 21:06:34 +0000]
NetBSD: DEBUG can not typically be defined

Like IRIX 6.5, some NetBSD kernel structures change size in the presence
of the DEBUG preprocessor symbol.

Change-Id: I3c5acba7afd22be9b179f628dfa0c1c402c08e2a
Reviewed-on: http://gerrit.openafs.org/4605
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

12 years agoNetBSD: translate timeval structure format in clock_GetTime()
Jonathan A. Kollasch [Mon, 2 May 2011 20:03:50 +0000]
NetBSD: translate timeval structure format in clock_GetTime()

Change-Id: I4fb81a5b809437786064402b3ced0b1659d4476b
Reviewed-on: http://gerrit.openafs.org/4604
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoviced: Improve deleted client log messages
Andrew Deason [Wed, 27 Apr 2011 21:24:46 +0000]
viced: Improve deleted client log messages

Change the information logged related to deleted clients to be a
little more useful. In particular this includes adding the client and
host refcounts, to help see if the cause is a reference count leak.

Change-Id: Iba156fb32a4838cdbd567ca4e55072337c63ba67
Reviewed-on: http://gerrit.openafs.org/4583
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoviced: Do not try to reuse deleted client
Andrew Deason [Wed, 27 Apr 2011 20:36:44 +0000]
viced: Do not try to reuse deleted client

When h_FindClient_r encounters a deleted client structure, it does not
try to find a different client structure to use. Force it to use a new
client structure by setting client to NULL when it detects a deleted
client.

This arguably reverts part of
4e55e30f5b2c149b350b6d6875793adf722fdc21, but the code paths in
h_FindClient_r are very different now, so that commit is probably not
too relevant.

Change-Id: I8e5004c8a9a3d99919da8df4436e5aa97e338825
Reviewed-on: http://gerrit.openafs.org/4582
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoRemove unused variable
Jonathan A. Kollasch [Mon, 2 May 2011 18:32:29 +0000]
Remove unused variable

Change-Id: Ib91cf666f3b66b9d8aae7bfcab290e6fede61280
Reviewed-on: http://gerrit.openafs.org/4599
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoWindows: Fix caching of non-existing vols
Jeffrey Altman [Sun, 1 May 2011 04:11:13 +0000]
Windows: Fix caching of non-existing vols

In cm_UpdateVolumeLocation() the conditional that would
trigger the immediate return of CM_ERROR_NOSUCHVOLUME
was backwards which prevented the caching from working.

cm_CheckOfflineVolumes() is called by the daemon thread
to reset the status of offline volumes.  Non-existing
volumes are by definition offline and cannot be brought
online.  Therefore, the cm_CheckOfflineVolumes() function
should skip volumes with the CM_VOLUMEFLAG_NOEXIST flag
set.

Change-Id: If4093132322e7dd02d71c0f18d6492abbea53e01
Reviewed-on: http://gerrit.openafs.org/4597
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

12 years agoAdd missing LIB_roken references
Andrew Deason [Thu, 28 Apr 2011 21:13:20 +0000]
Add missing LIB_roken references

With the usage of asprintf in libcmd, some more binaries require
libroken to link. Add LIB_roken to their link lines. In src/venus for
the fstrace rule, this causes the HP-UX case to be identical to the
default case, so just remove the HP-UX special case.

Change-Id: Ib4677b17a194cf79742bd5767d3f5cf2442973d3
Reviewed-on: http://gerrit.openafs.org/4590
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoavoid downward vcache pressure when entries are free
Derrick Brashear [Fri, 29 Apr 2011 07:59:19 +0000]
avoid downward vcache pressure when entries are free

we try to keep VCACHE_FREE entries free. if there's already that many free,
do nothing.

Change-Id: I7e92430329a17250f94d0435de7641fa331dd461
Reviewed-on: http://gerrit.openafs.org/4595
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agolibafs: Drop xvcache for AllocCBR
Andrew Deason [Tue, 15 Feb 2011 18:04:32 +0000]
libafs: Drop xvcache for AllocCBR

Normally when we AllocCBR, we are holding xvcache write-locked, since
it is called from FlushVCache. Before
a309e274632993c5aeec04c6e090f5ac95837a40, when AllocCBR needs to flush
CBRs due to a lack of space, we hit the net, giving up callbacks on
fileservers.

This can cause a problem if one of those fileservers needs to contact
us in order to complete that request, since the callback service
thread may be waiting for xvcache, causing a deadlock (that is
eventually broken by network timeouts).

To avoid this, drop xvcache if AllocCBR looks like it does not have
sufficient space. Fix all callers of afs_FlushVCache to handle the
case where we sleep, since with this change, afs_FlushVCache can sleep
on all platforms.

This partially reverts a309e274632993c5aeec04c6e090f5ac95837a40, as it
contains an alternative method of avoiding the xvcache lock in this
situation. This commit restores much of the code path to be much more
similar to how it used to be, except that it allows for dropping
xvcache for AllocCBR. This should make any change to our prior
behavior smaller/simpler, and thus safer and more consistent with
existing clients. This reintroduces the hard limit to how much space
we allocate for CBRs, although the part of
a309e274632993c5aeec04c6e090f5ac95837a40 that raised this limit is
retained.

Change-Id: Id4aaa941b3908f59390873e83e23429041c0828f
Reviewed-on: http://gerrit.openafs.org/3958
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agolibafs: Use vcount, not maxvcount to trim vcaches
Andrew Deason [Thu, 28 Apr 2011 16:48:18 +0000]
libafs: Use vcount, not maxvcount to trim vcaches

Every five minutes we afs_ShakeLooseVCaches to try and return the
number of vcaches in use down to the originally configured -stat level
(when we are using dynamic vcaches). We should calculate how many
vcaches to flush based on the number of currently active vcaches
(afs_vcount), not the peak number (afs_maxvcount). Otherwise, once we
exceed the configured -stat level, we will always keep trying to flush
numerous vcaches, even if we barely have any vcaches in use.

Change-Id: I875fc1d33c817dde2230946b852bb74f8ffd84c2
Reviewed-on: http://gerrit.openafs.org/4584
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

12 years agoResync test harness with C TAP Harness 1.7
Russ Allbery [Thu, 28 Apr 2011 20:00:43 +0000]
Resync test harness with C TAP Harness 1.7

Includes the following upstream changes:

Add a more complete usage message to runtests and add support for a -h
command-line flag to display the usage message.

is_double() now takes a third argument, an epsilon.  Two numbers are
considered equal if their absolute difference is less than epsilon.
is_double() also now treats wanted and seen values of NaN (not a
number) as equal.  Thanks to PICCA Frédéric-Emmanuel for the proposed
changes.

The ok_program function in the shell libtap.sh library no longer
strips text after a colon and a space from the program output if the
expected status is non-zero.  Instead, if program output may contain
system-specific error messages after a colon and a space, put the new
function strip_colon_error before the program to do this stripping.
Thanks to Carsten Hey for the idea.

strip_colon_error is now smarter about preserving an initial word
ending in a colon (which is generally the program name) while still
stripping error messages later in the line.

The test_file_path function in the shell libtap.sh library now always
returns the empty string, rather than possible absolute paths starting
at /, if $BUILD and $SOURCE are not set.

Flush standard error in the C TAP library before printing results for
more deterministic output.  Thanks to Carsten Hey for the idea.

All of C TAP Harness now compiles with gcc -ansi -pedantic and should
be fully C89-compatible.  Note that either C99 or SUSv3 is required to
build C TAP Harness.  (This should not be a problem on any modern
platform.)  Based on work by Carsten Hey.

Simplify and improve output formatting in the summary of failing tests
in some edge cases.

Add explicit license statements to the files meant to be copied into
other packages rather than referring to LICENSE.

Add a test_file_path() function to the basic C and shell TAP
libraries, which searches the build and source directories for a
particular file and returns the full path.  This is a utility function
that can be used to find test data files.

Change-Id: I3ef84218f0e3a8b75f550c8b629b058330659b31
Reviewed-on: http://gerrit.openafs.org/4589
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agoFix various build problems with the test suite
Russ Allbery [Thu, 28 Apr 2011 23:10:23 +0000]
Fix various build problems with the test suite

The cmd/command-t test requires libroken and was misspelled in the
TESTS file.  Multiple tests require LD_LIBRARY_PATH to be set to find
libafsroken if it hasn't been installed, so set it when running
runtests via make check.  (Note that this means runtests -o will not
work properly unless the user also sets LD_LIBRARY_PATH.)

Change-Id: Ib64f0505b3b75db33adb6c7b6452dcaac0b05dbc
Reviewed-on: http://gerrit.openafs.org/4594
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>