openafs.git
8 years agovos: convertROtoRW may create 2nd RW on a fileserver
Mark Vitale [Thu, 2 Aug 2012 22:37:05 +0000]
vos: convertROtoRW may create 2nd RW on a fileserver

If an RW is already present on disk on the target server (any partition),
'vos convertROtoRW' will still convert the RO, creating a second RW on the server.
Detect this and refuse to convert the RO by returning EXDEV (invalid cross-device link).

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

8 years agorx: Process ICMP unreachable errors
Andrew Deason [Thu, 2 Aug 2012 15:58:12 +0000]
rx: Process ICMP unreachable errors

When a machine receives ICMP errors, we can detect them in
AFS_RXERRQ_ENV environments. Many of these errors indicate that a
machine is not reachable, so we are guaranteed to not get a response
from them. When we get such an error for a particular peer, mark all
relevant calls with an RX_CALL_DEAD error, since we know we won't get
a response from them. This allows some calls to dead/unreachable hosts
to fail much more quickly.

Do not immediately kill new calls, since obviously the host may have
come back up since then (or the routing/firewall/etc was fixed), but
only calls that were started before the current error was received.

Note that a call doesn't actually notice until the next rxi_CheckCall,
since directly killing each of the relevant calls would be rather
slow. So, we don't notice a dead peer immediately, though we notice
much more quickly than we used to.

Reorganize the error queue processing a little bit to make this easier
to do.

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

8 years agoLINUX: Fix error queue processing
Andrew Deason [Wed, 1 Aug 2012 20:31:09 +0000]
LINUX: Fix error queue processing

Receiving error queues in the Linux kernel is a little different from
userspace. When we encounter a cmsg that is not CMSG_OK, we need to
break out of the loop, and not just continue, since we can keep trying
to process the same cmsg over and over. In addition, on successful
return, the msg_control buffer has been modified to point to the next
available buffer space, and msg_controllen contains how many bytes are
remaining. So, we need to adjust the msg_control and msg_controllen
values to get something more familiar.

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

8 years agoLINUX: Avoid SO_ERROR for RXERRQ_ENV
Andrew Deason [Wed, 1 Aug 2012 19:56:27 +0000]
LINUX: Avoid SO_ERROR for RXERRQ_ENV

SO_ERROR is for receiving errors from some nonblocking operations; it
has little relevance to our network operations. For Linux, use a
similar structure as userspace error detection, instead of SO_ERROR.

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

8 years agorx: Create AFS_ADAPT_PMTU and AFS_RXERRQ_ENV
Andrew Deason [Wed, 1 Aug 2012 19:19:02 +0000]
rx: Create AFS_ADAPT_PMTU and AFS_RXERRQ_ENV

Currently we have the ADAPT_PMTU define, which turns on functionality
in Linux to detect PMTU-related ICMP errors for Rx. However, this is
really turning on two separate pieces of functionality: the PMTU
processing, and the processing for ICMP errors in general.

So split this out into two defines: AFS_ADAPT_PMTU, and
AFS_RXERRQ_ENV. The former is for processing PMTU discovery, and the
latter is for processing ICMP errors. Both of these are left disabled
due to issues in the error processing. Although PMTU discovery is the
only functionality which makes use of ICMP errors, this will change in
the future.

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

8 years agoLINUX24: Remove ADAPT_PMTU code
Andrew Deason [Wed, 1 Aug 2012 19:14:23 +0000]
LINUX24: Remove ADAPT_PMTU code

ADAPT_PMTU on Linux 2.4 doesn't really seem worth it. Remove it so we
don't have to duplicate code.

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

8 years agorx: Formatting fixes
Andrew Deason [Wed, 1 Aug 2012 19:11:48 +0000]
rx: Formatting fixes

Some minor fixes to preprocessor indentation and other minor
formatting things in rx.c and rx_user.c.

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

8 years agorx: Remove ADAPT_MTU and MISCMTU
Andrew Deason [Wed, 1 Aug 2012 18:57:06 +0000]
rx: Remove ADAPT_MTU and MISCMTU

Ever since 5bcf626ddaf92e199c4b46c11ad276013a47db52, ADAPT_MTU has
been unconditionally defined. MISCMTU has always been unconditionally
defined, and not used anywhere. Remove both of these, assuming they
are always defined.

Note that ADAPT_MTU != ADAPT_PMTU.

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

8 years agobozo: avoid canceling the sigkill timer for hung processes
Michael Meffie [Wed, 1 Aug 2012 15:42:34 +0000]
bozo: avoid canceling the sigkill timer for hung processes

A sigkill signal is sent to fileserver processes when a timeout is
exceeded for shutting down processes for the fs/dafs bnode.
(Currently 30 minutes for the fileserver, 1 minute for the other
server processes.)

If the bnode goal is set to run before this timeout expires, the
timer is incorrectly stopped, and a wedged process is never killed.
Fix this by not canceling the timer when a fs/dafs process has been
signaled to shutdown, regardless of the current goal.

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

8 years agolibafscp: Add afscp_LocalAuthAs
Andrew Deason [Fri, 30 Mar 2012 19:56:52 +0000]
libafscp: Add afscp_LocalAuthAs

Add the function afscp_LocalAuthAs to libafscp. This allows the caller
to generate credentials based on the KeyFile on local disk, in order
to appear as an arbitrary user.

Based on code written by YFS.

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

8 years agoLINUX: Always hold afs_xuser for unixuser read
Andrew Deason [Tue, 31 Jul 2012 18:40:41 +0000]
LINUX: Always hold afs_xuser for unixuser read

We were failing to hold the afs_xuser lock when we entered our
unixuser traversal for the first time (when the given position is 0).
This means we can release the lock without acquiring it, causing all
kinds of weird behavior.

Just always grab afs_xuser on entry. We could possibly do some tricks
to avoid grabbing this lock until after we've printed the column
headers, but it does not seem worth it.

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

8 years agokrb5 profile config support
Derrick Brashear [Mon, 30 Jul 2012 13:52:24 +0000]
krb5 profile config support

create openafs-client.conf and openafs-server.conf in respective ETC
dirs. enable afsd, ptserver, vlserver and fileserver option parsing from it

[afsd]
            dynroot = true
            dcache = 800
            cachedir = /var/db/openafs/cache

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

8 years agoLINUX: Do not lookup immediately recursive mtpts
Andrew Deason [Fri, 6 Apr 2012 19:56:07 +0000]
LINUX: Do not lookup immediately recursive mtpts

On Linux, having a mountpoint in a volume root that points to the same
volume can cause serious problems. By 'immediately recursive', I mean
a situation like the following:

fs mkm mtpt vol
fs mkm mtpt/mtpt vol

If there are multiple dentry aliases for the directory (which is
possible if the directory is a mountpoint), an 'rmdir' on the
recursive mountpoint can cause the client to deadlock. Since the
'rmdir' code path in Linux locks the parent directory inode to perform
the rmdir, and locks the child directory inode after performing a
couple of sanity checks. For an immediately recursive mountpoint,
these two inodes are the same, and so we will deadlock.

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

8 years agoLinux: Make dir dentry aliases act like symlinks
Andrew Deason [Fri, 6 Jul 2012 21:37:39 +0000]
Linux: Make dir dentry aliases act like symlinks

Currently, we try to invalidate other dentries that exist for a
particular dir inode when we look up a dentry. This is so we try to
avoid duplicate dentries for a directory, which Linux does not like
(you cannot have hardlinks to a dir).

If we cannot invalidate the other aliases (because they are being
used), right now we just return the alias. This can make it very easy
to panic the client, due to the sanity checks Linux performs when dong
things like 'rmdir'. If we do something like this:

mkdir dir1
fs mkm dir1/mtpt vol
mkdir dir1/mtpt/dir2
fs mkm dir1/mtpt/dir2/mtpt2 vol
cd dir1/mtpt
rmdir dir2/mtpt2

For the 'rmdir', we will lookup 'mtpt2'. Since 'mtpt' and 'mtpt2'
are mountpoints for the same volume, their dentries point to the same
directory inode. So when we lookup 'mtpt2', we will try to invalidate
the other dentry, but we cannot do that since it is the cwd. So we
return the alias dentry (for 'mtpt'). The Linux VFS layer then does a
sanity check for the rmdir operation, checking that the child dentry's
parent inode is the same as the inode we're performing the rmdir for.
Since the dentry we returned was for 'mtpt', whose parent is 'dir1',
and the actual dir we're performing the rmdir for is 'dir2', this
sanity check fails and we BUG.

To avoid this, make the dentry alias act like a symlink when we
encounter an uninvalidateable dentry alias. That is, we allow multiple
dentry aliases for a directory, however, when the dentry aliases are
actually used, we redirect to a common dentry (via d_automount where
possible, and follow_link elsewhere).

This means that such mountpoints will behave similarly to symlinks, in
that we 'point' to a specific mountpoint dentry. This means that if we
have multiple different ways to get to the same volume, and all are
accessed at the same time, all but one of those mountpoints will
behave like symlinks, pointing to the same mountpoint. So, the '..'
entries for each path will all point to the parent dir of one
mountpoint, meaning that the '..' entry will be "wrong", but for most
cases it will still be correct.

In order to try to make the 'target', pointed-to directory consistent,
we add a new field to struct vcache: target_link. This points to the
dentry we should redirect to, whenever that vcache is referenced. To
avoid (possibly not-feasibly-solvable) problems with refcounting, this
pointer is not actually a reference to the target dentry, but just
serves as a pointer to compare to.

FIXES 130273

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

8 years agodirpath: fix macos alternate client etc dir support
Derrick Brashear [Tue, 31 Jul 2012 15:47:58 +0000]
dirpath: fix macos alternate client etc dir support

we set a proper client etc dirpath but did not apply
it to children. do so.

Change-Id: I56da943838a13859a239e5edf4219c6400abfe35
Reviewed-on: http://gerrit.openafs.org/7904
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agoafs_server: delete code that has been ifdef'ed out for years
Garrett Wollman [Tue, 31 Jul 2012 02:05:04 +0000]
afs_server: delete code that has been ifdef'ed out for years

The comments in afs_SetServerPrefs() said "clean up, delete this".
The oldest one is a decade old.  Removing these #ifdefs will make
following the rest of the spaghetti #ifdefs a bit easier.

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

8 years agolibafs: afs_CacheFetchProc can't be called without a dcache pointer
Garrett Wollman [Tue, 9 Aug 2011 04:28:27 +0000]
libafs: afs_CacheFetchProc can't be called without a dcache pointer

An inspection of the only call site suggests that afs_CacheFetchProc()
can't be called with a null dcache pointer, and code further down
in this function dereferences adc unconditionally (assuming
rxfs_fetchInit() doesn't crash first) so remove the conditional
here.

Probably more of these parameters can and should be included in the
AFS_NONNULL.

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

8 years agodoc: Windows Release Notes Integrated Logon
Jeffrey Altman [Mon, 30 Jul 2012 19:19:57 +0000]
doc: Windows Release Notes Integrated Logon

Expand on support for integrated logon details.   Explain the
new capabilities for per-user configuration and name mapping.

Change-Id: I6aef3f99cb54aa964f9a6dbc3992031d6199e97d
Reviewed-on: http://gerrit.openafs.org/7905
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agodoc: Remove USA vs International from AdminGuide
Jeffrey Altman [Mon, 30 Jul 2012 04:43:01 +0000]
doc: Remove USA vs International from AdminGuide

OpenAFS does not have separate distributions for the United States
and the rest of the world.  Nor are there any restrictions on the
capabilities of the Update Server.

Change-Id: I834d86764bb3d8df4cce62b9cbaa33bff455bc30
Reviewed-on: http://gerrit.openafs.org/7902
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agovlserver: remove an unused global
Michael Meffie [Mon, 30 Jul 2012 02:15:14 +0000]
vlserver: remove an unused global

Remove the unused global variable extentaddr.

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

8 years agoopr: tweak nonnull macro to use nested parens
Derrick Brashear [Sun, 29 Jul 2012 23:09:22 +0000]
opr: tweak nonnull macro to use nested parens

throws an error on windows in some cases otherwise

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

8 years agoWindows: Rename cm_btree struct data
Simon Wilkinson [Sun, 29 Jul 2012 19:14:11 +0000]
Windows: Rename cm_btree struct data

Rename the "struct data" in cm_btree.h to something less generic in
order to avoid conflicts with other code.

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

8 years agovolser: restructure GetNextVol and clients to remove duplicate code
Garrett Wollman [Sat, 28 Jul 2012 05:10:09 +0000]
volser: restructure GetNextVol and clients to remove duplicate code

There are several odd-looking but stylized loops involving GetNextVol()
which can be radically simplified if only GetNextVol() would return
a meaningful value.  Move all of the code that skips non-volume-header
files in the directory into GetNextVol and have it return a truth value
(instead of always returning zero) that indicates whether it saw
something that looks like a volume header.  Then all the odd while
loops and strcmps just collapse into while(GetNextVol(...)).

GetNextVol() had external scope, but there are no callers in the
tree that use it outside of volprocs.c, and it's not part of a
public library interface, so make it static.

While here, don't strcmp() past the end of a filename that begins with
'V' but is too short to be a valid volume name.

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

8 years agoafscp: avoid null dereference in _GetSecurityObject error case
Garrett Wollman [Sat, 28 Jul 2012 04:18:00 +0000]
afscp: avoid null dereference in _GetSecurityObject error case

Handle the possible error return from krb5_get_host_realm in the
same way as the other error cases (using an anonymous security
object); otherwise "realm" would be left null.

Change-Id: I5ce7a614a3e272b3a9903a8e95545a8116d1af3c
Reviewed-on: http://gerrit.openafs.org/7891
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agopam: Use the right password variable in pam_sm_chauthtok()
Garrett Wollman [Sat, 28 Jul 2012 04:26:44 +0000]
pam: Use the right password variable in pam_sm_chauthtok()

"password" is known to be null at this point.  Use "prompt_password"
which is obviously the one intended.

Change-Id: I4ab566f93c4978438df2c2875d619177ad8f5bdd
Reviewed-on: http://gerrit.openafs.org/7892
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agobutc: don't pass NULL to strcpy in RcreateDump
Garrett Wollman [Fri, 27 Jul 2012 23:50:42 +0000]
butc: don't pass NULL to strcpy in RcreateDump

volumesetNamePtr can return a null pointer in certain error
conditions.  Check for this and return BUDB_BADARGUMENT rather
than dumping core.

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

8 years agoLINUX: Hold GLOCK for proc traversal
Andrew Deason [Thu, 26 Jul 2012 21:40:03 +0000]
LINUX: Hold GLOCK for proc traversal

The functions that traverse unixuser structures for display via /proc
(uu_start et al) call various libafs functions hold and release locks,
etc. To do any of that, we need GLOCK. Amongst other issues, we can
panic if we try to acquire a contested lock without GLOCK, since we
assert glock is held when we sleep for the lock or try to wake other
waiters. The same goes for the legacy CellServDB proc file.

So, hold and release GLOCK as appropriate.

Change-Id: I9ec2051bc5d914521d12a9d20d28da1076c090fc
Reviewed-on: http://gerrit.openafs.org/7885
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoLINUX: Fix osi_proc.c formatting
Andrew Deason [Thu, 26 Jul 2012 20:58:45 +0000]
LINUX: Fix osi_proc.c formatting

osi_proc.c had a few formatting issues:

 - Several function definitions did not have the function name at the
   beginning of the line

 - A few preprocessor directives were not indented

 - A few areas used a tab character for each indentation level, as
   opposed to 4 spaces, then 1 tab, as the rest of the tree has

 - Struct definitions were aligned using tabs, not spaces, causing
   misalignments when the indentation was fixed

Fix these.

Change-Id: I8d6b511473b89c42abd759553ec77332407daff0
Reviewed-on: http://gerrit.openafs.org/7884
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agorx: protect against ACKs with serial as prevPacket
Jeffrey Altman [Mon, 16 Jul 2012 21:29:54 +0000]
rx: protect against ACKs with serial as prevPacket

patchset 4e71409fe1305cde4b9b341247ba658d8d24f4d0 introduced a
check in rxi_ReceiveAckPacket for out of order ack packets which
relied upon the value of the previousPacket field.  Unfortunately,
some versions of RX store the previous packet's serial number in
the field instead of previous packet's sequence number.  Modify
the check to only discard out of order ACKs if the previousPacket
sequence number is within the valid window.

Change-Id: I72885a8c1aaa69eb263335be1827545f2b4c3e09
Reviewed-on: http://gerrit.openafs.org/7785
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorx: better rxi_FindRpcStat check for end of queue
Jeffrey Altman [Thu, 26 Jul 2012 22:35:48 +0000]
rx: better rxi_FindRpcStat check for end of queue

patchset 1f0cf8b2b4bb6e36d8d82323a15ced72d91db0ec tested for
an empty queue but what is really required is a test for end of
queue after the queue_Scan().  If the queue_Scan() completes
at the end of the queue, in other words, pointing at the list
head, then return NULL because no match was found.

Change-Id: I444531d3cfa85b4691eaa8960da0266de82a03a3
Reviewed-on: http://gerrit.openafs.org/7886
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorx: protect against invalid params in rx_Copy*RPCStats
Jeffrey Altman [Wed, 25 Jul 2012 05:55:27 +0000]
rx: protect against invalid params in rx_Copy*RPCStats

Protect against:

  . rxi_Alloc() failure

Change-Id: I3334855e261bb40d5720fd376e62028760f0cee5
Reviewed-on: http://gerrit.openafs.org/7873
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovos: Minimize release impact for new RO sites
Andrew Deason [Wed, 9 May 2012 23:45:51 +0000]
vos: Minimize release impact for new RO sites

Currently, if a new RO site is added with 'vos addsite', the only way
to populate the new site with data is a 'vos release' (excepting hacks
using 'vos restore' and 'vos addsite -live', etc). Due to safeguards
in 'vos' ensuring that RO sites always all contain the same data when
marked as up-to-date in the VLDB, such a release always incurs some
amount of data to be transmitted to all sites, as well as remote sites
being brought offline briefly, even when the RW data has not changed
in very long time.

To alleviate this situation, make 'vos release' detect if new,
unpopulated RO sites have been added, and if the RW volume has not
changed since the release of any existing RO sites. If both of these
conditions are true, do not update any of the existing sites, but only
transmit volume data to the sites that did not already contain RO
volumes.

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

8 years agotabular_output: don't leak table struct on error exit
Garrett Wollman [Wed, 25 Jul 2012 04:41:05 +0000]
tabular_output: don't leak table struct on error exit

The caller is almost certainly going to exit when we return, but
all the same, don't leak the table description structure in the
error exit.  Makes the static analyzer happier.

Change-Id: I55e986a3601968751921ee38badf5bb86cd3174f
Reviewed-on: http://gerrit.openafs.org/7870
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoafsdump_extract: clarify logic to avoid freeing local buffer
Garrett Wollman [Wed, 25 Jul 2012 04:22:10 +0000]
afsdump_extract: clarify logic to avoid freeing local buffer

Sometimes vnodepath is set to a local buffer.  Sometimes it is set
to malloc'ed storage.  Simplify the logic for freeing vnodepath
by checking explicitly for this condition rather than the state
of other variables.  As a bonus, avoids a false (?) positive from
the static analyzer.

Change-Id: I3772cb97698acc5a6ac1f438977c673e6fea7722
Reviewed-on: http://gerrit.openafs.org/7869
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agovlserver: always use the hostaddress table in GetAddrsU
Michael Meffie [Fri, 22 Jun 2012 03:44:31 +0000]
vlserver: always use the hostaddress table in GetAddrsU

Use the hostaddress (IpMappedAddr) table when looking up hosts by IP
address and when listing addresses by index, instead of accessing
the multi-homed extensions directly.

The existing vos client calls the old GetAddrs rpc to first retrieve
a count of the number of addresses expected. This count is the
number of addresses in the hostaddress table.  If there are
unreferenced entries in the mh extension blocks, then vos can return
an incorrect or incomplete list of addresses.

To be consistent with the rest of the host address processing, use
the hostaddress table in GetAddrsU to lookup hosts by index or by IP
address.

The hostaddress table is already used when looking up addresses by
UUID.

Change-Id: I01aa29ae7d24d48bcd245f0320e329435f61548e
Reviewed-on: http://gerrit.openafs.org/7878
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoafs_conn: make release_conns_vector() actually work
Garrett Wollman [Mon, 23 Jul 2012 03:20:01 +0000]
afs_conn: make release_conns_vector() actually work

release_conns_vector must never have been called before with
a non-null parameter, because it could not possibly work.
The first line of the loop is a null pointer dereference, and
if that were fixed, there's also a modify-after-free bug as well.
It's not clear how what the old version was trying to do; this
version makes a stab at doing something sensible but might be
less than required.  (Note that this would be much simpler if
converted to queue(3) macros or a similar standard linked-list
data structure.)

Change-Id: I4c0fb7ed1ee977dcc0b4dfb32557882679069731
Reviewed-on: http://gerrit.openafs.org/7838
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agopruser: AFS_NONNULL annotations for functions that deserve it
Garrett Wollman [Wed, 25 Jul 2012 02:29:00 +0000]
pruser: AFS_NONNULL annotations for functions that deserve it

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

8 years agokauth: ka_CellToRealm's "realm" parameter cannot be null
Garrett Wollman [Wed, 25 Jul 2012 04:06:05 +0000]
kauth: ka_CellToRealm's "realm" parameter cannot be null

Annotate ka_CellToRealm with AFS_NONNULL to indicate that its
"realm" parameter cannot be null; it does not make sense to call
this routine without this parameter.  (The static analyzer inlines
the call to ka_ExpandCell and concludes that "realm" might be null;
the annotation will prevent that and avoid a false positive.)

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

8 years agoafsd: More pthreads damage
Andrew Deason [Wed, 25 Jul 2012 21:08:41 +0000]
afsd: More pthreads damage

We need MT_LIBS for -lpthread and such. HP-UX needs this, and probably
other platforms; otherwise we complain about missing pthreads symbols.

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

8 years agocrypto: Use our strcasecmp in kernel
Andrew Deason [Wed, 25 Jul 2012 20:48:34 +0000]
crypto: Use our strcasecmp in kernel

A few pieces of heimdal we use in the kernel call strcasecmp
(hcrypto/evp.c, krb5/crypto.c). The strcasecmp function does not exist
in all kernels (specifically, it does not exist in at least Linux 2.4,
2.6.9, and probably not on Solaris pre-10). Since we have our own copy
of strcasecmp (called afs_strcasecmp), just use that for now.

Ideally we would have some kind of configure test for detecting the
presence of the function in the kernel, and use the roken
implementation when we don't. We currently have the framework for
neither of those in place at the moment, though, so just get by with
this for now.

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

8 years agoafs: afs_strcasecmp args are const
Andrew Deason [Thu, 26 Jul 2012 14:47:35 +0000]
afs: afs_strcasecmp args are const

We do not modify our args, so declare them const so we are usable with
const strings.

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

8 years agoptuser: avoid implementation-defined behavior in CreateIdList()
Garrett Wollman [Wed, 25 Jul 2012 03:41:02 +0000]
ptuser: avoid implementation-defined behavior in CreateIdList()

CreateIdList() is an internal subroutine of pr_IDListExpandedMembers(),
used to flatten a hash table of protection IDs into an array that can
be passed to pr_IdToName().  If for some reason the hash table had no
entries, it would call malloc(0) and, depending on how the
the implementation defines this, either return a PRNOMEM error (wrong!)
or else allocate a minimum-sized buffer which pr_IdListExpandedMembers
would then promptly leak.  Compromise between the two behaviors by
not allocating any memory in this case but returning success, and in
the caller check for an empty list and avoid the pointless RPC to
translate no IDs into no names.  pr_IDListExpandedMembers() will return
success, as it previously did in the non-PRNOMEM case.

Change-Id: I8a042bde3e98f5cf248358f37f2e875d6b5b298d
Reviewed-on: http://gerrit.openafs.org/7863
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agokauth: don't call lcstring with a null source argument
Garrett Wollman [Wed, 25 Jul 2012 03:54:56 +0000]
kauth: don't call lcstring with a null source argument

This code was probably never executed, but now that lcstring() has
an AFS_NONNULL annotation, the static analyzer indicates the
potential null-pointer-dereference.

Change-Id: Idb41c2af1cb38bc5c084d4912614e0a553d4aa5a
Reviewed-on: http://gerrit.openafs.org/7864
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agorxgen: avoid an unimportant memory leak in docppline()
Garrett Wollman [Wed, 25 Jul 2012 04:49:25 +0000]
rxgen: avoid an unimportant memory leak in docppline()

If cpp emitted
  # 1234 ""
docppline() would leak a small buffer.  Just free it.
The static analyzer will thank you.

Change-Id: I34ae6e228469a900139375f2a4758855922cf0ef
Reviewed-on: http://gerrit.openafs.org/7871
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agorx: Initialize kernel rx_atomic_mutex
Andrew Deason [Wed, 25 Jul 2012 16:59:44 +0000]
rx: Initialize kernel rx_atomic_mutex

Change-Id: I9a63fbee0e5a0f9df31b8e2440e91a03af54151f
Reviewed-on: http://gerrit.openafs.org/7876
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agorx: Raise minimum Linux atomics version to 2.6
Andrew Deason [Wed, 25 Jul 2012 15:45:16 +0000]
rx: Raise minimum Linux atomics version to 2.6

Linux 2.4 does not have atomic_dec_return. If we switch to a
dec_and_test-like API, then we could use the Linux 2.4 atomics. But
for now, just raise the minimum to 2.6, and for 2.4 and below just use
the generic atomics implementation so we can build.

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

8 years agoLINUX24: explicit dir buffers fallout
Andrew Deason [Tue, 24 Jul 2012 23:18:13 +0000]
LINUX24: explicit dir buffers fallout

Fix fallout from 0284e65f97861e888d95576f22a93cd681813c39

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

8 years agomacos: next version header
Derrick Brashear [Wed, 25 Jul 2012 04:17:46 +0000]
macos: next version header

add header for next macos

Change-Id: I9078b77587197b38ff705663c73a7f930efeec7a
Reviewed-on: http://gerrit.openafs.org/7868
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agoWindows: NPAddConnection3 debugging
Jeffrey Altman [Tue, 24 Jul 2012 17:56:02 +0000]
Windows: NPAddConnection3 debugging

Define Add3FlagsToString() and use it when generating debug
output from NPAddConnection3().

Change-Id: I73251890659ea5a833b5f67d26129053c625b58a
Reviewed-on: http://gerrit.openafs.org/7860
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Correct exceptions in AFSRDFSProvider
Jeffrey Altman [Tue, 24 Jul 2012 17:53:49 +0000]
Windows: Correct exceptions in AFSRDFSProvider

Correct two errors in the generation of debug strings that
were triggering invalid memory access exceptions.

Change-Id: Ie5ee3289e2fa74809067f05931c3aa568c2be9d0
Reviewed-on: http://gerrit.openafs.org/7859
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoafs_bypasscache: parameters of afs_ReadNoCache can't be null
Garrett Wollman [Mon, 23 Jul 2012 02:57:41 +0000]
afs_bypasscache: parameters of afs_ReadNoCache can't be null

The first two parameters of afs_ReadNoCache() are unconditionally
indirected through, and all existing callers appear to guarantee
that these parameters are in fact non-null, so annotate the function
declaration to so indicate, and remove the one test that checks
whether avc (the first parameter) is null.  I suspect that acred
cannot be null either, but this code does not appear to depend on
that, so it's not included in the non-null annotation.

Change-Id: I496c868ffcbc9b894f91578019bc30bf7b14fefd
Reviewed-on: http://gerrit.openafs.org/7837
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoptuser: use the "prname" typedef rather than "char[PR_MAXNAMELEN]"
Garrett Wollman [Tue, 24 Jul 2012 05:17:47 +0000]
ptuser: use the "prname" typedef rather than "char[PR_MAXNAMELEN]"

There's a typedef for this type, so use it in function prototypes
rather than the more complicated declarator.

Change-Id: I75a9b4e72201e6b2072dba14185579f9c4aa61be
Reviewed-on: http://gerrit.openafs.org/7858
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoafsd: fix pthreads damage
Derrick Brashear [Tue, 24 Jul 2012 04:26:56 +0000]
afsd: fix pthreads damage

ah linker fun. clean up from 98f86cfc53fc987fdaed2f5bb733b5b5d21bfda9

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

8 years agoWindows: No VLDB server blocking probes
Jeffrey Altman [Mon, 2 Jul 2012 02:31:04 +0000]
Windows: No VLDB server blocking probes

Now that we have background probes, use them for VLDB server probes.

Change-Id: Ib160ec5ae702065f410e85ae949ae13a02c425e8
Reviewed-on: http://gerrit.openafs.org/7854
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: NOPROBE means probe in background thread
Jeffrey Altman [Mon, 2 Jul 2012 02:27:13 +0000]
Windows: NOPROBE means probe in background thread

It is important that down servers be detected as soon as possible.
When it is not possible to perform a blocking probe, perform a
probe in a backgrond thread.

Change-Id: If73856359ba894c5c302c11fd50aaa76cd2fcf28
Reviewed-on: http://gerrit.openafs.org/7853
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoptuser: pr_SNameToId/SIdToName: if RPC response empty, force error
Garrett Wollman [Tue, 24 Jul 2012 02:07:38 +0000]
ptuser: pr_SNameToId/SIdToName: if RPC response empty, force error

If the prserver returns an empty response to ubik_PR_NameToID
or ubik_PR_IDToName, but doesn't otherwise give an error,
force a PRINTERNAL error return so that the client knows that the
the return parameter was not updated.  Existing callers seem to
expect this, as pr_SNameToId is often called without initializing
the variable which receives the result and checking only for the
error code.

PRINTERNAL is a new error code.

Change-Id: I3e598a22deb39792a0f208ac09b3c1991d6f1e58
Reviewed-on: http://gerrit.openafs.org/7836
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoafsd: switch to pthreads
Derrick Brashear [Sun, 22 Jul 2012 13:18:28 +0000]
afsd: switch to pthreads

kill one more lwp dependency.

Change-Id: I9a878d7b0e1ab50770c6162f6bd380119b7a4292
Reviewed-on: http://gerrit.openafs.org/7828
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agoafsd: cleanup syscall cleanup
Derrick Brashear [Tue, 24 Jul 2012 02:25:19 +0000]
afsd: cleanup syscall cleanup

sadly ead743db5d57afa175f5dc0828b76881bcbcbf54 missed a few bugs. fix
them here.

Change-Id: I03d52543fb096f75ccf6dbde4f7526a7c0c576bb
Reviewed-on: http://gerrit.openafs.org/7852
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agoWindows: get rid of _strdup and use rk_strdup
Jeffrey Altman [Sun, 22 Jul 2012 05:19:57 +0000]
Windows: get rid of _strdup and use rk_strdup

Do not use the _strdup() C RTL function.  Use strdup() so that
rk_strdup() roken replacement can be used.

Change-Id: Ifd2808a078b514468aee52ef76a9b51e606a2c88
Reviewed-on: http://gerrit.openafs.org/7848
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoroken: rk_strdup rk_wcsdup exports
Jeffrey Altman [Fri, 20 Jul 2012 14:19:07 +0000]
roken: rk_strdup rk_wcsdup exports

Change-Id: Iee3670ddf86599dd81f1247a9f8cfafcbc6e1e8f
Reviewed-on: http://gerrit.openafs.org/7847
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoImport of code from heimdal
Heimdal Developers [Mon, 23 Jul 2012 16:27:56 +0000]
Import of code from heimdal

This commit updates the code imported from heimdal to
b8a53329fc8bf2fe8c4f4058512f828d7654e3f8 (switch-from-svn-to-git-3003-gb8a5332)

Upstream changes are:

Jeffrey Altman (2):
      Windows: rk_strdup allocator
      Windows: rk_wcsdup allocator

Nicolas Williams (1):
      Fix bug in _krb5_expand_path_tokensv()

Change-Id: I08abb25b4f4136bccb3eaf8d8c44851ce748f395
Reviewed-on: http://gerrit.openafs.org/7842
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoptserver: Make ptclient build again
Simon Wilkinson [Wed, 18 Jul 2012 09:22:07 +0000]
ptserver: Make ptclient build again

Make the ptclient utility build again, and add it to the ptserver
Makefile so that it is built by default and, hopefully, won't
bitrot again.

Change-Id: I888a9d4392b62ecb2d7556694400a2853658052a
Reviewed-on: http://gerrit.openafs.org/7841
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agoauth: Fix GetTokenEx with NULL cellName
Simon Wilkinson [Mon, 16 Jul 2012 19:09:04 +0000]
auth: Fix GetTokenEx with NULL cellName

If GetTokenEx is called with a NULL cellName, it means use the
local cell. To do this with the legacy interface, a 0 length string
must be used for the cell instance of the ktc_principal passed to
GetToken. Fix this so that we do so, rather than attempting to
strcpy(..., NULL) which never ends well.

Caught by clang-analyzer

Change-Id: I53d9bdf0fc280ee073a2fb7693659269df29c2eb
Reviewed-on: http://gerrit.openafs.org/7840
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agorx: rxi_FindRpcStat must test for empty queue
Jeffrey Altman [Mon, 23 Jul 2012 00:40:41 +0000]
rx: rxi_FindRpcStat must test for empty queue

When queue_Scan is executed on an empty queue the queue element
variable, in this case 'rpc_stat' is the queue head, _RXQ(q),
and not NULL.  Callers of rxi_FindRpcStat() expect NULL on failure
to find or create an rx_interface_stat object.  Correct the behavior
by testing for an empty queue and return NULL immediately if the
queue is empty and the caller is not requesting creation.

Change-Id: I9952d7aaf357e039e87f6b8b17cb1a00208d6465
Reviewed-on: http://gerrit.openafs.org/7835
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoafsd: Tidy up system calls
Simon Wilkinson [Wed, 7 Sep 2011 17:31:32 +0000]
afsd: Tidy up system calls

Tidy up the way that we do system calls from afsd, by making
afsd_syscall a va_arg function, using a structure to pass system call
information around, and simplifying the #ifdef ladder that converts our
platform independent system calls into something platform specific.

This fixes all of the warnings in afsd which required the -Wno-error
option, the only warnings remaining are related to daemon being
deprecated on Darwin.

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

8 years agoWindows: cm_UpdateVolumeLocation volp locked
Jeffrey Altman [Mon, 23 Jul 2012 05:38:03 +0000]
Windows: cm_UpdateVolumeLocation volp locked

When calling cm_UpdateVolumeLocation the volp->mx must be held.
cm_Analyze() did not obtain the mutex as required.

Change-Id: Ida69105879a78692a367cd4439bee8e4bea751ff
Reviewed-on: http://gerrit.openafs.org/7839
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agolibafs: avoid flushing already freed dcaches in flush volumes
Michael Meffie [Thu, 7 Jun 2012 17:54:20 +0000]
libafs: avoid flushing already freed dcaches in flush volumes

When flushing volume data, skip flushing dcache entries which
are already freed.

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

8 years agovol: set correct bit in bitmap after VGrowBitmap
Marc Dionne [Fri, 20 Jul 2012 02:23:20 +0000]
vol: set correct bit in bitmap after VGrowBitmap

Set the correct bit after the bitmap is expanded with VGrowBitmap
so we don't allocate it twice and trigger a salvage.

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

8 years agouafs: avoid type-punning in get_user_struct()
Garrett Wollman [Fri, 20 Jul 2012 22:35:56 +0000]
uafs: avoid type-punning in get_user_struct()

There's no need for type-punning here; usr_getspecific() is a macro
that just assigns to the variable whose address we provide, so the
cast was just unnecessary (and erroneous) obfuscation.  This is the
only caller of usr_getspecific(), so if it needs to be more complex
in the future, it should probably just be open-coded here.

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

8 years agoubik: don't force an error just because calliter is early returning
Derrick Brashear [Sat, 21 Jul 2012 04:27:49 +0000]
ubik: don't force an error just because calliter is early returning

in this case, racing another ClientInit caller is not fatal.
clean up from 56b5b9a1c51c2197923aa373c180a834edabe4f6 which was
my fault.

Change-Id: I81d3298a775ed46972779b4121498560883fee01
Reviewed-on: http://gerrit.openafs.org/7803
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agostrcompose: NULL must always be cast when passed to a variadic function
Garrett Wollman [Sat, 21 Jul 2012 05:35:15 +0000]
strcompose: NULL must always be cast when passed to a variadic function

The C standard allows NULL to be defined as a bare "0", which will
be passed to variadic functions as an int.  If the function expects
a pointer type, demons fly out of your nose.  strcompose() is such
a function, so make sure that all of its callers cast NULL appropriately.
(None of them did.)  This may be an opportune time to change all of
the callers to spell it opr_strcompose() as well, and avoid using a
reserved identifier, but this change does not do so.

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

8 years agoopr: constify various string functions and mark them AFS_NONNULL()
Garrett Wollman [Sat, 21 Jul 2012 05:22:02 +0000]
opr: constify various string functions and mark them AFS_NONNULL()

All of these string functions require at least one non-null argument.
Mark them as AFS_NONNULL() so that the compiler and static checker can
find erroneous uses.  The "source" arguments of lcstring and ucstring
can be const, so do so.  (This doesn't affect anything in the tree
right now.)  While here, note a few unfixed issues with these interfaces.)

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

8 years agolibafs: getattr should include S_IFDIR on fake dirs
Derrick Brashear [Wed, 18 Jul 2012 04:02:16 +0000]
libafs: getattr should include S_IFDIR on fake dirs

on macos, VDIR is not useful as part of a directory mode. it's just not.
on aix, solaris, we presumably want to pass S_ISDIR, so do so

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

8 years agoWindows: Recompute server rank periodically
Jeffrey Altman [Mon, 2 Jul 2012 14:26:05 +0000]
Windows: Recompute server rank periodically

After VL_ProbeServer and RXAFS_Getcapabilities RPCs call
cm_RankServer() to recompute the server ranks based upon the
updated peer statistics.

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

8 years agoWindows: Clear peer RPC stats on IP addr change
Jeffrey Altman [Fri, 20 Jul 2012 06:57:35 +0000]
Windows: Clear peer RPC stats on IP addr change

When an IP address change has been detected, clear the peer
RPC statistics used for server ranking.

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

8 years agoWindows: server rankings by RPC statistics
Jeffrey Altman [Fri, 20 Jul 2012 06:55:20 +0000]
Windows: server rankings by RPC statistics

Use VL_ProbeServer for VLDB servers and either
opcode_RXAFS_GetCapabilities or opcode_RXAFS_GetTime for
File servers.

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

8 years agorxgen: per-opcode stats
Derrick Brashear [Sat, 21 Jul 2012 04:17:14 +0000]
rxgen: per-opcode stats

allow access to per-opcode stats

Change-Id: I17639cf23acac23acfb9cb7dc07a7c5c81d4ff89
Reviewed-on: http://gerrit.openafs.org/7802
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jacob Thebault-Spieker <summatusmentis@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agorxgen: emit opcode defines in header
Derrick Brashear [Sat, 21 Jul 2012 04:07:41 +0000]
rxgen: emit opcode defines in header

define an opcode-name-specific define with the numeric value
of the opcode

Change-Id: I34e6eb57ac2c57319a83b0279cc9115050a39c4f
Reviewed-on: http://gerrit.openafs.org/7801
Reviewed-by: Jacob Thebault-Spieker <summatusmentis@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoxdr: fix two old FIXMEs related to signed/unsigned arithmetic
Garrett Wollman [Sat, 21 Jul 2012 04:04:58 +0000]
xdr: fix two old FIXMEs related to signed/unsigned arithmetic

It's implementation-defined whether the C '>>' operator, when
applied to a signed integer, is sign-extending or zero-filling.
If you want unsigned arithmetic, you have to ask for it explicitly.
One assumes the reason for the shift is to avoid overflow if the
returned size/count is later converted to a signed int, in which
case maybe it would be better to use INT_MAX here.  This is the
minimal change necessary for correctness.

Change-Id: I6e848110963b5e1832a11d052d84884f10903e2e
Reviewed-on: http://gerrit.openafs.org/7800
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: AFSTearDownFcbExtents loop conditional
Jeffrey Altman [Sat, 21 Jul 2012 16:17:46 +0000]
Windows: AFSTearDownFcbExtents loop conditional

If there are extents in the list with a non-zero ActiveCount,
those extents will be skipped and the list 'le' will never
become empty.  Add an additional condition to ensure that the
loop is only executed once for each extent in the list.

Change-Id: I48adf7c49282181d0a34135ac50f7fa1a165c735
Reviewed-on: http://gerrit.openafs.org/7810
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: memory leak AFSInitPIOCtlDirectoryCB
Jeffrey Altman [Sat, 21 Jul 2012 16:02:20 +0000]
Windows: memory leak AFSInitPIOCtlDirectoryCB

In an error occurs during AFSInitPIOCtlDirectoryCB processing
the nonpaged pool allocation would be leaked.

Change-Id: I092538202d84bd65476ba21a68e210d5f626ead2
Reviewed-on: http://gerrit.openafs.org/7809
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: memory leak AFSRemoveVolume
Jeffrey Altman [Sat, 21 Jul 2012 16:00:21 +0000]
Windows: memory leak AFSRemoveVolume

Do not leak the
VolumeCB->ObjectInformation.Specific.Directory.PIOCtlDirectoryCB->NonPaged
allocation and the associated lock object.

Change-Id: Ie6455c49fdcee578ab31355df1b2237f27a92e1d
Reviewed-on: http://gerrit.openafs.org/7808
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: AFSExFreePool -> AFSExFreePoolWithTag
Jeffrey Altman [Sat, 21 Jul 2012 15:52:22 +0000]
Windows: AFSExFreePool -> AFSExFreePoolWithTag

Replace AFSExFreePool() with AFSExFreePoolWithTag() which is
a wrapper around both ExFreePool() and ExFreePoolWithTag().
If a 'Tag' value, is provided, ExFreePoolWithTag() is used.
Otherwise, ExFreePool().

Specify allocation tag values wherever possible.  Path name buffer
tags are not specified because they are allocated using multiple
tags.  The same is true for network provider string buffers.

This is being done in order to debug a memory corruption issue.

Warning: this is a change to the AFSRedir->AFSRedirLib interface
and therefore both drivers must be updated with a reboot and
not simply restarting the service.

Change-Id: Id5c0503141d1077d6c2beae5d28602160105a312
Reviewed-on: http://gerrit.openafs.org/7807
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: Freeing SeQueryInformationToken allocations
Jeffrey Altman [Sat, 21 Jul 2012 15:57:40 +0000]
Windows: Freeing SeQueryInformationToken allocations

Memory allocated by SeQueryInformationToken() must be freed with
ExFreePool() and not AFSExFreePool().

Change-Id: Iece2c37d5dc524204cbf3d8d6869148e1a0ce88e
Reviewed-on: http://gerrit.openafs.org/7806
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorx: fix abort on missing service
Jeffrey Altman [Fri, 20 Jul 2012 14:20:02 +0000]
rx: fix abort on missing service

patchset 1fbe83f9aacfc36a9c426ba1fd18ad7c72869dc1 introduced
the possibility that a NULL connection pointer could be dereferenced.
Prevent it.

Change-Id: Ic813642c8073cedc3e4df578c1b06fecd22cfbdf
Reviewed-on: http://gerrit.openafs.org/7794
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agorx: rxi_ReceiveDataPacket do not set rprev on drop
Jeffrey Altman [Mon, 16 Jul 2012 20:53:32 +0000]
rx: rxi_ReceiveDataPacket do not set rprev on drop

In KERNEL builds if there are no available packet buffers the
new packet is dropped on the floor.  In that case, the call's
rprev field should not be updated because the packet was never
"received" for delivery to the application.

Remove a dead comment from the same block of code.

Change-Id: I12a2b1618a430880d18efee48e6348e6f9ba8119
Reviewed-on: http://gerrit.openafs.org/7784
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: avoid memory overrun during extent release
Jeffrey Altman [Fri, 20 Jul 2012 05:00:38 +0000]
Windows: avoid memory overrun during extent release

While tearing down extents, if an extent is found to be in use
it will be skipped.  Must use 'ulReleaseCount' as the index
into the released extent array.

Change-Id: Iaf8a82c77ac8f4ddb30b35f43a4ce7a70f4a32a8
Reviewed-on: http://gerrit.openafs.org/7796
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoWindows: more roken.h include corrections
Jeffrey Altman [Fri, 20 Jul 2012 04:59:33 +0000]
Windows: more roken.h include corrections

Change-Id: I02d4347b870ff1e06b4f144bedb37d50c697c5ba
Reviewed-on: http://gerrit.openafs.org/7795
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agowindows: add afsroken to afssvrcpa NTMakefile
Jeffrey Altman [Fri, 20 Jul 2012 06:54:18 +0000]
windows: add afsroken to afssvrcpa NTMakefile

Change-Id: Iae17ad514bc9ce9a6786e820105a413b31a419ff
Reviewed-on: http://gerrit.openafs.org/7797
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agouafs: avoid unnecessary type-punning
Garrett Wollman [Fri, 20 Jul 2012 22:11:38 +0000]
uafs: avoid unnecessary type-punning

There's no need to declare a separate buffer and initialize a structure
inside it when we can just instantiate the structure directly.

Change-Id: Idbcad31343ce7f074015f5921a4997d3f6c9799a
Reviewed-on: http://gerrit.openafs.org/7798
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agomacos: no bulkstat
Derrick Brashear [Thu, 19 Jul 2012 15:30:02 +0000]
macos: no bulkstat

i have a bulkstat refactor in mind, but this *still* isn't safe
on osx. disable as is on 1.6

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

8 years agoubik: refactor error exits in internal CallIter()
Garrett Wollman [Mon, 16 Jul 2012 02:07:05 +0000]
ubik: refactor error exits in internal CallIter()

Originally, the first store to "code" was dead here.  Refactor the
error exits to follow the non-error exit path, which has the effect
of making the store to "code" live again (and also makes it less
likely that any new cleanup code will be unintentionally omitted).
In the ubik_ClientInit recovery case, handle the possibility that
aproc() returned zero and return UINTERNAL rather than letting the
caller think that this operation succeeded.

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

8 years agomacos: get more packets if requested
Derrick Brashear [Tue, 17 Jul 2012 19:34:07 +0000]
macos: get more packets if requested

analogous to eead07418f13cd87a90770f03ea5118c546d8f1a for ukernel,
this is for macos' upcall procedure

Change-Id: Ia9d6108d8bb45b9bd33fe9a3af761dfe15248c6e
Reviewed-on: http://gerrit.openafs.org/7788
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agomacos: native apps need 64 bit support
Derrick Brashear [Tue, 17 Jul 2012 04:15:56 +0000]
macos: native apps need 64 bit support

the installer bundle, prefs pane and backgrounder all need to be 64 bit
mode since the system uses them as plugins

Change-Id: Ic2242ed8c993b7ed0a7c15ada78b625799bb446a
Reviewed-on: http://gerrit.openafs.org/7787
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agomacos: fix growlagent icon handling
Derrick Brashear [Tue, 17 Jul 2012 02:32:55 +0000]
macos: fix growlagent icon handling

the whole of the api used for icon handling when you steal it
from a resource fork is deprecated in new macos. fine. we'll just make
an app bundle by cheating, move andy into a standalone icns file,
install him into the "bundle" and open it the macos way.

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

8 years agolibafs: pointopoint not supported in ukernel
Derrick Brashear [Mon, 16 Jul 2012 19:55:54 +0000]
libafs: pointopoint not supported in ukernel

afs_server.c:1054: error: 'struct usr_in_ifaddr' has no member named 'ia_dstaddr'

well, for now, bye bye!

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

8 years agomacos: future-proof MakefileProto.DARWIN.in
Derrick Brashear [Mon, 16 Jul 2012 19:16:53 +0000]
macos: future-proof MakefileProto.DARWIN.in

if new cases show up which match the current ones, they just work.
darwin60 and older were already killed from the tree, kill here also

Change-Id: Id246e13985c4752e99f606efd009bc5ce2871691
Reviewed-on: http://gerrit.openafs.org/7782
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agomacos: actually link in shlibs
Derrick Brashear [Mon, 16 Jul 2012 19:09:11 +0000]
macos: actually link in shlibs

we need shlibs in /usr/lib, actually install the links

Change-Id: I172da1d043f70f7335c5d0aaaa9a301eef542243
Reviewed-on: http://gerrit.openafs.org/7781
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agoafs_vcache: remove redundant assignment in afs_FlushAllVCaches()
Garrett Wollman [Mon, 16 Jul 2012 02:47:51 +0000]
afs_vcache: remove redundant assignment in afs_FlushAllVCaches()

Don't do in the body of the loop that which the loop itself
already does.

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

8 years agoafs_server: remove 3 dead assignments in LoopServers, move live one
Garrett Wollman [Mon, 16 Jul 2012 02:16:27 +0000]
afs_server: remove 3 dead assignments in LoopServers, move live one

The assignments to conns, rxconns, and conntimer are all dead, so
remove them.  The assignment to nconns is live, but rather far from
the for loop that actually uses it; move it to just before the loop.

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