openafs.git
9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 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>

9 years agoResync Autoconf macros from rra-c-util 3.3
Russ Allbery [Thu, 28 Apr 2011 19:56:11 +0000]
Resync Autoconf macros from rra-c-util 3.3

This includes the following fixes:

* Include krb5.h before probing for the IBM-specific header file for
  obtaining error strings to avoid Autoconf warnings on AIX.

* Use [] to mark empty arguments to Autoconf macros.

* Add an explicit license statement to these Autoconf macros, matching
  the normal Autoconf macro license.

* Ensure rra_use_kerberos is always set so that other parts of configure
  can rely on it.

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

9 years agoResync src/cf/gssapi.m4 with rra-c-util 3.3 (fixes OpenBSD)
Russ Allbery [Thu, 28 Apr 2011 19:50:35 +0000]
Resync src/cf/gssapi.m4 with rra-c-util 3.3 (fixes OpenBSD)

Resynchronize src/cf/gssapi.m4 with rra-c-util 3.3.  This includes
the following fixes:

* Handle the Heimdal GSS-API library on OpenBSD, which does not have
  a separate libroken.  Thanks to Antoine Verheijen for the analysis.

* Search /usr/kerberos/bin for krb5-config even if that isn't on the
  user's PATH to find krb5-config on some Red Hat versions.

* Use [] to mark empty arguments to Autoconf macros.

* Add an explicit license (matching the normal Autoconf macro license).

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

9 years agodoc: Fix 'vos endtrans' copyright
Andrew Deason [Thu, 28 Apr 2011 18:55:09 +0000]
doc: Fix 'vos endtrans' copyright

SNA owns this, not me.

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

9 years agoviced: Avoid ref leak on origin callback break
Andrew Deason [Wed, 27 Apr 2011 19:23:43 +0000]
viced: Avoid ref leak on origin callback break

When breaking a callback, sometimes we send a callback to the host
that performed the callback-inducing operation. When we do this,
currently BreakCallBack gives the origin host structure to
MultiBreakCallBack_r, which avoids releasing that host after the
callback is broken.

However, BreakCallBack obtains a reference to every host to which it
delivers a callback, even if it is the origin host, so a reference is
leaked. Fix this by not ever passing a host to MultiBreakCallBack_r,
and just have MultiBreakCallBack_r release a reference for every host
to which it delivers a callback break.

FIXES 129376

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

9 years agoviced: Transfer host ref in h_FindClient_r
Andrew Deason [Wed, 27 Apr 2011 18:51:23 +0000]
viced: Transfer host ref in h_FindClient_r

In h_FindClient_r, we can change which client structure we're dealing
with if we find a different client struct in the Rx conn-specific
data. We adjust the refcounts for the client structures themselves,
but not the associated hosts. While the host structures should be the
same most of the time, we are not guaranteed that, so adjust their
refcounts as well.

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

9 years agoIRIX: set vfs pointer when creating new vcaches
Derrick Brashear [Tue, 26 Apr 2011 02:23:40 +0000]
IRIX: set vfs pointer when creating new vcaches

add missing call to set our vfsp on irix.

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

9 years agocmd: Support splitting switches and values with '='
Simon Wilkinson [Wed, 20 Apr 2011 21:26:14 +0000]
cmd: Support splitting switches and values with '='

Some of our code uses arguments of the form -name=value. Add support
to libcmd for dealing with this type of argument, where name is
declared as CMD_SINGLE (or CMD_SINGLE_OR_FLAG)

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

9 years agocmd: Tidy up -help output
Simon Wilkinson [Tue, 19 Apr 2011 18:59:13 +0000]
cmd: Tidy up -help output

Tidy up the output that comes from cmd's -help option by wrapping
at 78 characters, and picking the breaks sensibly. This changes:

Usage: ./vos move -id <volume name or ID> -fromserver <machine name on source> -
frompartition <partition name on source> -toserver <machine name on destination>
 -topartition <partition name on destination> [-live] [-cell <cell name>] [-noau
th] [-localauth] [-verbose] [-encrypt] [-noresolve] [-help]

to...

Usage: ./vos move -id <volume name or ID>
         -fromserver <machine name on source>
         -frompartition <partition name on source>
         -toserver <machine name on destination>
         -topartition <partition name on destination> [-live]
         [-cell <cell name>] [-noauth] [-localauth] [-verbose]
         [-encrypt] [-noresolve] [-help]

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

9 years agocmd: Add support for params with optional values
Simon Wilkinson [Tue, 19 Apr 2011 18:37:37 +0000]
cmd: Add support for params with optional values

Add the CMD_SINGLE_OR_FLAG option which permits a parameter to
either have a single value, or no value at all. If it has no value,
then it behaves in the same way as the current 'flag' implementation.

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

9 years agocmd: Add parameter aliasing
Simon Wilkinson [Tue, 19 Apr 2011 11:20:14 +0000]
cmd: Add parameter aliasing

Add support for adding aliases for parameters, in the same way as we
can for syntaxes. This allows multiple different names for a single
option, as well as providing a way around problems with abbreviations.

Aliases may not be abbreviated.

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

9 years agocmd: Add accessor functions for options
Simon Wilkinson [Tue, 19 Apr 2011 10:41:54 +0000]
cmd: Add accessor functions for options

Add a load of accessor functions to help with pulling values out
from the the cmd_syndesc structure. The idea here is to make it
simpler to manipulate command line values, as well as starting to
hide the structure of the cmd_syndesc structure from callers, with
a view to eventually making it private to the cmd library.

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

9 years agocmd: Add option to add a param at a specific pos
Simon Wilkinson [Tue, 19 Apr 2011 08:01:25 +0000]
cmd: Add option to add a param at a specific pos

Rather than having to use cmd_Seek, followed by cmd_AddParam,
followed by another cmd_Seek, add a function which permits parameters
to be added at specific reference points. This allows programs to
declare a list (either as an enum or specific #defines) of parameter
code points, rather than using raw numbers.

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

9 years agoAdd -usetokens option to libadmin test 'afscp'
Thomas L. Kula [Sun, 6 Feb 2011 01:11:56 +0000]
Add -usetokens option to libadmin test 'afscp'

This adds a -usetokens option to poorly named libadmin test 'afscp' program.
If called with this flag, 'afscp' will assume you have already acquired
tokens, and will fetch and use them. If ran with the -authcell option,
it will look for tokens for that cell, otherwise it will look for tokens
in the local cell. Since the function used to fetch local tokens is
incompatable with the kas functions, all of the kas commands have been
modified to complain and exit if any of them all called with -usetokens.

Fixed whitespace, again.

Change-Id: I4f9bcbae42f6eb179168bb5d152ed36df3db8dd5
Reviewed-on: http://gerrit.openafs.org/3899
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Dan Hyde <drh@umich.edu>
Reviewed-by: Steve Simmons <scs@umich.edu>
Tested-by: Derrick Brashear <shadow@dementia.org>

9 years agoLinux: Don't read pages beyond the cache eof
Simon Wilkinson [Mon, 25 Apr 2011 18:18:39 +0000]
Linux: Don't read pages beyond the cache eof

If we attempt to read past the end of the current cache file (for
example, when we're extending the file with ftruncate), don't force
the backend filesystem to populate that page with non-existent data.

This will hopefully fix a bus error when using tmpfs as a backing
cache.

FIXES 128452

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

9 years agoBuild libafscp when we lack kerberos
Andrew Deason [Tue, 26 Apr 2011 19:44:46 +0000]
Build libafscp when we lack kerberos

Currently, venus fails to build without kerberos, since the
dependencies for afsio always include afscp.h, which does not exist
when we do not build libafscp. To fix this the easy way, and since
libafscp is still very useful without kerberos, allow libafscp to
build without kerberos support (which limits it to anonymous
connections only).

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

9 years agoIrix: Add a simple osi_ReadRandom implementation
Simon Wilkinson [Tue, 26 Apr 2011 19:48:32 +0000]
Irix: Add a simple osi_ReadRandom implementation

Add an implementation of osi_ReadRandom for Irix, which just panics
(Irix has no source of cryptographically safe entropy in the kernel).
Whilst hcrypto requires an implementation of osi_ReadRandom, nothing
in the current kernel module will cause it to be called, so this
panic should never be reached.

Change-Id: I7aa52f445182f8e660586241304a7379770afcaa
Reviewed-on: http://gerrit.openafs.org/4575
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chaz Chandler <clc31@inbox.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

9 years agosrc/afs: Set but unused variables warning fixes
Marc Dionne [Sat, 16 Apr 2011 20:38:45 +0000]
src/afs: Set but unused variables warning fixes

Fix a few simple cases of set but unused variables under src/afs.

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

9 years agoFix --without-krb5
Andrew Deason [Tue, 26 Apr 2011 19:32:25 +0000]
Fix --without-krb5

Currently, specifying --without-krb5 causes the AM_CONDITIONAL
KRB5_USES_COM_ERR to not be defined, which makes configure refuse to
run successfully. Fix this by forcing KRB5_USES_COM_ERR to always be
false if we are running explicitly without krb5.

Change-Id: I96274847a3dbbb8436ef04f24476606cb15c6618
Reviewed-on: http://gerrit.openafs.org/4576
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoRewrite asetkey to support extended key types
Simon Wilkinson [Tue, 1 Mar 2011 14:59:55 +0000]
Rewrite asetkey to support extended key types

Rewrite the asetkey binary so that it can support managing extended
key files.

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

9 years agoafsio: remove unnecessary reference to malloc.h
Chaz Chandler [Tue, 26 Apr 2011 20:49:39 +0000]
afsio: remove unnecessary reference to malloc.h

Fixes breakage on freebsd for missing malloc.h, reported by GAWollman,
and, since roken.h already includes stdlib.h to pull in malloc, is no
longer necessary

Change-Id: Ie7785198124fe0dee394d7c15f032f0dadb6db8c
Change-Id: I1d5947155ba33de61d8fd23197e11c51e4791935
Reviewed-on: http://gerrit.openafs.org/4578
Reviewed-by: Chaz Chandler <clc31@inbox.com>
Tested-by: Chaz Chandler <clc31@inbox.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

9 years agoubik: add uvote_HaveSyncAndVersion
Marc Dionne [Sat, 23 Apr 2011 02:23:21 +0000]
ubik: add uvote_HaveSyncAndVersion

Add a new function uvote_HaveSyncAndVersion() that combines the
logic from uvote_GetSyncSite and uvote_eq_dbVersion, without
releasing the vote lock in between.  Make use of it in
urecovery_AllBetter.

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

9 years agoubik: Defer updateUbikNetworkAddress until after RX startup
Marc Dionne [Sat, 23 Apr 2011 01:24:34 +0000]
ubik: Defer updateUbikNetworkAddress until after RX startup

The beacon package initialization has been moved to precede starting
RX services, but the broadcast of addresses to other servers should
be deferred until after RX is started.

Make updateUbikNetworkAddress an exported function and call it
from the general initilization sequence.

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

9 years agoubik: locking in recovery.c
Marc Dionne [Sat, 29 Jan 2011 19:37:23 +0000]
ubik: locking in recovery.c

Locking changes in recovery.c:
- In urecovery_Initialize, hold the DB lock over ReplayLog
and InitializeDB
- Hold the DB lock over larger portions of urecovery_interact.
Some values which should be protected were examined and modified
without holding any locks.
- In the early part of urecovery_interact, only take the DB lock
when it's really needed, now that some values are protected by other
locks.
- DoProbe is now called without the DB lock, so it doesn't need to
drop and re-aquire it.

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

9 years agoubik: always hold DB lock for urecovery_ResetState()
Marc Dionne [Sat, 16 Apr 2011 18:19:57 +0000]
ubik: always hold DB lock for urecovery_ResetState()

ubik_ResetState requires callers to hold the DB lock, since it modifies
urecovery_state.  All callers of ubeacon_AmSyncSite outside of the beacon
package hold the DB lock, but calls from the beacon thread do not, and
can't block on getting the DB lock if we're sync site.

Add a beacon internal version of ubeacon_AmSyncSite that skips the
call to ResetState, and have the callers take the DB lock and call
ResetState themselves if needed.  They can take the lock in this case
because we know we're not the sync site.  Refactor the exported
ubeacon_AmSyncSite in terms of this new function.

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

9 years agoubik: set UBIK_RECLABELDB before propagating version
Marc Dionne [Sat, 16 Apr 2011 16:56:05 +0000]
ubik: set UBIK_RECLABELDB before propagating version

Quoting Jeffrey Hutzelman:

In udisk_commit(), when committing the first write transaction
after becoming sync site, the database is relabelled.  In this
case, the UBIK_RECLABELDB recovery state bit should be set before
propagating the label change to other servers, rather than after.

This is because ContactQuorum_DISK_Setversion() will
release the database lock, at which point the recovery state may
be cleared by urecovery_ResetState() running in another thread.
It is important that a relabelling which occurs before recovery
state is cleared not result in the UBIK_RECLABELDB recovery state
bit being set after; otherwise, the server may fail to correctly
relabel the database the next time it becomes sync site.

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

9 years agoubik: remote: fix DB lock usage
Marc Dionne [Sat, 16 Apr 2011 15:52:57 +0000]
ubik: remote: fix DB lock usage

Many of the RPC functions in the remote package have a similar
prologue that makes use of ubik_currentTrans before taking the
DB lock.  Take the lock earlier, and rely on the ubik_dbase global
instead of the dbase pointer in ubik_currentTrans.

In GetVersion, take the lock earlier to cover the call to
ubeacon_AmSyncSite.

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

9 years agomacos: further next version support
Derrick Brashear [Tue, 26 Apr 2011 14:46:41 +0000]
macos: further next version support

try to optimize out things which will be missing

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

9 years agoRename libcom_err to libafscom_err
Ben Kaduk [Sun, 19 Dec 2010 04:52:43 +0000]
Rename libcom_err to libafscom_err

We no longer provide a compatible libcom_err, and in fact
we renamed the symbols in our libcom_err several years ago
to reflect this fact.
When we build on a system where KRB5_LIBS includes
-lkrb5 -lcom_err , the new Unix build system will pick up
our libcom_err (as $(AFS_LDFLAGS) is the first argument in
AFS_LDRULE and pulls in a linker search path for our libcom_err)
which does not provide all the needed symbols for libkrb5.

Fully rename our libcom_err away to avoid these conflicts.

FIXES 128640

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

9 years agoLinux: cleanup aio support
Marc Dionne [Fri, 22 Apr 2011 19:23:27 +0000]
Linux: cleanup aio support

Code that called directly into the aio operations (ex: readv/writev)
would bypass the AFS specific operations found in afs_linux_read
and afs_linux_write.

Rework the handlers:
- For newer kernels with aio, let the kernel use its default read
and write operations, and define the aio_read and aio_write operations,
with the AFS specific bits, calling into generic_file_aio_read/write.
The kernels default read/write operations are just wrappers around the
aio versions.
- For older kernels, leave things as is, pointing read and write to
afs_linux_read/write

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

9 years agocmd: Split up dispatch function
Simon Wilkinson [Tue, 19 Apr 2011 10:47:08 +0000]
cmd: Split up dispatch function

Split up the command line parsing behaviour out of the cmd_Dispatch
function, and into a function of its own - cmd_Parse. This lets servers
which only have a single "syntax" installed just parse, without needing
to go through a dispatch function, and all of the control flow
complexity that requires.

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

9 years agocmd: Add an option to disable abbreviations
Simon Wilkinson [Mon, 18 Apr 2011 07:31:42 +0000]
cmd: Add an option to disable abbreviations

Add an option to completely disable the matching of abbreviations
when parsing command line options.

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

9 years agocmd: Add function to disable positional commands
Simon Wilkinson [Mon, 18 Apr 2011 07:25:55 +0000]
cmd: Add function to disable positional commands

Add a new cmd_DisablePositionalCommands function which can be used
to completely disable positional commands, for functions which have
no desire to make use of them.

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

9 years agocmd: Add some tests to the test suite
Simon Wilkinson [Sat, 23 Apr 2011 15:42:54 +0000]
cmd: Add some tests to the test suite

Add some tests for the command library to the integrated test
suite in tests. These are far from complete, and are mainly there
to ensure that we don't break any of this functionality when modifying
the library.

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

9 years agocmd: Make the original test suite build
Simon Wilkinson [Sat, 23 Apr 2011 14:44:53 +0000]
cmd: Make the original test suite build

Make the original, command line driven, test suite build again

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

9 years agopam: Fix password torching const-ness
Andrew Deason [Mon, 25 Apr 2011 18:58:34 +0000]
pam: Fix password torching const-ness

In some code branches, the PAM code "torches" a password by zeroing
it. However, it does this through a const pointer which we otherwise
know is not actually const. Make sure we get better type checking by
doing this through a non-const pointer.

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