openafs.git
9 years agoAdjust roken.m4 to allow separate lib and include
Benjamin Kaduk [Mon, 22 Sep 2014 19:27:44 +0000]
Adjust roken.m4 to allow separate lib and include

In some installations (e.g., Debian), the roken libraries and headers
will not be installed in a common root directory to which /lib and
/include may be appended to find the appropriate library and header
directories, respectively.

Take inspiration from rra-c-util's GSSAPI macros and allow the
specification of separate include and lib directories.  Since there
are now three values to pass to the guts of the checking routine,
pass them in global variables instead of as parameters.

The expected usage would be to set either --with-roken, or both of
--with-roken-libdir and --with-roken-includedir, as in
configure --with-roken-include=/usr/include/heimdal
--with-roken-lib=/usr/lib/x86_64-linux-gnu/heimdal

This also fixes a typo that prevented --with-roken=internal from
functioning as intended.

Change-Id: I6f651ef3f3abf37c92ea81ea1801294ca3dc00b2
Reviewed-on: http://gerrit.openafs.org/11473
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoDeorbit separate JUAFS build
Benjamin Kaduk [Sat, 20 Sep 2014 01:18:38 +0000]
Deorbit separate JUAFS build

Since 80943970b8cfcdf3fc630b25804aebaea228bd73, when the web enhancements
were enabled universally, there has no longer been a functional difference
between the UAFS and JUAFS builds.  Their object files are compiled
using the same compilation rule, and the list of object files differed
only by rx_kmutex.o (which is devoid of content) and xdr_int32.o
(which is preumably an oversight).

Save the extra build time by just reinstalling libuafs.a as libjuafs.a
to preserve the existing interfaces.

Additionally, drop the LIBJUAFS make variable -- all definitions set
it to libjuafs.a.  Similarly, the LIBJUAFS_FLAGS variable was unused
and can be removed.

Change-Id: I2074d5bc26e326db36b16e055431818ef1c69210
Reviewed-on: http://gerrit.openafs.org/11471
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoDeorbit the netscape plugin
Benjamin Kaduk [Sat, 20 Sep 2014 01:45:31 +0000]
Deorbit the netscape plugin

Netscape hasn't been a thing since 2008.

We would only try to build it if someone manually ran 'webinstall'
in src/libuafs, and there is no documentation telling anyone to do so.

It's dead, Jim.

Change-Id: I7486ca33da7ff19f23f0d9f54f5fb4e7e3232540
Reviewed-on: http://gerrit.openafs.org/11470
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoMake pam conditional on INSTALL_KAUTH
Benjamin Kaduk [Mon, 15 Sep 2014 01:16:56 +0000]
Make pam conditional on INSTALL_KAUTH

The pam module we provide is only useful in kaserver-like environments,
and as such should not be installed when the user has requested to
not have kauth.

Change-Id: I9b336593e34cedfd6e8c2210f3798575d115d2d6
Reviewed-on: http://gerrit.openafs.org/11466
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoBuild a usable pam_afs.so
Benjamin Kaduk [Fri, 12 Sep 2014 22:07:51 +0000]
Build a usable pam_afs.so

Our use of libtool for building the pam modules resulted in shared
objects which had dependencies on liboafs_auth.so and liboafs_kauth.so,
neither of which are installed.

We still need some way to resolve those dependencies at link time, and
a dependency on libafsauthent.so seems ill-advised to insert into the
pam stack, so we are left with only the option of directly linking in
the requisite functionality.  Fortunately, almost all of the requisite
convenience libraries of PIC objects already exist to meet the
requirements of libafsrpc and libafsauthent; the only exception is
from the auth module.  Here, we require a new convenience library,
because the pam_afs.krb.so module includes its own version of ktc.o,
compiled with AFS_KERBEROS_ENV defined, yet the pam_afs.so module
requiers a ktc.o compiled without AFS_KERBEROS_ENV defined.  The
convenience library from the auth module can only include one version,
and would therefore be wrong for the other.  As such, create the new
libpam_auth.la archive from the BASE_objs in src/auth, and manually
compile ktc.lo and ktc_krb.lo as needed for the pam modules.

As for libafsrpc and libafsauthent, the convenience libraries included
from other parts of the tree belong in LT_objs, not LT_deps, because
they are contributing actual content to be included in the resulting
library; they are not library dependencies of the output of this module.

Change-Id: I5292718a5494710d166043fd08ad07269ff9fdf2
Reviewed-on: http://gerrit.openafs.org/11463
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoBuild and install libafsauthent.so.2
Benjamin Kaduk [Mon, 8 Sep 2014 22:06:25 +0000]
Build and install libafsauthent.so.2

During the libtool interim, we had been building a .0 but not
installing it.  Prior to the libtoolization of shlibafsauthent, we
had installed a libafsauthent.so.1.1, which is the same version currently
installed by the 1.6 branch.  Since there have been backwards-incompatible
ABI changes (e.g., afsconf_BuildServerSecurityObjects) since the .1.1
version, we must bump the SONAME to .2.0.

At time of this writing, the libtool rules for updating the
version information is found at:
http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
and
http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html

This lets us consolidate the building of the shared and static libafsrpc
and their installation), as libtool will happily do both for us
at once.

We explicitly do not install the .la files, as our libtool use is
to be kept entirely internal.

Change-Id: I283f9bb74eb9853c268e8642ac1f01741deeae2b
Reviewed-on: http://gerrit.openafs.org/11462
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoBuild and install libafsrpc.so.2
Benjamin Kaduk [Mon, 8 Sep 2014 22:06:25 +0000]
Build and install libafsrpc.so.2

During the libtool interim, we had been building a .0 but not
installing it.  Prior to the libtoolization of shlibafsrpc, we
had installed a libafsrpc.so.1.4 (though the 1.6 branch was
installing libafsrpc.so.1.5, "so we don't collide with the shlibafsrpc
versions on the master branch", which seems misguided).  Since there
have been backwards-incompatible ABI changes (e.g., rx_SetMaxMTU) since
the .1.4 version, we must bump the SONAME to .2.0.

At time of this writing, the libtool rules for updating the
version information is found at:
http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
and
http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html

This lets us consolidate the building of the shared and static libafsrpc
and their installation), as libtool will happily do both for us
at once.

We explicitly do not install the .la files, as our libtool use is
to be kept entirely internal.

Change-Id: I11bc3cbc80048d0192aadeb80b89d2772bcd01cd
Reviewed-on: http://gerrit.openafs.org/11461
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoNormalize LT_deps/LT_objs split
Benjamin Kaduk [Fri, 12 Sep 2014 21:21:42 +0000]
Normalize LT_deps/LT_objs split

As described in the commit message of
69f26ece3c4545ecc9099641f7a507796fe9dc77, LT_objs should contain
the .lo files for the given module, and LT_deps should contain the
libtool dependencies, i.e., the .la files from other parts of the
tree.  However, this simple split by file suffix is not correct
when we are using convenience libraries.  Really, LT_objs represents
the "new" objects being provided by the module, and LT_deps is
libraries from other modules that provide functionality on which
we depend.  Since convenience libraries are just thin aggregates
of object files, they behave more like object files than libraries
upon which we depend.  In particular, libafsrpc and libafsauthent
are wrapper libraries that gather together the functionality of
several modules and export them as a single library interface;
they do not have any objects of their own.

However, libafsauthent has a dependency on libafsrpc, which does
belong in LT_deps (or possibly in LT_libs).

Simon's description of LT_libs leaves a little ambiguity, as it
does not describe what should be done with non-libtool libraries
from within OpenAFS.  (At present, these include libafshcrypto
and librokenafs, both of which are regularly put in LT_libs.)
I prefer to recast LT_libs as containing externally visible libraries,
not just external libraries, which rationalizes the inclusion of
roken and hcrypto there, since we currently install those libraries,
and build libraries that have shared library dependencies on them.

In the future, as we begin committing to stable shared library
interfaces for libraries produced by libtool, I would like to
have those .la files be moved to LT_libs, since they would then
be external library dependencies of the given module.

Change-Id: Ie50010da84df99cec048c3e39ffeb9d5897fc08c
Reviewed-on: http://gerrit.openafs.org/11460
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoNormalize names of libtool convenience libraries
Benjamin Kaduk [Fri, 12 Sep 2014 19:41:23 +0000]
Normalize names of libtool convenience libraries

Part of why libtool was introduced into the tree was to reduce the
number of times each source file is compiled.  PIC code is needed
for shared objects, and non-PIC code for static libraries, so in most
cases a C file must be compiled twice, but not more than that.

Libtool automatically manages which version of an object is passed to
the linker when libtool is used to link .la files.  At several places
in the tree (libafsrpc, libafsauthent, libuafs_pic.so, and pam_afs.so)
we use libtool to link a .la library and pass other .la libraries in
as linker inputs.  In normal situations, libtool would produce an
output shared library that registered a shared library dependency on
the (shared version of the) input library.  However, in our usage,
these input .la libraries are used only for our convenience, and are
not intended to be installed, so libtool would produce an output
library that was not usable.

Libtool refers to our usage of libraries not intended to be installed
as "convenience libraries"; for us, they are essentially just
static archives that contain PIC objects (as opposed to normal
static archives which contain non-PIC objects).

Prior to this commit, we had named our convenience libraries things
like libafsauthent_auth.la or libafsrpc_comerr.la, since they were
mostly only used for either libafsrpc or libafsauthent.  However,
future commits will need to use some of these convenience libraries
in other shared objects (such as pam_afs.so), so we normalize the
library name to indicate merely that it is a PIC version of that
module.

There are three exceptions to this rule: libafsrpc_sys.la, which
contains only a single file and not the whole of the sys module,
libafsrpc_util.la, which contains a subset of the util objects,
and libauthent_ubik.la, which contains a subset of the ubik
objects.  Since these convenience libraries are in fact tailored to
the particular application, a target-specific name is appropriate.

The convenience library provided by the ptserver module is named
libprot_pic to match the existing public interface libprot.a.

We cannot link the dependencies of the convenience libraries
directly into them, because any given object may only be linked
once into a given library, and our dependency graph between
modules is decidedly not a tree, so attempting to link in the
dependencies would result in duplicate symbol errors.

Change-Id: I5f10af74b8582edd51e5f1b3f0026dbc7ef9f7ad
Reviewed-on: http://gerrit.openafs.org/11459
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoUse correct syntax for libtool version info
Benjamin Kaduk [Mon, 8 Sep 2014 22:28:11 +0000]
Use correct syntax for libtool version info

It does not take an '='.

Whomever thought that making libtool silently accept all (i.e.,
malformed) command-line arguments was a good idea ... seems to
have been mistaken.

Change-Id: I357cd44ac6f495474f9763a2f768ac9c8d1e4cb4
Reviewed-on: http://gerrit.openafs.org/11458
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agobuild: remove trailing whitespace from makefiles
Michael Meffie [Wed, 10 Sep 2014 13:00:11 +0000]
build: remove trailing whitespace from makefiles

Remove trailing whitespace from the makefiles, except for
trailing whitespace in the boilerplate comment headers.

Change-Id: Ib8ee87a51f00633ba15e1974ac0b311969bef1bf
Reviewed-on: http://gerrit.openafs.org/11456
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoaklog: Fix segfault on aklog -path
Anders Kaseorg [Tue, 30 Sep 2014 17:52:31 +0000]
aklog: Fix segfault on aklog -path

Commit 2fac53522e7ef5b3a376e191bffdc1f6784e6995 “aklog: Fix improper
use of readlink” inadvertently changed the meaning of int link from a
boolean flag (length > 0) to just a length.  This caused ‘aklog -path
(anything)’ to segfault.

Update the type of link and the condition of the while loop to account
for this change.

FIXES 131930

Change-Id: Ia05836795425a53e858ab29866900f6d45970644
Reviewed-on: http://gerrit.openafs.org/11517
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoafs: Verify osi_UFSOpen worked
Perry Ruiter [Thu, 29 May 2014 22:51:57 +0000]
afs: Verify osi_UFSOpen worked

  In some builds (UKERNEL) osi_UFSOpen returns a NULL if it runs
into a problem.  On the other builds osi_UFSOpen simply panics.
afs/afs_cell.c was checking for a NULL return but other callers
were not.  Add checking logic to all callers.
  This is a prepartory patch.  A subsequent patch will have
osi_UFSOpen return NULL rather than panic for other builds too.

Change-Id: I3610a57dff59b84fe5ea8b1c862f3192157f255f
Reviewed-on: http://gerrit.openafs.org/11243
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoWindows: SetDispositionInfo vs Link Count
Jeffrey Altman [Thu, 25 Sep 2014 17:23:16 +0000]
Windows: SetDispositionInfo vs Link Count

When SetDispositionInfo is called to mark a file for pending
delete the link count should not be decrememented.  The count is
decremented only when the file is actually deleted.

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

9 years agoWindows: FileStandardInfo Link count
Jeffrey Altman [Thu, 25 Sep 2014 17:21:48 +0000]
Windows: FileStandardInfo Link count

Instead of returning 1 in all cases the ObjectInformation.Links
value should be returned to the caller.

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

9 years agoWindows: Check for RO and Open Target in rename
pete scott [Thu, 25 Sep 2014 15:01:27 +0000]
Windows: Check for RO and Open Target in rename

During a file rename operation, check to see if the target file
has the DOS readonly attribute set or has a non-zero reference
count.  If yes, the request must be failed.  The error status
depends upon the state of the pending delete flag.  Either
STATUS_PENDING_DELETE or STATUS_ACCESS_DENIED.

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

9 years agoafs: Move init_hckernel_init to osi_Init
Andrew Deason [Thu, 25 Sep 2014 17:34:18 +0000]
afs: Move init_hckernel_init to osi_Init

Currently we call init_hckernel_init inside afs_InitSetup, to
initialize the hcrypto mutex. However, we use the hcrypto mutex in the
AFSOP_SEED_ENTROPY syscall, which afsd calls before any syscall that
cals afs_InitSetup. This means we crash on trying to
AFSOP_SEED_ENTROPY.

To avoid this, just call init_hckernel_init inside osi_Init instead,
which is called when our kernel module itself is initialized. This
ensures that the mutex is initialized early on, regardless of what
happens with afsd and the startup syscalls.

Change-Id: Ib6cbed7abcfd8f9a61685f613a848e9f36d6050d
Reviewed-on: http://gerrit.openafs.org/11509
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: Use the allocation size from the service
pete scott [Wed, 24 Sep 2014 17:49:38 +0000]
Windows: Use the allocation size from the service

The prior patchset modified the service AllocationSize return value
to count the number of 1KB units.  Use the value from the service
without modification.  This corrects an inconsistency in the
FileStandardInformation response.

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

9 years agoWindows: report AllocationSize in 1KB increments
Jeffrey Altman [Wed, 24 Sep 2014 22:12:31 +0000]
Windows: report AllocationSize in 1KB increments

Windows expects storage to be allocated in increments of some
block size.  The AFS servers allocate in 1K units so lets report
that to Windows.

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

9 years agoWindows: Remove trailing slash on non-root directories
pete scott [Wed, 24 Sep 2014 17:00:36 +0000]
Windows: Remove trailing slash on non-root directories

For the FileNameInformation and FilePhysicalNameInformation queries
a trailing slash is required for the \\server\share\ path but is
not required for directories below the root.

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

9 years agoWindows: FilePhysicalNameInfo query AFS prefix
pete scott [Wed, 24 Sep 2014 16:49:06 +0000]
Windows: FilePhysicalNameInfo query AFS prefix

In response to the FilePhysicalNameInformation query the AFS redirector
failed to include the server name in the response.  Since the constructed
name is the same as the FileNameInformation query create a helper function
AFSGetFullFileName() to populate the file name into the provided buffer
and use it to satisfy both queries.

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

9 years agoWindows: FileInfo too small INFO_LENGTH_MISMATCH
pete scott [Wed, 24 Sep 2014 16:06:38 +0000]
Windows: FileInfo too small INFO_LENGTH_MISMATCH

The FileAllInformation query is initially processed by the IO Manager
and when the IO Manager is passed a buffer that is too small to hold
the File Information structure it returns STATUS_INFO_LENGTH_MISMATCH.
Previously the afs redirector returned STATUS_BUFFER_TOO_SMALL in this
case.  Instead follow IO Manager's lead.

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

9 years agoWindows: !overwrite IOMgr populated FileInfo data
pete scott [Tue, 23 Sep 2014 19:20:45 +0000]
Windows: !overwrite IOMgr populated FileInfo data

I/O Manager will populate the FILE_ACCESS_INFORMATION,
FILE_MODE_INFORMATION, and FILE_ALIGNMENT_INFORMATION portions of
a FILE_ALL_INFORMATION structure prior to forwarding a FileAllInformation
FileInfo query to the file system.  There is no need for the file system
to duplicate the effort.

Change-Id: Iaa7f1de95c6b7e42bdc326cc3f4bfe8596add949
Reviewed-on: http://gerrit.openafs.org/11478
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: preserve prior vlserver list on dns failure
Jeffrey Altman [Wed, 10 Sep 2014 14:23:17 +0000]
Windows: preserve prior vlserver list on dns failure

Do not destroy the existing vlserver list if the DNS resolver query
fails.  Continue using the prior vlserver values until a DNS response
is obtained.  This will result in repeated DNS queries and a delay
if there is continued failure, but it will permit VL RPCs to continue
to be issued in the face of a DNS failure or misconfiguration.

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

9 years agoWindows: power management suspend/resume changes
Jeffrey Altman [Thu, 4 Sep 2014 13:16:47 +0000]
Windows: power management suspend/resume changes

1. Call cm_UpdateIFInfo() for all power management events to force
   an update of the valid network interface count.

2. Ensure that regardless of which Suspend and Resume events are
   generated that the service only suspends once and resumes once.

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

9 years agoWindows: No network, no probe
Jeffrey Altman [Thu, 4 Sep 2014 13:14:07 +0000]
Windows: No network, no probe

Modify cm_PingServer and cm_CheckServersMulti to avoid probing servers
when there are no network interfaces with which to do so.  Just mark
the servers down.

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

9 years agoWindows: introduce cm_MarkServerDown
Jeffrey Altman [Thu, 4 Sep 2014 13:11:25 +0000]
Windows: introduce cm_MarkServerDown

Consolidate the operations necessary to mark a server down into a
new routine cm_MarkServerDown()

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

9 years agoWindows: replace lana_OnlyLoopback() calls
Jeffrey Altman [Thu, 4 Sep 2014 13:08:32 +0000]
Windows: replace lana_OnlyLoopback() calls

lana_OnlyLoopback() relies upon Netbios over TCP being enabled but
Netbios over TCP is not officially supported on Vista and above.
Replace all lana_OnlyLoopback() calls with a test on the number of
network interfaces as computed by syscfg_GetIFInfo().   That list
excludes loopback interfaces.

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

9 years agoWindows: cm_UpdateIFInfo consolidate syscfg_GetIFInfo calls
Jeffrey Altman [Thu, 4 Sep 2014 13:04:42 +0000]
Windows: cm_UpdateIFInfo consolidate syscfg_GetIFInfo calls

Add a new function cm_UpdateIFInfo() that consolidates all of the
syscfg_GetIFInfo() call functionality into a single rountine.  Replace
all of the existing call sites.

It is safe to call cm_UpdateIFInfo() without holding cm_syscfgLock
during afsd initialization because no other threads have been created.

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

9 years agoWindows: Prevent MDL leak on Cc*Mdl* failure
Jeffrey Altman [Thu, 4 Sep 2014 05:11:01 +0000]
Windows: Prevent MDL leak on Cc*Mdl* failure

If CcMdlRead or CcPrepareMdlWrite fail, check the IoStatus.Information
field to see if any MDL pages have been locked.  If the Information
value is greater than zero, complete the Mdl operation to unlock the
pages.

Change-Id: Icb44e74e25b46c7976f3f418410364a90a723d91
Reviewed-on: http://gerrit.openafs.org/11442
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoSort libtool symbol files
Benjamin Kaduk [Fri, 25 Jul 2014 00:56:41 +0000]
Sort libtool symbol files

Some entropy had crept in.

Change-Id: I72ae9d16a3aa4b9b66bc8efcda46bdc35edf95c9
Reviewed-on: http://gerrit.openafs.org/11323
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoRemove rx_SetEpoch, rx_SetConnectionEpoch, rx_SetConnectionId
Ben Kaduk [Wed, 27 Mar 2013 17:37:42 +0000]
Remove rx_SetEpoch, rx_SetConnectionEpoch, rx_SetConnectionId

The core RX code now manages the Epoch and CID; external callers
should not be modifying them.

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

9 years agoGarbage-collect afs_GCUserData's argument
Ben Kaduk [Tue, 26 Mar 2013 23:43:07 +0000]
Garbage-collect afs_GCUserData's argument

We no longer need the ability to force all rxnull connections to be
reaped, as the epoch is set globally.  Change the prototype and
callers accordingly.

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

9 years agoMove epoch and cid generation into the rx core
Ben Kaduk [Tue, 26 Mar 2013 17:41:40 +0000]
Move epoch and cid generation into the rx core

Now that we have hcrypto available everywhere, we can get real randomness
in the rx core (both uerspace and kernel), and thus can initialize the
RX epoch to a real random value when first initializing a host; there is
no need to rely on rxkad to produce randomness for this purpose.
Initialize a connection ID counter at the same time, and use that in
rx_NewConnection, also supplanting rxkad-specific logic.

The rxkad-specific logic is removed, and in particular there is no longer
a need to export rxkad_EpochWasSet to the rest of the world.
The code in afs_Daemon() to check whether the rxepoch was set can be
removed, as if the epoch is not set, rx initialization fails.

Add libafshcrypto to LIBS in the handful of places it hadn't crept already,
and likewise afshcrypto.lib in the NTMakefiles.

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

9 years agoExport heimdal's rand-fortuna PRNG to the kernel
Ben Kaduk [Wed, 27 Mar 2013 21:02:55 +0000]
Export heimdal's rand-fortuna PRNG to the kernel

Some systems (e.g., AIX, SGI, DFBSD, HPUX) do not supply a useful
implementation of osi_readRandom(), in some cases because the kernel
does not expose a random-number interface to kernel modules.  We want
real random numbers on all systems, because we want to use the for
setting the RX epoch and connection ID in the kernel.

Build hcrypto's rand-fortuna PRNG into the rand-kernel interface we expose,
and implement RAND_bytes using rand-fortuna when osi_ReadRandom()
is not useful.

Add stub routines to config.h as needed, and add a heim_threads.h
with the necessary locking for rand-fortuna.  The rand-fortuna algorithm
requires some measure of time's passage, so provide a stub gettimeofday()
with single-second resolution.  We use a single (global) mutex for the
hcrypto kernel code, so that we can statically declare an initializer to
be the address of that mutex.  Otherwise the locking is taken essentially
wholesale from rx_kmutex.

rand-fortuna requires the sha256 code for its hashing, and also
requires a stub rand-fortuna to satisfy linker symbol visibility.

Since the rand-fortuna code does not have any actual sources of entropy
available to it during its initialization routines, we must explicitly
seed the in-kernel rand-fortuna using entropy passed in from userland.
(Userland will always have at least /dev/random available, so the
userland hcrypto should always have usable entropy.)  Be sure to do so
early in the afsd startup sequence, before any daemons are started, so
that entropy is available to the core rx code for generating the epoch
and cid -- the rand-fortuna code will (erroneously) always claim that
it has startup entropy even though in this case it may not actually
have any entropy.  The rand-fortuna code does not consider itself
fully seeded until it has 128 bytes of entropy, so be sure to pass
more than that in from userspace.

It is preferrable to always build this code into the kernel, even on
systems when it is not going to be used, to help prevent bitrot.  This
also avoids the possibility of a new system being supported that would
attempt to use the rand-fortuna code but fail to supply any seed entropy,
which would not necessarily be readily apparent.

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

9 years agoAdd missing tests to tests/opr/.gitignore
Benjamin Kaduk [Mon, 8 Sep 2014 18:46:34 +0000]
Add missing tests to tests/opr/.gitignore

dict-t and fmt-t were missing.

While here, sort the existing entries.

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

9 years agoFix memset invocation in rx/event-t.c
Benjamin Kaduk [Mon, 8 Sep 2014 17:40:48 +0000]
Fix memset invocation in rx/event-t.c

The order of the parameters was swapped, which recent gcc complains
loudly about.

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

9 years agoubik: Don't leak UBIK_VERSION_LOCK if udisk_LogEnd fails
Simon Wilkinson [Mon, 25 Aug 2014 15:25:43 +0000]
ubik: Don't leak UBIK_VERSION_LOCK if udisk_LogEnd fails

If the call to udisk_LogEnd() fails (probably due to an I/O error)
don't leak the UBIK_VERSION_LOCK.

This is the possible cause of a vlserver deadlock, which had
approximately 4800 threads blocked. Analysis of backtrace of all
of these threads showed that all blocked threads were waiting in
ubik.c:555 (blocked on DBHOLD) with the exception of:

One in beacon.c:388 (blocked on UBIK_VERSION_LOCK)
One in recovery.c:503 (blocked on DBHOLD)
One in ubik.c:125 (blocked on DBHOLD)
One in ubik.c:585 (blocked on UBIK_VERSION_LOCK)

The last of these is the critical one, because it already holds
the lock that DBHOLD waits on - so despite the vast majority of
threads being blocked in DBHOLD, it's actually UBIK_VERSION_LOCK
that we're waiting on.

There is no sign of a thread which is still active which currently
holds UBIK_VERSION_LOCK.

Change-Id: I1627b448d359152237912d4d78c9fa52c7149aa0
Reviewed-on: http://gerrit.openafs.org/11427
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoubik: Don't leak UBIK_VERSION_LOCK if setlabel fails
Simon Wilkinson [Mon, 25 Aug 2014 15:15:26 +0000]
ubik: Don't leak UBIK_VERSION_LOCK if setlabel fails

If a call to the setlabel() physical IO function fails, don't
leak the UBIK_VERSION_LOCK.

This is the possible cause of a vlserver deadlock, which had
approximately 4800 threads blocked. Analysis of backtrace of all
of these threads showed that all blocked threads were waiting in
ubik.c:555 (blocked on DBHOLD) with the exception of:

One in beacon.c:388 (blocked on UBIK_VERSION_LOCK)
One in recovery.c:503 (blocked on DBHOLD)
One in ubik.c:125 (blocked on DBHOLD)
One in ubik.c:585 (blocked on UBIK_VERSION_LOCK)

The last of these is the critical one, because it already holds
the lock that DBHOLD waits on - so despite the vast majority of
threads being blocked in DBHOLD, it's actually UBIK_VERSION_LOCK
that we're waiting on.

There is no sign of a thread which is still active which currently
holds UBIK_VERSION_LOCK.

Change-Id: Ie6093409e9375d50fa69733908b5ce99586e1b1d
Reviewed-on: http://gerrit.openafs.org/11426
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoconfig: remove support for old FreeBSD releases
Garrett Wollman [Thu, 28 Aug 2014 07:09:49 +0000]
config: remove support for old FreeBSD releases

The FreeBSD project no longer supports 5.x, 6.x, or 7.x releases, and
has not done so for a long time.  It's unlikely the OpenAFS works
properly on any of them, if it even still builds, since it is not
regularly build-tested on anything older than 8.3.  Unclutter
src/config by removing the param.*.h files for these obsolete
releases.

Change-Id: Iedd11e9a9045b39d2193c61b9833abd592d1bfa2
Reviewed-on: http://gerrit.openafs.org/11438
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoREADME: update for current state of FreeBSD support
Garrett Wollman [Thu, 28 Aug 2014 07:04:19 +0000]
README: update for current state of FreeBSD support

The FreeBSD project hasn't supported releases prior to 8.x for a long
time now, and OpenAFS is neither built nor tested regularly on
anything that old.  Dedocument support for these releases in
preparation for later removing configuration support.

Change-Id: I42e78291cfed91e20b3414576cf885a11b7f341b
Reviewed-on: http://gerrit.openafs.org/11437
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agovos clone use the value of the -toname argument
Hans-Werner Paulsen [Tue, 26 Aug 2014 09:55:06 +0000]
vos clone  use the value of the -toname argument

The -toname argument was not followed with the vos clone command. The name
of the clone volume was always ".clone".

Change-Id: I76b78d239ecb38e793098078ac34a703f2ffeeeb
Reviewed-on: http://gerrit.openafs.org/11431
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoWindows: Avoid deadlock during pending delete cleanup
Jeffrey Altman [Tue, 8 Apr 2014 07:27:26 +0000]
Windows: Avoid deadlock during pending delete cleanup

Release the Fcb resource and clear the AFS_DIR_ENTRY_PENDING_DELETE
flag prior to the AFSProcessRequest(AFS_REQUEST_TYPE_CLEANUP_PROCESSING)
if a delete is pending during cleanup of the last FCB open handle.

Failure to do so results in an out of order lock acquisition when
the parent object info tree lock is acquired after the AFSProcessRequest()
call to the service completes.

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

9 years agouse V_copyDate in DumpHeader for cloned volumes
Hans-Werner Paulsen [Thu, 14 Aug 2014 09:56:22 +0000]
use V_copyDate in DumpHeader for cloned volumes

Volume dumps can be created from backup volumes, cloned volumes, or
directly from RW volumes. The beginning and end of the time range
covered by the dump is recorded in the DumpHeader. The end time is
based on the type of the volume. Use backupDate for backup volumes,
use copyDate for cloned volumes, and updateDate for RW volumes.

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

9 years agoWindows: AFSEvaluateTargetByName NULL ptr assignment
Jeffrey Altman [Tue, 21 Jan 2014 09:19:28 +0000]
Windows: AFSEvaluateTargetByName NULL ptr assignment

If DirEnumEntry is NULL, then on failure of AFSEvaluateTargetByName()
a NULL pointer will be dereferenced prior to function return.

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

9 years agosys: pioctl_nt translate WinErr to Unix
Jeffrey Altman [Thu, 8 May 2014 20:34:25 +0000]
sys: pioctl_nt translate WinErr to Unix

When reading the result of a pioctl fails with ERROR_NOT_SUPPORTED
this must be translated to an EINVAL errno.

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

9 years agoWindows: registry enum do not request write perm
Jeffrey Altman [Sun, 15 Jun 2014 02:58:52 +0000]
Windows: registry enum do not request write perm

Only Read and Query privileges are required to enumerate the registry
keys, do not request write privileges for an enumeration.

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

9 years agoWindows: Do not sync callbacks when only need locks
Jeffrey Altman [Sun, 29 Jun 2014 03:03:45 +0000]
Windows: Do not sync callbacks when only need locks

Syncing lock operations with callback fetching is unnecessary because
local lock state is not tracked via callbacks.  More importantly it
risks blocking the cm_LockDaemon thread which needs to be able to
renew locks without obstruction.

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

9 years agoWindows: do not forget cm_SyncOpDone
Jeffrey Altman [Tue, 5 Aug 2014 05:40:22 +0000]
Windows: do not forget cm_SyncOpDone

If cm_SyncOp was called, then cm_SyncOpDone must be called.
By goto out of the loop, the cm_SyncOpDone call was skipped.

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

9 years agoWindows: set hard dead timeout not conn timeout for probes
Jeffrey Altman [Mon, 18 Aug 2014 19:28:14 +0000]
Windows: set hard dead timeout not conn timeout for probes

For the Rx connections used for probing VL and FILE servers set a
hard dead timeout and not a connection timeout.   A connection timeout
will not terminate the call as long as the lastReceiveTime continues
to be updated by ping packets.  The hard dead timeout will cause the
connection to fail when the 10 second limit expires.

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

9 years agoWindows: Freelance whole volume rdr invalidate
Jeffrey Altman [Mon, 18 Aug 2014 19:25:50 +0000]
Windows: Freelance whole volume rdr invalidate

When updating the Freelance directory do not notify the redirector
of individual objects to invalidate since that can leaad to race
conditions.  Send whole volume invalidations since that is what is
required in any case.

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

9 years agoWindows: Obtain File Attribs for DFS Link target
pete scott [Wed, 13 Aug 2014 19:28:49 +0000]
Windows: Obtain File Attribs for DFS Link target

The AFSRetrieveFileAttributes() function is used to acquire the
attributes for an AFS symlink.  The result is either returned directly
to the application or used internally to determine the attributes
to be exposed by reparse points.

If the evaluated symlink crosses a DFS Link the redirector cannot
return the request to IO Manager to evaluate the target.  Instead
the redirector must handle the request internally and attempt to
read the attributes of the target object.

Change-Id: If14df8dc41e13fd59b524fdb575c46abab1dfc2f
Reviewed-on: http://gerrit.openafs.org/11399
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: LocateName skip DFS Link only last component
pete scott [Mon, 11 Aug 2014 17:18:16 +0000]
Windows: LocateName skip DFS Link only last component

As with Mount Points and Symlinks, when AFSLocateName() is called to
process a CreateFile with Open_Reparse_Point enabled, DFS Link processing
must be disabled only for the last component in the path.  Failure to
do so results in the AFS Redirector succeeding IRP_MJ_CREATE calls that
should be given back to the IO Manager so the path can be evaluated by
another file system.

Change-Id: I1627e7c6582d3a80d99dd2acc5171135a6a7bc4b
Reviewed-on: http://gerrit.openafs.org/11398
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: Reparse Policy vs DFSLinks
Jeffrey Altman [Mon, 11 Aug 2014 05:07:27 +0000]
Windows: Reparse Policy vs DFSLinks

When a reparse policy is specified and AFSLocateNameEntry() returns
with STATUS_REPARSE, do not re-evaluate the path with the reparse
policy disabled.  STATUS_REPARSE was returned because the FileObject's
FileName was modified and the IO Manager needs to reparse the request.

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

9 years agoWindows: AFSParseRelatedName always use related name
Jeffrey Altman [Mon, 11 Aug 2014 05:41:52 +0000]
Windows: AFSParseRelatedName always use related name

When parsing a RelatedFileObject always refer to the RelatedFileObject
FileName and not the IrpSp->FileObject.

Set the output FileName to pRelatedCcb->FullFileName

Test pRelatedCcb->FullFileName for wild cards

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

9 years agoWindows: AFSParseName always set FileName output
Jeffrey Altman [Mon, 11 Aug 2014 05:38:54 +0000]
Windows: AFSParseName always set FileName output

The FileName output parameter is used by the caller even when an
error occurs.  In case of error it indicates that path that failed
to parse. Not all of the error paths set FileName.

Start AFSParseName() with FileName referring to
IrpSp->FileObject->FileName.  It can be updated as required later.

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

9 years agoWindows: Refactor AFSParseName related name parsing
Jeffrey Altman [Mon, 11 Aug 2014 05:28:12 +0000]
Windows: Refactor AFSParseName related name parsing

AFSParseName() is a very long complex function.  Extract the parsing
of RelatedFileObject name parsing to a new function AFSParseRelatedName().
This removed ~160 lines of source code out of AFSParseName().

This changeset is not intended to introduce any functional changes.

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

9 years agovos: cross-device link error message
Michael Meffie [Tue, 18 Feb 2014 20:23:54 +0000]
vos: cross-device link error message

Print a better diagnostic message for cross-device link errors, which
happens when a clone volume is not in the same partition as the
parent read-write volume.

Change-Id: If58284a1dc53f8264fb17757f37c627fc2a378db
Reviewed-on: http://gerrit.openafs.org/10850
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoredhat: Fix minor whitespace errors in openafs-kmodtool
Perry Ruiter [Wed, 4 Jun 2014 22:27:32 +0000]
redhat: Fix minor whitespace errors in openafs-kmodtool

During review of commit c20c01185ed748b2bc823369a8f28cf004b7d1c9
gerrit flagged one of the changed lines as having a trailing whitespace
error.  This patch corrects that error and several others that were
in the file.

Change-Id: I3668e67e456322cccdfa76df935951053f9b6a48
Reviewed-on: http://gerrit.openafs.org/11200
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoCorrect comment typos in a couple files
Perry Ruiter [Tue, 27 May 2014 07:07:52 +0000]
Correct comment typos in a couple files

Correct typos in a couple files.  These were noticed while
researching code paths.  Comment changes only.  No code change.
afs/afs_stats.h has source file names updated on several lines.
Many source file name comments are wrong in this file.
I didn't attempt to correct them all, just the ones I bumped
into.  If I bump into others in the future I'll fix them then.
rx/rx_call.h has source of enumerated types corrected.

Change-Id: Ie78b7f20b5c9c2261ec8a73701e77bdfbabd8465
Reviewed-on: http://gerrit.openafs.org/11172
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agovolscan: fix copyright and licence notice
Michael Meffie [Wed, 6 Aug 2014 19:08:33 +0000]
volscan: fix copyright and licence notice

These are new files and new content; fix the copyright notice and
license to reflect.

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

9 years agoRemove some incomplete struct initializers
Ben Kaduk [Mon, 21 Jul 2014 21:30:36 +0000]
Remove some incomplete struct initializers

C99 requires that objects with static linkage, which includes
global variables, be initialized to zero/NULL.

It is possible that old compilers required a hack of using one
explicit initializer and relying on the requirement from C99 that
the elements of the structure not listed in the initializer be
initialized as if it had static linkage.  These incomplete initializers
seem to have been introduced to support old OS X compilers which
are not believed to still be in use.

Using a complete explicit initializer is undesired here, as the
rxkad statistics structures have a great number of elements and
the uuid structure is somewhat complicated.

Change-Id: Iefe7842cbf874252267cb3a8aee5d90ec2cab169
Reviewed-on: http://gerrit.openafs.org/11374
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoFBSD: avoid unused-variable warning
Ben Kaduk [Mon, 21 Jul 2014 21:50:50 +0000]
FBSD: avoid unused-variable warning

This variable is passed as an argument to the ma_vn_lock() compat
macro, which ignores the thread argument on some versions of FreeBSD.
Make the variable only be declared in those cases when it will be used.

Change-Id: I1ed10654fb402f4feec55d6d7c7ece6f0c78bc8e
Reviewed-on: http://gerrit.openafs.org/11373
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoFBSD: initialize 'retval' for afs3_syscall
Ben Kaduk [Mon, 21 Jul 2014 18:13:39 +0000]
FBSD: initialize 'retval' for afs3_syscall

In the same way as linux_ret.

An ugly hack, but retval is not really used for anything relevant at
the moment, and the compiler will warn about it being used uninitialized
otherwise.

Change-Id: Ia31ea6668ac3bc2edbec143d0b839f3e797ff424
Reviewed-on: http://gerrit.openafs.org/11372
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoAvoid a name conflict in a local variable
Ben Kaduk [Mon, 21 Jul 2014 15:01:04 +0000]
Avoid a name conflict in a local variable

Modern compilers will warn when a variable in a nested scope hiding
a variable of the same name in an outer scope.  One of the arguments
to afs_lhash_remove() is already named 'data'; don't reuse that name
for a local variable.

Change-Id: Icbb5010d298110cd4dab395fc5eec45e01ec9ba3
Reviewed-on: http://gerrit.openafs.org/11371
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoMake kernel hcrypto calloc return zeroed memory
Benjamin Kaduk [Thu, 24 Jul 2014 13:40:21 +0000]
Make kernel hcrypto calloc return zeroed memory

As far as I can tell, the afs_osi_Alloc contract does not
guarantee zeroed memory.  On FreeBSD, with a debug kernel, it
definitely does not currently provide zeroed memory, returning
instead memory initialized with 0xdeadc0de.

Properly speaking, the role of calloc() is to both check for overflow
from the multiplication and to produce zeroed memory.  However, since
we do not have a reasonable way to report failure, do not bother
checking for overflow at this time.

Change-Id: I187c2057d473fba869692c1dfa11735502b260c1
Reviewed-on: http://gerrit.openafs.org/11322
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoviced: time_t might not be long
Garrett Wollman [Wed, 13 Aug 2014 06:32:06 +0000]
viced: time_t might not be long

Fix a couple of printf format errors that bite on FreeBSD 10 for i386.
Since time_t might be an int, it can't be printed with a long format.
Since time_t might be a long in general, cast to it to long when
printing.

Change-Id: Iecc4487adee7a64542dd2dc17f94485a6198e707
Reviewed-on: http://gerrit.openafs.org/11385
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoafsd: correct printf format mismatch in debugging printf
Garrett Wollman [Wed, 13 Aug 2014 06:20:02 +0000]
afsd: correct printf format mismatch in debugging printf

On platforms where size_t is unsigned int, the type of
cacheFiles * sizeof(AFSD_INO_T) is not an unsigned long as the format
string requires.  Casting cacheFiles to unsigned long ensures that the
result is at least unsigned long, although it will still be wrong if
any architecture makes size_t be long long.  Fixes build for FreeBSD
10 on i386.

Change-Id: Ifd124d81b16f53133293dd591f7f8cf2f7d3175a
Reviewed-on: http://gerrit.openafs.org/11384
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoredhat: package volscan
Stephan Wiesand [Fri, 8 Aug 2014 15:13:09 +0000]
redhat: package volscan

Add volscan and the manual page to the files in the server package.

Change-Id: I97c210da1e0d9d28682e555e92863c4c408b94da
Reviewed-on: http://gerrit.openafs.org/11370
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoopr: opr_AssertionFailed undefined in kernel module
Mark Vitale [Fri, 6 Jun 2014 23:27:04 +0000]
opr: opr_AssertionFailed undefined in kernel module

The opr_Assert in opr_rbtree_remove is incompletely defined;
the opr_Assert macro is defined in opr.h, but the definition
for the opr_AssertionFailed routine it invokes is not included.
This allows the kernel module to build successfully even though
it retains a hidden undefined reference for opr_AssertionFailed.

However, the logic in obr_rbtree_remove ensures that this
particular opr_Assert can never fail - it is superfluous.
Some compilers (e.g. gcc for Linux AFS kernel module
builds) are able to recognize this and optimize it out.  Others
(e.g. Solaris 5.12) do not, and when this happens the OpenAFS
build appears to succeed but the kernel module will fail to load
due to the undefined symbol.

Remove the superfluous opr_Assert.

This partially reverts commit 9f8b765bbdbb8913fcadbde8d3362039e9dc8e61.

Change-Id: I4ed2b1873c434e41dce0f2e474926bf8b449b819
Reviewed-on: http://gerrit.openafs.org/11296
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoRevert "libafs: remove stray "-v 2" argument to afs_compile_et"
Jeffrey Altman [Wed, 6 Aug 2014 18:34:46 +0000]
Revert "libafs: remove stray "-v 2" argument to afs_compile_et"

This reverts commit d7082793eedc46d3647d38ffdf5a2b52fadb3cc3

Change-Id: I8ad37f109fc244d198f85c4642dcf1e8eb33a184
Reviewed-on: http://gerrit.openafs.org/11360
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoLINUX: Avoid premature RO volume lock error
Andrew Deason [Thu, 17 Jul 2014 15:33:23 +0000]
LINUX: Avoid premature RO volume lock error

Commit 0fc27471e7da0c5de4addcdec1bfbca5208072cc avoids processing lock
requests for RO volumes, but it did this both in afs_lockctl() and in
the Linux-specific afs_linux_lock(). The changes in afs_linux_lock()
are incorrect, since they also avoid F_GETLK requests (whereas
afs_lockctl() just avoids F_SETLK* requests).

Additionally, the section in afs_linux_lock() incorrectly reports an
error, since it returns a positive EBADF error code, when we are
supposed to return -EBADF.

The result of all of this is that an F_GETLK F_WRLCK request for an RO
volume always fails with fcntl() returning 9 (EBADF), which is an
invalid return code for fcntl() F_GETLK (instead we should return -1
with an errno of 9). But if there are no locks, we should return
success anyway.

Just remove this section, since afs_lockctl() handles this case itself
anyway.

Thanks to Todd Lewis for reporting this issue.

Change-Id: Ia7f3f0b1bdbb922dca06be9de02a9c2b33f9ffee
Reviewed-on: http://gerrit.openafs.org/11316
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agotools: fix unpack in example sysvmq audit reader
Michael Meffie [Fri, 8 Nov 2013 21:22:48 +0000]
tools: fix unpack in example sysvmq audit reader

Fix the unpack in the example sysvmq audit reader script to
correctly unpack the message type, which is an native long.

From the msgrcv perl docoumentation:

  Note that when a message is received, the message type as a native
  long integer will be the first thing in VAR, followed by the actual
  message.  This packing may be opened with "unpack("l! a*")".

Change-Id: I5c5480c30d530b384d8057fb071b01e67f1b4ad2
Reviewed-on: http://gerrit.openafs.org/10445
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoafs: remove cruft from Solaris afs_freevfs
Mark Vitale [Sun, 29 Jun 2014 20:27:37 +0000]
afs: remove cruft from Solaris afs_freevfs

Remove some unused variables left behind in a previous
refactor of flushing vcaches during afs_shutdown
(commit 80fe111f0044aa7a67215ad92210dc72cb7eb2c0).

Change-Id: Ie0a23cb08fc2946f1c400b8ce8e15ef3dc22ec20
Reviewed-on: http://gerrit.openafs.org/11310
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agovolinfo: fix documenting comments
Stephan Wiesand [Wed, 23 Jul 2014 11:57:50 +0000]
volinfo: fix documenting comments

As pointed by Andrew deason during review of the 1.6 pullup of
commit ae27283550dab33704f30e18975722e0ed2c5424, psize is not
a parameter of HandleHeaderFiles, and in function HandleSpecialFile
it is of type inout since the value is first read by the += operation.
Fix this, and try to improve the description of psize too.

Change-Id: Ia728b20475f0c44b6104dc954aaa04d5f0f098b5
Reviewed-on: http://gerrit.openafs.org/11319
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoLINUX: Check afs_lookup return code explicitly
Andrew Deason [Thu, 24 Jul 2014 16:07:45 +0000]
LINUX: Check afs_lookup return code explicitly

Checking if the returned vcache is NULL or not is a bit of an indirect
way to check if an error occurred. Just check the return code itself,
to make sure we notice if any kind of error is reported.

Suggested by Chas Williams.

Change-Id: I61cc7304e9885ddaaebe96db3b12457cb6224420
Reviewed-on: http://gerrit.openafs.org/11321
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoFBSD: adhere to gop_lookupname() semantics
Ben Kaduk [Fri, 18 Jul 2014 19:19:24 +0000]
FBSD: adhere to gop_lookupname() semantics

The current semantics are that gop_lookupname() returns an unlocked
vnode; the previous code was written to a different semantic that
a locked vnode should be returned.

This makes a disk cache more likely to work on FreeBSD, but such
configurations remain not very tested.

Change-Id: I12ac77cd271be72af2fa4045c2ebf576847b625e
Reviewed-on: http://gerrit.openafs.org/11317
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: remove stray "-v 2" argument to afs_compile_et
Stephan Wiesand [Thu, 31 Jul 2014 18:50:04 +0000]
libafs: remove stray "-v 2" argument to afs_compile_et

Commit 4e6b7ab904d38d38da1b80a7342bd815668a8c09 separated the
compile_et rules for creating the source and header files using
the new -emit functionality. During review for inclusion in 1.6,
Chas Williams spotted a stray "-v 2" carried over to the rule
for creating the header file, where it doesn't apply. Remove it.

Change-Id: I554354eae0fa018e56fe7b78df69a43e5b5a0b07
Reviewed-on: http://gerrit.openafs.org/11347
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: fix vrequest leak in afs_lookup
Michael Meffie [Tue, 29 Jul 2014 00:57:01 +0000]
libafs: fix vrequest leak in afs_lookup

Fix vrequest leak introduced in commit
9930567bcf9655d3f562b210b2dc4b4a99226691.

Thanks to Andrew Deason for finding this error.

Change-Id: I8fc1391ab43f33c5a8208ff58d1d0641292cf63e
Reviewed-on: http://gerrit.openafs.org/11337
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agolibafs: do not allow NULL creds for afs_CreateReq
Michael Meffie [Mon, 28 Jul 2014 21:27:40 +0000]
libafs: do not allow NULL creds for afs_CreateReq

Do not allow callers to pass a NULL cred to afs_CreateReq.  This
avoids setting the uid of zero in the vrequest when no cred is
passed.  Update callers to pass afs_osi_credp for an anonymous cred
when no cred is available.

Thanks to Andrew Deason for pointing out afs_osi_credp should be
used.

Change-Id: I05f694026ec72ab701160d9920e47c16cda46cd7
Reviewed-on: http://gerrit.openafs.org/11336
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfig: Refactor the FreeBSD configuration files
Chas Williams (CONTRACTOR) [Thu, 31 Jul 2014 15:45:14 +0000]
config: Refactor the FreeBSD configuration files

Use a common file for most of the platform specific settings.

Change-Id: If95ad44de99fc3320570d53d706fed4d760fe67d
Reviewed-on: http://gerrit.openafs.org/11346
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfig: AFS_SHORTGID no longer in use
Chas Williams (CONTRACTOR) [Thu, 31 Jul 2014 15:40:23 +0000]
config: AFS_SHORTGID no longer in use

Remove the AFS_SHORTGID macro from the param header files.  There
are no usages in the rest of the source tree.

Change-Id: I417b6e90fa9a094bfef727134b640964596eceb3
Reviewed-on: http://gerrit.openafs.org/11345
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfig: Updates to AFS_HAVE_STATVFS for FreeBSD
Chas Williams (CONTRACTOR) [Thu, 31 Jul 2014 15:14:57 +0000]
config: Updates to AFS_HAVE_STATVFS for FreeBSD

Always define AFS_HAVE_STATVFS.  According to the man page, statvfs()
appeared in FreeBSD 5.0.  Additionally, this macro is only used for
userspace which eliminates all disables except for FreeBSD 5.0 which
appears to have just been an oversight when the param file was created
from the 4.x param files.

Also fixes the comment so it reflects the actual choice.

Change-Id: Ibdcd694e9c4a0d0cecccd91a51962af6fb11ff36
Reviewed-on: http://gerrit.openafs.org/11344
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfig: Remove deprecated macro from FreeBSD configuration files
Chas Williams (CONTRACTOR) [Mon, 28 Jul 2014 12:24:48 +0000]
config: Remove deprecated macro from FreeBSD configuration files

The macro STDLIB_HAS_MALLOC_PROTOS was deprecated in commit
daff4006627fc88be85dade3d72aa45e57a6804a.

Change-Id: I9c2129f6f3d5be6a00ef6ddd358967e0fd4f7ec9
Reviewed-on: http://gerrit.openafs.org/11333
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: fix error location code in LINUX/osi_export
Michael Meffie [Fri, 1 Aug 2014 22:27:35 +0000]
libafs: fix error location code in LINUX/osi_export

Fix the missing error location code introduced in commit
40fb2650b783fbafe51aefd3d0af7a6b0536c265
libafs: allocate vattrs in LINUX to reduce stack used

Use location number 104, which is the next in the sequence.

The code in this module is compiled when building the
nfs translator, which is only built under linux when
configure detects it is possible.

Thanks to Andrew Deason for spotting this error.

Change-Id: I00c834bc915fa3be7d5f27467895930e4f62aa76
Reviewed-on: http://gerrit.openafs.org/11351
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoLINUX: Drop dentry if lookup returns new file
Andrew Deason [Wed, 23 Jul 2014 16:54:47 +0000]
LINUX: Drop dentry if lookup returns new file

Background: when an entry is looked up after its parent changes,
afs_linux_dentry_revalidate re-looks-up the entry name in its parent.
If we get an ENOENT back, we d_drop the dentry, and in any other
situation we just d_invalidate it. As discussed in prior commits
997f7fce437787a45ae0584beaae43affbd37cce and
389473032cf0b200c2c39fd5ace108bdc05c9d97, we cannot simply d_drop the
dentry in all cases, because that would cause legitimate directories
to be reported as "deleted" if we just failed to lookup the entry due
to e.g. transient network errors (this causes, among other things,
'getcwd' to fail with ENOENT).

However, this logic has problems if the dentry name still exists, but
points to a different file; the case where 'tvc != vcp' in
afs_linux_dentry_revalidate. If that case happens, and the dentry is
still held open by some process, we will continue to try to reference
the vcache pointed to by the 'old' dcache entry, which is incorrect.

To maybe more clearly illustrate the issue, consider the following
cases:

  $ sleep 9999 < /afs/localcell/testvol.ro/dir1/file1 &
  $ rm -rf /afs/localcell/testvol.rw/dir1
  $ mkdir /afs/localcell/testvol.rw/dir1
  $ vos release testvol
  $ ls -l /afs/localcell/testvol.ro
  ls: cannot access /afs/localcell/testvol.ro/dir1: No such file or directory
  total 0
  d????????? ? ? ? ?            ? dir1

Here, on the last 'ls', afs_linux_dentry_revalidate will afs_lookup
'dir1', and notice that it points to a different file (tvc != vcp),
and will d_invalidate the dentry. But since the file is still held
open, the dentry doesn't go away, and so we are still pointing to the
vcache for the old, deleted 'dir1'. That file doesn't exist anymore on
the fileserver, so we get an ENOENT when actually trying to stat() it
(we get a VNOVNODE from the fileserver, whcih gets translated to an
ENOENT).

A possibly more serious case is when the file is just renamed:

  $ sleep 9999 < /afs/localcell/testvol.ro/dir1/file1 &
  $ mv /afs/localcell/testvol.rw/dir1 /afs/localcell/testvol.rw/dir1.moved
  $ mkdir /afs/localcell/testvol.rw/dir1
  $ touch /afs/localcell/testvol.rw/dir1/file2
  $ vos release testvol
  $ ls -l /afs/localcell/testvol.ro/dir1
  total 0
  -rw-rw-r--. 1 1235 adeason 0 Jul 23 11:09 file1
  $ kill %1
  $ ls -l /afs/localcell/testvol.ro/dir1
  total 0
  -rw-rw-r--. 1 1235 adeason 0 Jul 23 11:10 file2

In this situation, the same code path applies, but the old file still
exists, so we will continue to use it without error. But since we are
still pointing at the old file, of course the results are incorrect.
Once we kill the process holding the file open, the bad dentry finally
goes away and the results are valid again.

To fix this behavior, d_drop the dentry in all cases, except when we
encounter an error preventing the lookup from being done. This ensures
that the dentry is unhashed from the parent directory in the scenarios
above, and so cannot be used for a subsequent lookup.

With this change, the only afs_lookup response that causes a simple
d_invalidate is when we encounter actual errors during the lookup
(such as transient network failures). This is correct, since in those
cases we don't _know_ that the dentry is wrong. For all other cases,
we do know that the dentry is wrong and so we must force it to be
unhashed.

Change-Id: I11a2db1e05d68a755a77815ec5e8d01ac7b36129
Reviewed-on: http://gerrit.openafs.org/11320
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoptserver: Fix RemoveFromSGEntry hentry memcpy
Andrew Deason [Wed, 30 Jul 2014 16:12:39 +0000]
ptserver: Fix RemoveFromSGEntry hentry memcpy

In this function, hentry is the "previous" continuation entry that we
looked at, and centry is the "current" continuation entry. We keep
track of the previous continuation entry in case we need to update its
'next' pointer, which we do if we free one of the continuation entries
because it is empty after the removal.

So, this memcpy is supposed to copy the current entry to the previous
one, but the arguments are flipped, so we just copy zeroes to centry
(since hentry is initialized to zeroes early on in the function), and
hentry never gets set to anything besides zeroes.

The effect of this is that whenever a ptdb entry has more than one
continuation entry, and we free up any of them after the first one via
RemoveFromSGEntry, the previous continuation entry becomes blanked
(though the 'next' pointer should still be correct). This means the
membership information for that group is not recorded correctly, as it
loses a chunk of the IDs that it is a member of. The reverse mapping
should still be intact (the parent groups have a pointer to the
sub-group), but the group probably doesn't function correctly.

The reason this happened is because of the confusing conversion from
bcopy to memcpy. Most of the instances of bcopy/bcmp/bzero/etc were
converted (correctly) back in commit c5c521af, but the supergroups
implementation was added afterwards, in 8ab7a909, and contained a
bcopy reference. This bcopy was converted to memcpy in 58d5f38b, but
the argument order was not corrected, causing this bug.

To fix this, just flip the first two arguments of the memcpy. Just get
rid of the casts here, too, to match the code in the non-supergroups
RemoveFromEntry and elsewhere.

Change-Id: Ibcbbdcb13ef5c033ea3452555832a0fd3f916efd
Reviewed-on: http://gerrit.openafs.org/11340
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoMove VLOP_RESTORE and VLOP_ADDSITE home
Nathaniel Wesley Filardo [Fri, 25 Jul 2014 15:50:16 +0000]
Move VLOP_RESTORE and VLOP_ADDSITE home

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

9 years agoFBSD: 10.1 is coming out soon
Garrett Wollman [Sat, 26 Jul 2014 04:43:10 +0000]
FBSD: 10.1 is coming out soon

The 10.1 release cycle is starting in a month, so let's get ahead of
the curve by adding the config bits now.

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

9 years agoFBSD: 9.3 has been released, so add config bits and sysname
Garrett Wollman [Sat, 26 Jul 2014 04:22:09 +0000]
FBSD: 9.3 has been released, so add config bits and sysname

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

9 years agoptserver: fix errant debug message log level
Michael Meffie [Wed, 9 Jul 2014 15:37:21 +0000]
ptserver: fix errant debug message log level

Fix the log level a debugging message introduced
in commit 9ddf9eca56e02be978ff7d065ee16c85de2cfb06.
Thanks to Ben Kaduk for reporting this issue.

Change-Id: I8913472aba8fe5247a29e31e3f04090bc0fce64e
Reviewed-on: http://gerrit.openafs.org/11314
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoauth: Fix library dependencies so that tests build again
Chas Williams (CONTRACTOR) [Thu, 3 Jul 2014 15:02:40 +0000]
auth: Fix library dependencies so that tests build again

Change-Id: Ia95a94a77290baea419beb942ea60cd1b89c22fa
Reviewed-on: http://gerrit.openafs.org/11311
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoLinux 3.16: Convert to new write_iter/read_iter ops
Marc Dionne [Wed, 18 Jun 2014 13:06:39 +0000]
Linux 3.16: Convert to new write_iter/read_iter ops

Change read/write operations to the new write_iter/read_iter
operations.

Change-Id: Ia58e5f90182f3968d1a81cfc2f831e7a9cf35d93
Reviewed-on: http://gerrit.openafs.org/11303
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoLinux 3.16: Switch to iter_file_splice_write
Marc Dionne [Wed, 18 Jun 2014 12:53:48 +0000]
Linux 3.16: Switch to iter_file_splice_write

Users of generic_file_splice_write need to switch to
using iter_file_splice_write.

Change-Id: If4801d27e030e1cb986f483cf437a2cfa7398eb3
Reviewed-on: http://gerrit.openafs.org/11302
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoUse an unsigned type for bitmask values
Benjamin Kaduk [Mon, 16 Jun 2014 16:44:08 +0000]
Use an unsigned type for bitmask values

As noted by clang -Wshift-sign-overflow, the expression "1<<31"
overflows the signed int type, giving undefined behavior.

Use an unsigned type to make the result of the shift defined
behavior by the C99 standard.

Also change an instance of "1<<31" that was checking for whether the
most significant bit was set, as it's still undefined behavior.

Change-Id: I8cf9443aa92470181044fc3b63d491da18ff5e34
Reviewed-on: http://gerrit.openafs.org/11301
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoauditU: also report for rxkad-always-encrypt
Ben Kaduk [Wed, 27 Nov 2013 22:06:33 +0000]
auditU: also report for rxkad-always-encrypt

The logic that works for security index 2 also works for index 3.

While here, update a comment in preparation for rxgk.

Change-Id: Ifd868fa8d9d0ba2f422fa1fac43e4f583d27a1ff
Reviewed-on: http://gerrit.openafs.org/10527
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoUse the RX_SECIDX_* enums in more places
Ben Kaduk [Wed, 27 Nov 2013 22:01:39 +0000]
Use the RX_SECIDX_* enums in more places

Add symbols for security indices 1 (rxvab, unused) and 3 (rxkad with
always-encrypt, maybe-used).

kauth and bubasics defined macros for RX_SCINDEX_*; replace those
with the common core rx enums as well.

Use the global symbols instead of custom defines like BULK_NULL and
SAMPLE_NULL, which can now be removed.

Reformat a comment to match current style, since we're changing it anyway.

Change-Id: I82bbb0016a5c3129dfd18ff7dc77ff7839501ad8
Reviewed-on: http://gerrit.openafs.org/10526
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoafs: maintain afs_users buckets in sorted order
Mark Vitale [Mon, 7 Apr 2014 22:56:26 +0000]
afs: maintain afs_users buckets in sorted order

Modify afs_GetUser() to insert a new unixuser into an afs_users
hash bucket in sorted order, by uid/PAG.  This is in support of
other small optimizations in future commits.

Change-Id: I68c51ab38733575290aa0c8aa2a306168c5483c0
Reviewed-on: http://gerrit.openafs.org/11071
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoafs: only reset access caches for the matching cell
Mark Vitale [Thu, 3 Apr 2014 20:37:51 +0000]
afs: only reset access caches for the matching cell

When an AFS user's tokens change (unlog, aklog) or expire,
afs_ResetAccessCache() is called to reset all the access caches
for that uid/PAG.

However, a user/PAG may have tokens for multiple cells, and they
may expire or be set/reset at different times.  Therefore, it is
incorrect to assume that all access caches for a uid/PAG should
be discarded when only one cell's tokens have changed.

Modify afs_ResetAccessCache() to acccept a new argument 'cell',
and only reset the access caches for a uid/PAG if the vcache
resides in the specified cell.  If the caller really wants to
reset all a user's access caches, specify cell=-1.

For cache managers that are running with multiple PAGs and multiple
cells, this should improve performance because 1) it avoids
scanning access caches chains for vcaches that are not part of the
current cell and 2) it avoids deleting access caches that may still
good, thus preventing unnecessary FetchStatus calls.

Change-Id: Id4c138dab45fd48265a4029880a5d57947e67a52
Reviewed-on: http://gerrit.openafs.org/11070
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoroken: configure checks for getaddrinfo and friends
Michael Meffie [Sat, 11 Jan 2014 03:17:57 +0000]
roken: configure checks for getaddrinfo and friends

Change-Id: Icb2ace89332024668c9dc4326b967a1015afc1e9
Reviewed-on: http://gerrit.openafs.org/11199
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>