openafs.git
8 years agoCatch up on fbsd releases
Ben Kaduk [Sat, 23 Jun 2012 01:33:50 +0000]
Catch up on fbsd releases

Pull in the changes needed to even have a chance at supporting
FreeBSD 8.3, 8.4, 9-stable, and 10-current.
Conditionals for changed interfaces in a follow-up commit.

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

8 years agocmd: Avoid premature OptionAsString free
Andrew Deason [Thu, 24 May 2012 19:53:59 +0000]
cmd: Avoid premature OptionAsString free

Only free the previously-set string value if we're actually going to
change it. This avoids the scenario where a caller does something
like:

  char *str = strdup("defaultval");
  /* ... */
  cmd_OptionAsString(as, OPT_foo, &str);

resulting in 'str' pointing to freed memory when the relevant option
is not specified, or there is some other error.

Change-Id: If1f94d5eb39cc4dba9a4195ff20850ff81737eb9
Reviewed-on: http://gerrit.openafs.org/7475
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agorx: abort on missing service
Derrick Brashear [Fri, 1 Jun 2012 17:16:31 +0000]
rx: abort on missing service

currently rx does not send an abort if a service does not
exist; it quietly ignores the packet. provide a hint we have
done so.

Change-Id: Id3533afd46ed21765d4d2aab630a896b21c945de
Reviewed-on: http://gerrit.openafs.org/7563
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoFBSD: Add osi_fbsd_checkinuse
Andrew Deason [Sun, 20 May 2012 22:05:12 +0000]
FBSD: Add osi_fbsd_checkinuse

Add the osi_fbsd_checkinuse function, which contains code common to
the FreeBSD osi_TryEvictVCache and osi_VM_FlushVCache. Implement the
latter two in terms of osi_fbsd_checkinuse.

This commit should incur no behavior changes. This is just a
reorganization so future commits can change the implementations of
osi_TryEvictVCache and osi_VM_FlushVCache.

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

8 years agovol: avoid attach retry loops on SYNC_FAILED
Michael Meffie [Mon, 18 Jun 2012 21:16:02 +0000]
vol: avoid attach retry loops on SYNC_FAILED

Avoid unnecessary volume attach retry loops if a volume
salvage is unable to be scheduled due to a hard error.

Change-Id: If1962b83e03f634044a55b03787661b8a7695008
Reviewed-on: http://gerrit.openafs.org/7566
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agolibafs: put connection in analyze when conn srvr missing
Derrick Brashear [Tue, 19 Jun 2012 19:11:38 +0000]
libafs: put connection in analyze when conn srvr missing

we need to putconn in all cases we can in afs_Analyze, but at least
one case we didn't. fixed.

Change-Id: I4e3b8d9f8e7445e3641fad32ff54dde2d21bb06b
Reviewed-on: http://gerrit.openafs.org/7567
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agotests: Fix cmd config file path
Simon Wilkinson [Wed, 20 Jun 2012 20:55:25 +0000]
tests: Fix cmd config file path

Fix the configuration file path for the cmd test so that it works
when invoked from runtests

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

8 years agoAuth: increase size of DNS resolver answer buffer
Niklas Jonsson [Wed, 20 Jun 2012 14:03:54 +0000]
Auth: increase size of DNS resolver answer buffer

This patchset increases the size of the res_search() answer
buffer from 1024 octets to 4096 octets.   This is not a proper
long term solution but will permit sites with longer response
lists to make use of SRV and AFSDB records.

This patchset only impacts UNIX systems.  Windows uses the
Win32 DNS resolver which dynamically allocates memory based
upon the size of the response.

FIXES 130936

Change-Id: I8434e128fb5918839c216209851b37a17cf94065
Reviewed-on: http://gerrit.openafs.org/7575
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agorx: provide mechanism to send a bare abort packet
Simon Wilkinson [Fri, 1 Jun 2012 17:20:57 +0000]
rx: provide mechanism to send a bare abort packet

simply put an abort on the wire

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

8 years agoopr: Add simple time type
Simon Wilkinson [Tue, 15 May 2012 15:45:57 +0000]
opr: Add simple time type

Add a simple time type to the opr library, which provides helper
routines to implement the 100ns time format selected for on-the-wire
use for AFS-3 (this also provides a handy single integer internal
time format)

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

8 years agoviced: Abstract out peer mapping code
Simon Wilkinson [Sun, 10 Jun 2012 10:43:56 +0000]
viced: Abstract out peer mapping code

Pull the code which gets the peer information for an incoming connection
into its own function.

Reformat this function a little to avoid if-ladders.

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

8 years agoviced: Tidy up VL initialization
Simon Wilkinson [Sat, 9 Jun 2012 21:29:44 +0000]
viced: Tidy up VL initialization

Tidy up the routines which initialize the VL server so that they
don't reopen an already open configuration directory, and so that
some global variables are less globally scoped.

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

8 years agorxgen: Make input strings const
Simon Wilkinson [Wed, 30 May 2012 17:25:51 +0000]
rxgen: Make input strings const

Modify the code generation routines so that string inputs to RPCs
are declared as (const char *) on the client side. This doesn't affect
callers as we can freely cast from (char *) to (const char *), but means
it is easier to write API wrappers that accept const arguments.

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

8 years agoaklog: Fix error message fallback for Heimdal
Simon Wilkinson [Thu, 7 Jun 2012 22:21:48 +0000]
aklog: Fix error message fallback for Heimdal

Since we reverted to using Russ's upstream version of rra-c-util's
krb5.m4, we no longer check for the existence of the pure com_err
error_message().

So, for error message fallback on Heimdal, use krb5_get_error_message()
instead. As we don't have access to the context in which the error
occurred, build one to get the raw com_err error translation - this
won't give us any additional context specific detail.

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

8 years agoviced: Abstract out hpr thread context code
Simon Wilkinson [Thu, 10 May 2012 23:34:24 +0000]
viced: Abstract out hpr thread context code

Every hpr lookup function had a copy of the same code to pull a thread
specific ubik context out of the pthread library, and to create one if
one wasn't already there.

Instead of endlessly repeating this code, create a small inline function
to do the job.

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

8 years agorx: Constify rx_opaque_populate
Simon Wilkinson [Thu, 7 Jun 2012 19:46:27 +0000]
rx: Constify rx_opaque_populate

rx_opaque_populate doesn't modify the data passed into it, so
make that argument const

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

8 years agoviced: Remove unused profiling code
Simon Wilkinson [Tue, 15 May 2012 16:01:50 +0000]
viced: Remove unused profiling code

src/viced/profile.c is never built, and contains unused code which
is now useless to us. Just remove it from the tree - it is in git if
we ever need it again.

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

8 years agouss: allow disabling by configure switch
Derrick Brashear [Tue, 12 Jun 2012 18:23:12 +0000]
uss: allow disabling by configure switch

provide an option to disable building uss. current heimdal
when built static can leak symbol names for its flex/bison parser
causing symbol conflicts. this is but a workaround, but
sites not needing uss can at least use it.

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

8 years agogtx: add configure switch to force not building
Derrick Brashear [Tue, 12 Jun 2012 18:10:04 +0000]
gtx: add configure switch to force not building

allow gtx and associated software to be turned off.

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

8 years agoaklog: can't assume krb5_524_conv_principal based on convert_creds
Derrick Brashear [Tue, 12 Jun 2012 17:46:46 +0000]
aklog: can't assume krb5_524_conv_principal based on convert_creds

add probing for krb5_524_conv_principal directly instead of
assuming finding a 524 library will find it. current heimdal
does not include it.

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

8 years agoviced: fix GetVolumePackage to not bomb always when GetClient called
Derrick Brashear [Mon, 11 Jun 2012 20:37:53 +0000]
viced: fix GetVolumePackage to not bomb always when GetClient called

master only. already correct in 1.6. the gotos for error exit should
be called only when we have an error, due to missing braces that was
not true

Change-Id: I396be7d34ad741e01634a702784a0892f47a2d5a
Reviewed-on: http://gerrit.openafs.org/7549
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoviced: fix merge error
Derrick Brashear [Mon, 11 Jun 2012 20:05:10 +0000]
viced: fix merge error

when 37fc2dfbb9e3a8a8ecb022febae7ccd04d7340a4 was merged, the close
bracket went in the wrong place, meaning for non-remote calls
we don't re-enable keepalives. fix it.

Change-Id: I163db9b3b2f42f629d8a5ff22a75902a61a3138b
Reviewed-on: http://gerrit.openafs.org/7548
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agovol: Avoid getting stuck in ATTACHING in attach2
Andrew Deason [Thu, 31 May 2012 22:45:56 +0000]
vol: Avoid getting stuck in ATTACHING in attach2

Since commit 5fc2365f, a VNOVOL error early in attach2 meant that we
skipped changing the volume state to anything, and just returned
instead. When we do this, the volume is in VOL_STATE_ATTACHING for
DAFS, and so if we return, the volume will forever be in
VOL_STATE_ATTACHING. The next thing that tries to access the volume
will wait forever for the volume to come out of that state.

So, revert half of 5fc2365f, and transition to ERROR state instead.
This code path should not be hit during normal usage, since a
nonexistant volume access for the fileserver will be detected earlier.
If the volume does not appear to exist at this stage of attachment,
something is wrong with the volume, so this warrants the ERROR state.

For the volserver and other volume utilities, we may hit this when a
request just plain references a nonexistant volume for whatever
reason, but in that case the vp should go away soon. For non-DAFS,
this commit does not change much, since the difference between
error_notbroken and unlocked_error is very small.

The other half of 5fc2365f is not changed, since it is correct. For
VOFFLINE errors at this point, the volume has already been
transitioned to VOL_STATE_UNATTACHED, so it is okay to return. Add a
comment to help make this more explicit.

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

8 years agoDAFS: Preattach, not attach, in FSYNC_Drop
Andrew Deason [Thu, 31 May 2012 21:41:15 +0000]
DAFS: Preattach, not attach, in FSYNC_Drop

FSYNC_Drop currently attaches volumes that were checked out by the
dropped fssync handler, but not checked back in, in order to make the
volume available again. For DAFS, however, a full attachment is
unnecessary; just preattach instead.

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

8 years agovol-salvage: Unlock volumes before exiting
Andrew Deason [Thu, 31 May 2012 21:15:33 +0000]
vol-salvage: Unlock volumes before exiting

Normally, volume locks acquired by an exiting salvaging process would
be automatically given up when the process exits, since our FDs are
closed. However, if we exit by calling Exit() or Abort(), we
gracefully shutdown our SYNC channels before exiting. For FSSYNC, this
can result in the fileserver trying to online the volumes we had
checked out but had not yet checked back in, so the fileserver may try
to online a volume we have locked, before the locks have been
released.

To avoid this, unlock all volume locks for all partitions before we
shutdown SYNC channels on exit.

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

8 years agovol-salvage: Indent some ifdefs
Andrew Deason [Thu, 31 May 2012 21:08:00 +0000]
vol-salvage: Indent some ifdefs

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

8 years agolibafs: initialize free dcache list for memcache
Derrick Brashear [Fri, 25 May 2012 13:40:54 +0000]
libafs: initialize free dcache list for memcache

reuse the disk cache dcache creation code for memcache, then
call it to prime the list

Change-Id: If63268aa1a89c9642236f944e1ac8328d68aeba5
Reviewed-on: http://gerrit.openafs.org/7446
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>

8 years agoviced: clear optstring before parsing
Derrick Brashear [Fri, 8 Jun 2012 23:52:33 +0000]
viced: clear optstring before parsing

we try to free the string if there was a value, so
if there's none we should probably ensure we know it

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

8 years agocmd: avoid issues with static heimdal
Derrick Brashear [Fri, 8 Jun 2012 20:12:17 +0000]
cmd: avoid issues with static heimdal

stealing the krb5 parser and linking with static heimdal can cause problems.
remap things we have which duplicate heimdal's private namespace.

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

8 years agoLinux 3.5: encode_fh API change
Marc Dionne [Sun, 3 Jun 2012 01:35:53 +0000]
Linux 3.5: encode_fh API change

The encode_fh export operation now expects two inode arguments
instead of a dentry and a "connectable" flag.  Use the inode of
the dentry we're interested in, and NULL as the parent inode which
is the same as passing a 0 flag in the previous API.

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

8 years agoafsd: include sys/resource.h in afsd_kernel.c
Marc Dionne [Sun, 3 Jun 2012 00:45:08 +0000]
afsd: include sys/resource.h in afsd_kernel.c

With a recent glibc update, sys/wait.h no longer includes
sys/resource.h unless __USE_SVID, __USE_XOPEN or __USE_XOPEN2K8
are set.

Don't rely on the indirect inclusion to get the bits we need;
include it directly in afsd_kernel.c.  This include used to be
there but was dropped when afsd_kernel.c was split off.

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

8 years agowindows: AFSQueryVolumeInfo exception info
Jeffrey Altman [Wed, 6 Jun 2012 03:25:08 +0000]
windows: AFSQueryVolumeInfo exception info

Protect against NULL FileObject or ObjectInformation.

Log additional information when an exception is caught in
AFSQueryVolumeInfo.

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

8 years agoWindows: SMB GetFileAttributes support
Jeffrey Altman [Wed, 6 Jun 2012 03:07:40 +0000]
Windows: SMB GetFileAttributes support

commit 56a2cbb5fbdcab51bd5f4720e610796abbce5c41 added a
GetFileAttributes query to the pioctl interface to protect
against printing pages on printers with a broken smb protocol
implementation.   This patchset adds support for GetFileAttribute
on _._AFS_IOCTL_._ files to the SMB implementation.

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

8 years agoWindows: Introduce AFSFreeExtent()
Jeffrey Altman [Sat, 26 May 2012 23:16:47 +0000]
Windows: Introduce AFSFreeExtent()

Consolidate all operations necessary to free an extent in
a single function, AFSFreeExtent().

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

8 years agoWindows: Adjust extent release strategy
Jeffrey Altman [Sat, 26 May 2012 22:11:06 +0000]
Windows: Adjust extent release strategy

All extents were flushed whenever AFSReleaseExtentsWithFlush was
executed.  This included a call at the completion of each
NonCached Read operation which could result in heavy thrashing
as the data would be released prior to it being needed by the
application.

This patchset makes the following adjustments.  First,
AFSReleaseExtentsWithFlush() has been modified to release all
but 1024 extents belonging to the file.  Second, NonCached Reads
only execute AFSReleaseExtentsWithFlush() when there are more
than 4096 extents associated with the file.  Third,
AFSReleaseExtentsWithFlush() now has a 'bReleaseAll' parameter
which is used for calls from AFSCleanup() and AFSFlushExtents()
which need to be able to flush all extents attached to a FCB.

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

8 years agoWindows: AFSRedir code cleanup
Jeffrey Altman [Sat, 26 May 2012 22:09:30 +0000]
Windows: AFSRedir code cleanup

Remove unnecessary intermediate variables.

Do not drop lock only to reacquire.

Formatting.

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

8 years agoWindows: Remove extent from all skip lists
Jeffrey Altman [Sat, 26 May 2012 22:06:07 +0000]
Windows: Remove extent from all skip lists

Before freeing the memory for an Extent object, the extent must
be removed from all of the extent skip lists.  Otherwise, the
lists will be corrupted.

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

8 years agoWindows: consoldiate NextExtent() implementations
Jeffrey Altman [Sat, 26 May 2012 22:04:25 +0000]
Windows: consoldiate NextExtent() implementations

Both AFSExtentsSupport.cpp and AFSIoSupport.cpp provided
NextExtent() implementations.  The AFSExtentsSupport version was
more general.  Use that one for both modules.

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

8 years agoWindows: Protect against null volp dereference
Jeffrey Altman [Sun, 27 May 2012 15:20:11 +0000]
Windows: Protect against null volp dereference

In cm_RecycleSCache cm_GetVolumeByFID can fail leaving 'volp'
a NULL pointer.  Do not call cm_PutVolume() if cm_GetVolumeByFID
fails.

Change-Id: I57eaf5d40130ecad75a312ef5487cdfa6e7367e3
Reviewed-on: http://gerrit.openafs.org/7506
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

8 years agoWindows: Avoid deadlock on ProcessTree Lock
Jeffrey Altman [Sat, 26 May 2012 01:47:23 +0000]
Windows: Avoid deadlock on ProcessTree Lock

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

8 years agoWindows: Add CCB NonPaged Resource for synchronization
Jeffrey Altman [Fri, 25 May 2012 00:46:27 +0000]
Windows: Add CCB NonPaged Resource for synchronization

Add a NonPaged ERESOURCE object to the AFS_CCB structure for
use in synchronizing access to the Ccb->Flags field and the
construction of Directory Snapshots.

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

8 years agoWindows: Make CCB_FLAGS_DIRECTORY_QUERY_MAPPED consistent
Jeffrey Altman [Fri, 25 May 2012 00:45:07 +0000]
Windows: Make CCB_FLAGS_DIRECTORY_QUERY_MAPPED consistent

Use CCB_FLAG_DIRECTORY_QUERY_MAPPED instead of
CCB_FLAGS_DIRECTORY_QUERY_MAPPED.

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

8 years agoWindows: Remove unused async read/write operations
Jeffrey Altman [Thu, 24 May 2012 21:47:25 +0000]
Windows: Remove unused async read/write operations

Removing dead code.

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

8 years agoWindows: Avoid deadlock on VolumeCB->VolumeLock
Jeffrey Altman [Thu, 24 May 2012 08:57:19 +0000]
Windows: Avoid deadlock on VolumeCB->VolumeLock

AFSPrimaryVolumeWorkerThread() holds VolumeCB->VolumeLock SHARED
across the call to AFSCleanupFcb() -> CcPurgeCacheSection().
If a filter driver such as Sophos (savonaccessfilter.sys ->
savonaccesscontrol.sys) triggers an AFSCreate() in response to
the cache section being purged that will force the evaluation of
the file path by AFSLocateNameEntry().  If the path contains a
mount point that requires validation, AFSBuildMountPointTarget()
is called which in turn required the VolumeCB->VolumeLock EXCL.

AFSBuildMountPointTarget() only requires the VolumeCB->VolumeLock
if the VolumeCB->RootFcb == NULL.  That should only be true if
the VolumeCB was allocated by AFSInitVolume() or under very rare
race conditions.

This patchset refactors AFSInitVolume() to ensure that it holds
an extra VolumeCB->VolumeReferenceCount reference.  This reference
is used to assist in the refactoring of AFSBuildRootVolume() and
AFSBuildMountPointTarget() to avoid races with volume root object
invalidation as well as permitting the VolumeCB->VolumeLock to
be ignored in the common case.

Avoiding the acquisition of VolumeCB->VolumeLock during mount
point target evaluation has the additional benefit of reducing
lock contention during path evaluation.

FIXES 130812

Change-Id: Id9b0dcc2bfd91277d522f3724893b60ce4d947f5
Reviewed-on: http://gerrit.openafs.org/7474
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

8 years agogtx: remove unused variable numBuffBytes
Marc Dionne [Tue, 29 May 2012 01:49:46 +0000]
gtx: remove unused variable numBuffBytes

Commit 9efc255a makes the numBuffBytes variable unnecessary.
Remove it to clear up an "unused but set" warning.

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

8 years agoLinux 3.4: replace end_writeback with clear_inode
Marc Dionne [Tue, 29 May 2012 01:43:12 +0000]
Linux 3.4: replace end_writeback with clear_inode

end_writeback() is renamed to clear_inode().  Add a configure test
and cope.

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

8 years agoafsd (FUSE): Avoid a compilation error and spell it "asprintf" not "asprint".
Garrett Wollman [Fri, 25 May 2012 02:33:04 +0000]
afsd (FUSE): Avoid a compilation error and spell it "asprintf" not "asprint".

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

8 years agoafs: Do not QueueVCB before osi_dnlc_purge*
Andrew Deason [Fri, 18 May 2012 21:40:38 +0000]
afs: Do not QueueVCB before osi_dnlc_purge*

In afs_FlushVCache, when we QueueVCB, we might drop the afs_xvcache
lock (as of 76158df491f47de56d1febe1d1d2d17d316c9a74). The vcache may
still be on the DNLC, so a lookup while xvcache is dropped can cause
someone else to grab a reference to the vcache while it is being
flushed. This can cause panics and failed assertions, since someone
will have a reference to the flushed vcache, which is effectively
freed and many of the structure fields are no longer valid.

So instead, do not call QueueVCB until we have purged the vcache from
the DNLC.

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

8 years agofix audit init in vl and pr servers
Michael Meffie [Tue, 22 May 2012 15:45:50 +0000]
fix audit init in vl and pr servers

Correct error introduced in commit
0dd7c980acda0756150f11992a0d2236f340e0c2

Change-Id: I929bb35a6a7070d637f1b332dae50cd182aaf9c5
Reviewed-on: http://gerrit.openafs.org/7447
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 agocomerr: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:28:51 +0000]
comerr: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

8 years agoDon't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:33:33 +0000]
Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

8 years agoutil: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:32:28 +0000]
util: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

8 years agoupdate: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:31:53 +0000]
update: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

8 years agosys: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:31:07 +0000]
sys: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

8 years agoxstat: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:29:42 +0000]
xstat: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

8 years agolwp: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:33:28 +0000]
lwp: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

8 years agorx: Don't cast returns from allocator
Simon Wilkinson [Thu, 17 May 2012 11:31:39 +0000]
rx: Don't cast returns from allocator

malloc() and osi_Alloc both return (void *). So, don't bother
casting the return value before assigning it - its unnecessary
noise.

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

8 years agoauth & [ak]log: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:29:51 +0000]
auth & [ak]log: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

8 years agoafsmonitor & gtx: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:28:41 +0000]
afsmonitor & gtx: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

8 years agodbservers: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:26:37 +0000]
dbservers: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

8 years agolibadmin & uss: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:21:57 +0000]
libadmin & uss: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

8 years agofileserver & friends: Don't cast from malloc()
Simon Wilkinson [Thu, 17 May 2012 09:52:46 +0000]
fileserver & friends: Don't cast from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

8 years agobackup: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 09:18:24 +0000]
backup: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

8 years agobos: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 09:03:16 +0000]
bos: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

8 years agoJAVA: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 08:37:50 +0000]
JAVA: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

8 years agoUnix CM: Don't cast allocator returns
Simon Wilkinson [Thu, 17 May 2012 08:19:03 +0000]
Unix CM: Don't cast allocator returns

All of our allocators return (void *) values, so there is no need
to cast the returns - doing so is just noise.

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

8 years agoDon't cast the return from calloc()
Simon Wilkinson [Thu, 17 May 2012 08:10:03 +0000]
Don't cast the return from calloc()

calloc returns a (void *) argument. So we don't need to cast its
output before storing it.

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

8 years agoDon't cast the return from realloc()
Simon Wilkinson [Thu, 17 May 2012 08:01:02 +0000]
Don't cast the return from realloc()

realloc takes, and returns a (void *) argument. So we don't need to
cast these parameters into, or out of, realloc. Doing so is just
noise, so don't bother.

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

8 years agoUse calloc, rather than malloc/memset
Simon Wilkinson [Thu, 17 May 2012 07:36:11 +0000]
Use calloc, rather than malloc/memset

Rather than doing
a = malloc(sizeof(me));
memset(a, 0, sizeof(me));

Just use
        a = calloc(1, sizeof(me));

This is simpler, shorter, and removes the potential for the size of
the memset not matching the size of the malloc (or the target of the
memset being wrong!)

Where the size is of the form (n * sizeof(me)), we also use
calloc(n, sizeof(me));

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

8 years agoDon't cast arguments to free()
Simon Wilkinson [Wed, 16 May 2012 19:38:02 +0000]
Don't cast arguments to free()

free(3) is defined as:

    void free(void *ptr);

so there is no need to cast the pointer argument being past to it to
(char *), (void *), or whatever other randomness happened to be floating
through the author's mind. Remove all such casts, as they are just
noise.

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

8 years agoauth: Simplify DNS lookups with asprintf
Simon Wilkinson [Wed, 16 May 2012 19:27:22 +0000]
auth: Simplify DNS lookups with asprintf

Instead of allocing a maximal string, and using snprintf to
construct each possible DNS search string, just use asprintf to
construct each string. This greatly simplifies the code, and makes
it much less likely that maths errors can creep in causing buffer
overflows in the future. The downside is that we have more round
trips to the allocator, but that shouldn't matter in this context.

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

8 years agoUse asprintf for string construction
Simon Wilkinson [Wed, 16 May 2012 19:23:41 +0000]
Use asprintf for string construction

Rather than using something along the lines of

    strOut = malloc(strlen(strA) + strlen(strB) + strlen(strC) + 1);
    strcpy(strOut, strA);
    strcat(strOut, strB);
    strcat(strOut, strC);

use asprintf for string construction, so we can just write

    asprintf(&strOut, "%s%s%s", strA, strB, strC);

roken provides an implementation of asprintf for platforms which are
missing one.

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

8 years agoUse strdup to copy strings
Simon Wilkinson [Wed, 16 May 2012 05:44:30 +0000]
Use strdup to copy strings

Where we have
    newStr = malloc(strlen(oldStr)+1);
    strcpy(newStr, oldStr);

replace these with
    newStr = strdup(oldStr);

It's shorter, clearer, and gets rid of a load of occurences of strcpy,
which some compilers are now warning is unsafe (although it isn't in
this context)

Get rid of a number of custom duplicate string functions and replace
them with strdup where the behaviour is identical

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

8 years agoafsd: Report fakestat correctly
Andrew Deason [Mon, 21 May 2012 23:15:58 +0000]
afsd: Report fakestat correctly

A fakestat value of 1 is for -fakestat-all, and 2 is for -fakestat,
not the other way around.

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

8 years agoafsd: Detect -dcache presence correctly
Andrew Deason [Mon, 21 May 2012 23:14:16 +0000]
afsd: Detect -dcache presence correctly

cmd_OptionAsInt will return 0 if the requested option is present and
valid.

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

8 years agoafsd: Avoid printing cacheBaseDir for memcache
Andrew Deason [Mon, 21 May 2012 23:01:49 +0000]
afsd: Avoid printing cacheBaseDir for memcache

cacheBaseDir is NULL when memcache is turned on; don't print it.

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

8 years agoafsd: Avoid dir interpolation for memcache
Andrew Deason [Mon, 21 May 2012 22:11:29 +0000]
afsd: Avoid dir interpolation for memcache

memcache doesn't make use of fullpn_DCacheFile, fullpn_VolInfoFile,
etc. Do not even try to generate these strings for memcache, since
cacheBaseDir will be NULL, and so this can cause a segfault on some
platforms including Solaris.

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

8 years agoafs: Add some comments explaining 'needvalid'
Andrew Deason [Mon, 21 May 2012 17:28:58 +0000]
afs: Add some comments explaining 'needvalid'

Add some comments to try and help explain the meaning of the
'needvalid' parameter to GetDSlot, added in
1a672914ab050811c99b6307c657630ab9b5c8ee.

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

8 years agoRevert "afs: the assert seems to be inverted when using memcache"
Andrew Deason [Mon, 21 May 2012 17:22:24 +0000]
Revert "afs: the assert seems to be inverted when using memcache"

This reverts commit bc7f10130f7b96923d1a1ad5c688ef0106a83178.

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

8 years agoafs: the assert seems to be inverted when using memcache
Chas Williams (CONTRACTOR) [Fri, 18 May 2012 00:57:38 +0000]
afs: the assert seems to be inverted when using memcache

needvalid will always be 1 for the memory cache -- i.e. the slots are
always valid.  see change id I53ea6e99649e4d6d5cbde58929dfcee1d45a3e7b.

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

8 years agovos: volume lock not released on convertROtoRW error
Mark Vitale [Tue, 8 May 2012 19:03:46 +0000]
vos: volume lock not released on convertROtoRW error

If an error occurs during convertROtoRW, the volume lock may
not be released.

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

8 years agovos: convertROtoRW does not respect volume lock
Mark Vitale [Tue, 8 May 2012 18:45:16 +0000]
vos: convertROtoRW does not respect volume lock

vos convertROtoRW was not checking the return code from
ubik_VL_SetLock().

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

8 years agoWindows: avoid deadlock TreeLock vs Fcb Resource
Jeffrey Altman [Fri, 18 May 2012 20:31:19 +0000]
Windows: avoid deadlock TreeLock vs Fcb Resource

Cannot call AFSPerformObjectInvalidate directly because
ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.TreeLock is
held during the sequence

  AFSVerifyEntry->AFSValidateDirectoryCache->AFSVerifyDirectoryContent

and AFSPerformObjectInvalidate requires the Fcb->NPFcb->Resource
which must be held prior to the TreeLock.

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

8 years agoWindows: buf redir queue mgmt scp can be null
Jeffrey Altman [Fri, 18 May 2012 14:19:13 +0000]
Windows: buf redir queue mgmt scp can be null

buf_InsertToRedirQueue, buf_RemoveFromRedirQueue, and
buf_MoveToHeadOfRedirQueue can be passed a NULL cm_scache_t pointer.
If the pointer is NULL (as is the case during buf_Init() processing)
the scp->redirMx must not be obtained or a crash will occur.

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

8 years agoWindows: Apply MAX_FID_COUNT to AFS Redirector
Jeffrey Altman [Wed, 16 May 2012 13:52:00 +0000]
Windows: Apply MAX_FID_COUNT to AFS Redirector

Provide consistency between the SMB path parser and the AFS
redirector path processing by using the same constant, MAX_FID_COUNT,
for both.  MAX_FID_COUNT is the maximum number of unique file ids
that can exist in a path after all mount points and symlinks have
been expanded.  The current value is 512.

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

8 years agoWindows: AFSTearDownExtents may experience active extents
Jeffrey Altman [Mon, 14 May 2012 15:11:57 +0000]
Windows: AFSTearDownExtents may experience active extents

If there are extents with a non-zero ActiveCount when AFSTearDownExtents()
is executed, it must leave them alone and attached to the File Control
Block.  This has implications for its callers, especially AFSCleanupFcb()
since it may be the case that a Cleanup cannot be completed.

The AFSPrimaryVolumeWorker thread must therefore check after calling
AFSCleanupFcb() whether or not the Fcb ExtentCount is zero before
calling AFSRemoveFcb().

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

8 years agoWindows: avoid duplicate work cm_Analyze
Jeffrey Altman [Wed, 16 May 2012 03:27:36 +0000]
Windows: avoid duplicate work cm_Analyze

During VNOVOL processing, if the volume is replicated and the
server reference status is "not busy", set the status to busy
and avoid calling cm_SetServerBusyStatus() because that function
mirrors the loop that is already being processed.

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

8 years agovos: convertROtoRW may create two RW volumes
Mark Vitale [Tue, 8 May 2012 14:01:12 +0000]
vos: convertROtoRW may create two RW volumes

If the RW volume is listed after the RO convert target in the VLDB,
the code failed to detect that an RW is already present and would
create a second RW volume.

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

8 years agoWindows: init section ptrs for pioctl files
Jeffrey Altman [Tue, 15 May 2012 04:23:17 +0000]
Windows: init section ptrs for pioctl files

FIXES 130783

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

8 years agoWindows: Redir Ioctl thread safety
Jeffrey Altman [Mon, 14 May 2012 04:12:17 +0000]
Windows: Redir Ioctl thread safety

A crash dump showed that it is possible for a Cleanup
to race with a Read from the ioctl file.  Add reference counting
to protect against crashing under such a circumstance.

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

8 years agoWindows: Permit Media Player to work with mapped drives
Jeffrey Altman [Fri, 11 May 2012 23:24:54 +0000]
Windows: Permit Media Player to work with mapped drives

Windows Media Player was failing to play media files from
mapped drives if the mapping was to a directory several
levels below \\afs\cellname\.  The code to permit SUBST drive
letters to work got in the way during NPGetConnection processing.
Try to get the connection info without the drive substitution
logic.  Try again with the drive substitution if the result
is no connection present.

FIXES 130757

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

8 years agovolser: preserve stats over reclones and restores
Michael Meffie [Thu, 23 Feb 2012 17:34:44 +0000]
volser: preserve stats over reclones and restores

Optionally, preserve the volume usage statistics instead of clearing
them during reclone and restore operations.

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

8 years agovos: convertROtoRW misc error reporting problems
Mark Vitale [Tue, 8 May 2012 16:38:38 +0000]
vos: convertROtoRW misc error reporting problems

Fixes a few inconsistencies and bugs in some error messages.

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

8 years agocmd: Add support for pulling options from files
Simon Wilkinson [Sun, 9 Oct 2011 00:20:57 +0000]
cmd: Add support for pulling options from files

With this change, we gain the ability to set our command line options
from krb5.conf configuration files. This is only available for tools
which are implemented using the new cmd_OptionAs accessor methods.

Callers should load their configuration file using
    cmd_OpenConfigFile("/path/to/config/file.conf");

(an addition to libauth to return a path to a system wide
 configuration file will be forthcoming)

and then set their command name (for example, "fileserver", "afsd",
"vos" and so on) using
    cmd_SetCommandName("mycommand");

The accessor functions will then populate their return values with
either:
  a) The command line options, if specified
  b) The contents of the tag matching the option name, in the
     [command_subcommand] section of the configuration file, if it
     exists
  c) The contents of the same tag, in the [command] section of the
     configuration file, if it that exists.
  d) The contents of the same tag in the [defaults] section of the
     configuration file.

Callers can also gain access to the entire configuration file by
calling cmd_RawFile, or to just the section corresponding to their
command line by calling cmd_RawSection. Note that when using the file
directly, it is up to callers to preserve consistency by implementing
similar inheritance rules as the above.

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

8 years agotests: Add additional cmd tests
Simon Wilkinson [Thu, 10 May 2012 15:51:01 +0000]
tests: Add additional cmd tests

Add additional tests to the libcmd test suite to verify the
behaviour of cmd_OptionPresent and cmd_OptionAsList

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

8 years agomacos: update AFS prefs pane
Derrick Brashear [Wed, 18 Apr 2012 15:57:10 +0000]
macos: update AFS prefs pane

modify afshelper to just run what it's told instead
of offering fixed operations. this avoids having a setuid
tool around. in spite of apple's suggestion this is correct,
it's actually more dangerous. instead, elevate privilege only
to run a small set of commands, then drop. allow
unlocking of the prefs pane, but make the menu extra prompt
for authentication when needed.
deactivate controls in the prefs pane when locked.

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

8 years agoCall rx_SetNoJumbo earlier
Andrew Deason [Fri, 4 May 2012 22:23:42 +0000]
Call rx_SetNoJumbo earlier

For ubik server processes, rx_SetNoJumbo needs to be called before
ubik initialization for it to effect the communication between
dbservers; otherwise, full database transfers may result in Rx
jumbograms on the wire regardless of the jumbo/nojumbo setting. Move
the call to rx_SetNoJumbo to before ubik initialization to avoid this.

Also move the call to rx_SetNoJumbo to immediately after rx_Init* for
all server processes, for consistency. Move similar calls to
rx_SetMaxMTU for the same reason.

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

8 years agoDOC: vos convertROtoRW security requirements
Mark Vitale [Wed, 2 May 2012 17:55:16 +0000]
DOC: vos convertROtoRW security requirements

They were copied from another command; corrected them.

Change-Id: Ic77f1a91520ec4147e42864438d98942f6a7effc
Reviewed-on: http://gerrit.openafs.org/7305
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agodoc: add Windows section to fs newcell
Ken Dreyer [Fri, 16 Mar 2012 19:37:20 +0000]
doc: add Windows section to fs newcell

fs newcell works slightly differently on Windows. Document the
differences in the man page.

FIXES 125094

Change-Id: I3fb71ebb28290222069d795762f50a82f3fb6495
Reviewed-on: http://gerrit.openafs.org/6919
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agovol: Free vol header on attach_volume_header error
Andrew Deason [Thu, 3 May 2012 21:36:03 +0000]
vol: Free vol header on attach_volume_header error

In attach_volume_header, make sure we free the volume's header if
we're returning an error. We take care of the locks and i/o handles in
the immediately preceding block, but for an actual error we don't get
rid of the header. Do so.

Noticed by Tom Keiser.

Change-Id: I97e61700f644066ac1a0e6b45a67dd62c5397034
Reviewed-on: http://gerrit.openafs.org/7325
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>