openafs.git
8 years agotests: Add opr to the command test libraries
Simon Wilkinson [Thu, 22 Mar 2012 14:48:16 +0000]
tests: Add opr to the command test libraries

The cmd/command-t test needs libopr, so give it to it

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

8 years agolibafsrpc: Export connection accessor fuctions
Simon Wilkinson [Thu, 22 Mar 2012 14:39:27 +0000]
libafsrpc: Export connection accessor fuctions

Add various connection accessor functions to the export map file for
libafsrpc so they can be used from within RX security layers.

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

8 years agoopr: should be built as shared
Chas Williams (CONTRACTOR) [Mon, 19 Mar 2012 20:47:28 +0000]
opr: should be built as shared

Since this library could be use anywhere (including a shared library)
it should be built as position independent code.

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

8 years agoWindows: Client handling of VNOSERVICE
Jeffrey Altman [Thu, 22 Mar 2012 19:55:47 +0000]
Windows: Client handling of VNOSERVICE

VNOSERVICE should not be grouped together with the volume status
error codes.  It is used to indicate that the RPC was not serviced.
The file server issues it when its idle dead timeout period is reached
while receiving rx call data.  The client's existing status information
is still valid and the client can retry the call.

Change-Id: I51e447824366381e740361576c96559f1c4f3fd3
Reviewed-on: http://gerrit.openafs.org/6938
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 Debug for STATUS_NOT_A_DIRECTORY
Jeffrey Altman [Wed, 21 Mar 2012 14:11:31 +0000]
Windows: AFSRedir Debug for STATUS_NOT_A_DIRECTORY

Add additional logging to handle the case where the afsd_service
returns STATUS_NOT_A_DIRECTORY for eval by id/name.

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

8 years agoLinux 3.4: Switch to d_make_root
Marc Dionne [Thu, 22 Mar 2012 02:19:04 +0000]
Linux 3.4: Switch to d_make_root

If d_make_root is available, use it instead of d_alloc_root.
The helper was introduced in 3.3, and d_alloc_root gets removed
in 3.4.

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

8 years agodoc: remove references to AFS's NTP daemon
Ken Dreyer [Wed, 14 Mar 2012 02:06:43 +0000]
doc: remove references to AFS's NTP daemon

AFS's own ntpd and runntp are obsolete. Remove them from the
documentation, and recommend the OS vendor-supplied NTP instead.

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

8 years agobuild on solaris 10 again
Michael Meffie [Mon, 19 Mar 2012 23:27:33 +0000]
build on solaris 10 again

Use min and max instead of the non-standard MIN and MAX macros.

Commit 64b00c3a1a87739621f58c777fc3cc54fb15a0af removed inclusion of
rx_packet.h, which included definitions of MIN and MAX on various platforms.

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

8 years agoWindows: invalidate correct objects during dir verification
Jeffrey Altman [Fri, 16 Mar 2012 05:09:42 +0000]
Windows: invalidate correct objects during dir verification

When processing a directory verification, if a change of data
version is detected or if the FileID of a FileName changes,
be sure to invalidate and verify the directory entry.  Setting
the verify flag on the parent after updating the directory
entry's metadata does not result in the correct behavior.

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

8 years agoosx: deal with more kerberos damage
Derrick Brashear [Thu, 15 Mar 2012 15:51:39 +0000]
osx: deal with more kerberos damage

the number of things which can return success without succeeding is
truly sad.

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

8 years agoafs: Never #define away afsd_dynamic_vcaches
Andrew Deason [Wed, 7 Mar 2012 22:36:57 +0000]
afs: Never #define away afsd_dynamic_vcaches

Some versions of the Solaris Studio compiler on SPARC (at least 12.2
and possibly others, but not 12.3) get a little confused by code like
this:

    extern int foo;
    int
    somefunc(void) {
        if (0) return foo;
        return 0;
    }

When optimization is turned off, this results in an undefined symbol
reference to 'foo' (which is normal), but the resulting object file
lacks a relocation entry for the symbol 'foo', so the symbol remains
undefined after linking. In the OpenAFS tree, this occurs in
afs_daemons.c which references afs_vcount and afs_cacheStats in this
manner due to afsd_dynamic_vcaches being defined as '0' on Solaris.
The end result is that the libafs kernel module is not loadable, since
it complains about afs_vcount and afs_cacheStats being undefined, even
though the symbol definitions are also in the module.

While this is a bug in Solaris Studio and has since been fixed, it is
simple to work around this so we are usable with more compilers. If we
just always declare afsd_dynamic_vcaches as a regular variable, it
works around this issue and keeps the code a tiny bit simpler. So, do
that.

Change-Id: I3f8fc6aafd52487d729289e393fc59dac84d36ea
Reviewed-on: http://gerrit.openafs.org/6888
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agorx: hold call->lock across RXS_PreparePacket
Simon Wilkinson [Wed, 14 Mar 2012 14:56:06 +0000]
rx: hold call->lock across RXS_PreparePacket

RX Security Classes have a right to assume that when RXS_PreparePacket
is called that they have exclusive access to the rx_call structure.
Commit e445faa68c5ec6e47d3fd9d7318ade71d98703a9 unintentionally
failed to acquire the call->lock prior to RXS_PreparePacket being
called.

Change-Id: I5a9dfb2818fa17ba6fc1ab6f76ec5cde602c6f16
Reviewed-on: http://gerrit.openafs.org/6904
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

8 years agoWindows: Drop resource across AFSCleanupFcb
Jeffrey Altman [Mon, 12 Mar 2012 19:53:47 +0000]
Windows: Drop resource across AFSCleanupFcb

Avoid additional deadlocks involving
VolumeCB->ObjectInfoTree.TreeLock.

Change-Id: Ibfeb8f230c54e95d3a0b7b9d84c63cb7f4b9ce2d
Reviewed-on: http://gerrit.openafs.org/6893
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: Wait for memory allocation if necessary
Jeffrey Altman [Wed, 7 Mar 2012 14:54:54 +0000]
Windows: Wait for memory allocation if necessary

The kernel has a limited pool of memory.  If there is no memory
available to satisfy a request, that request will fail initially
with a STATUS_OUT_OF_RESOURCES error which in most cases is exposed
to the user-mode application as STATUS_ACCESS_DENIED.  This can
produce inconsistent results.

This patchset introduces an Event object, MemoryAvailableEvent,
which is signalled when the redirector deallocates memory.  This
should in many cases permit requests to succeed where they otherwise
would have failed immediately.

The WaitingForMemoryCount field tracks the number of threads that
are waiting for memory to become available.  A subsequent patch
could use this value to accelerate the tear down of cached data.

To avoid deadlocks, blocking threads will only wait for a maximum
of 30 seconds at a time.  As long as the redirector continues to
free memory, the thread can re-queue itself.  However, if a timeout
occurs, the allocation request will fail.

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

8 years agoWindows: Correct Data Version change synchronization
Jeffrey Altman [Tue, 6 Mar 2012 05:14:28 +0000]
Windows: Correct Data Version change synchronization

The data version must be checked and set while the ObjectInformation
DirectoryNodeHdr.TreeLock is held exclusive.  Otherwise, it is
possible for a race to occur.

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

8 years agoMake volscan's column delimiter option work
Paul Smeddle [Mon, 12 Mar 2012 19:56:11 +0000]
Make volscan's column delimiter option work

Currently, volscan ignores the -delim command-line option,
using the hardcoded default. This patch adds processing
for this option, allowing alternative characters.

Corrects an error in a08c3207255756c825ab69a19e04f79dd879c646

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

8 years agoviced: fix inverted lockCount assignment
Jens Wegener [Tue, 6 Mar 2012 13:28:32 +0000]
viced: fix inverted lockCount assignment

FIXES 130605

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

8 years agoredhat: Don't replace modified configuration files during rpm update
Jonathan Billings [Thu, 8 Mar 2012 14:23:40 +0000]
redhat: Don't replace modified configuration files during rpm update

The previous setting for three %config files mentioned in the spec file:

%config /etc/sysconfig/openafs
%config %{_prefix}/vice/etc/ThisCell
%config %{_prefix}/vice/etc/cacheinfo

When using an unadorned %config, it's possible that these files will
be replaced by the packaged version during a package update.  Changing
%config to %config(noreplace) means that the packaged file will be
installed with the extension .rpmnew if there is already a modified
(from the existing package's version) file with the same name on the
installed machine.

The concern here is that updating an existing system could potentially
change the configuration if the person installing doesn't pay close
attention.  The Rule of Least Surprise indicates that we should
try to preserve existing configuration changes whenever possible.

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

8 years agorxgen: fix to use rx accessor routines
chas williams - CONTRACTOR [Mon, 5 Mar 2012 16:41:08 +0000]
rxgen: fix to use rx accessor routines

apparently some uses didnt get converted during the previous work.

Change-Id: Iaa4dcf73fd2e29e3f95feede5217eac4eaded4e2
Reviewed-on: http://gerrit.openafs.org/6874
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

8 years agoviced: fix -realm option arg parse
Michael Meffie [Sat, 3 Mar 2012 14:42:12 +0000]
viced: fix -realm option arg parse

Advance only once per realm argument when processing the
realm command line option.

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

8 years agoviced: fix log message in hpr initialize
Michael Meffie [Wed, 29 Feb 2012 16:08:10 +0000]
viced: fix log message in hpr initialize

The wrong dir object is used to log an error in hpr
initialize.

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

8 years agomacos: don't crash on krb5 damage
Derrick Brashear [Sun, 4 Mar 2012 14:48:07 +0000]
macos: don't crash on krb5 damage

if we get success but still no client, don't crash

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

8 years agoWindows: add __try..__except
Jeffrey Altman [Fri, 2 Mar 2012 15:54:38 +0000]
Windows: add __try..__except

Wrap potential exception locations in __try ... __except so
that the exceptions can be caught by us instead of Cc/Mm which
use exceptions to signal status.

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

8 years agoWindows: fix indentation
Jeffrey Altman [Fri, 2 Mar 2012 15:54:23 +0000]
Windows: fix indentation

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

8 years agoWindows: Avoid deadlock in invalidation path
Jeffrey Altman [Fri, 2 Mar 2012 15:52:35 +0000]
Windows: Avoid deadlock in invalidation path

During data version invalidation the AFS redirector must CcPurge
any non-dirty extents on a file. This operation can be intercepted
by a filter driver which in turn might open the file and close it
again before the CcPurge completes.

The AFSPerformObjectInvalidate call holds the ExtentsResource
shared which can deadlock if AFSClose attempts an extent tear down
which requires exclusive access to the ExtentsResource.

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

8 years agoFixes dkms.conf for Redhat Enterprise
Dave Botsch [Thu, 1 Mar 2012 17:43:36 +0000]
Fixes dkms.conf for Redhat Enterprise

commit 8e0aaae076f4cccfd2d6ed81ede4e355235b578e , while fixing dkms.conf for
Fedora, broke dkms.conf for RHEL. In RHEL, you get a dkms.conf with too
many backslashes in the "mv" line. The dkms.conf should have the mv line
reading:

mv src/libafs/MODLOAD-*/\$KMODNAME \$DSTKMOD"

for Fedora.

This change checks if we are building on Fedora, and if so, maintains
the extra backslashes. Otherwise, not.

modified:   src/packaging/RedHat/openafs.spec.in

Uses the dist tags as specified at
http://fedoraproject.org/wiki/Packaging:DistTag

Change-Id: I7fd7531758a63b2634424c2fcba23ae1b0fc8f2f
Reviewed-on: http://gerrit.openafs.org/6851
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agounix: always retry RX_CALL_BUSY
Jeffrey Altman [Thu, 1 Mar 2012 20:49:12 +0000]
unix: always retry RX_CALL_BUSY

RX_CALL_BUSY is an indication that the call channel is busy not
that the server is down or otherwise cannot respond.  Unconditionally
retry the RPC and do not alter state.  We just want to force the use
of a different call channel.

Change-Id: Ic4ef9bac800087f1b287d3da08fcd5eec84374ef
Reviewed-on: http://gerrit.openafs.org/6852
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Hartmut Reuter <reuter@rzg.mpg.de>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

8 years agoWindows: Workaround Win7 SMB Reconnect Bug
Jeffrey Altman [Wed, 29 Feb 2012 18:07:47 +0000]
Windows: Workaround Win7 SMB Reconnect Bug

The SMB specification permits the server to save a round trip
in the GSS negotiation by sending an initial security blob.
Unfortunately, doing so trips a bug in Windows 7 and Server 2008 R2
whereby the SMB 1.x redirector drops the blob on the floor after
the first connection to the server and simply attempts to reuse
the previous authentication context.  This bug can be avoided by
the server sending no security blob in the SMB_COM_NEGOTIATE
response.  This forces the client to send an initial GSS init_sec_context
blob under all circumstances which works around the bug in Microsoft's
code.

Do not call smb_NegotiateExtendedSecurity(&secBlob, &secBlobLength);

As a result of the SMB 1.x bug, all attempts to reconnect fail due to
SMB connection resets.  The SMB 1.x redirector will retry indefinitely
but all processes with outstanding requests to \\AFS will block until
the machine is rebooted.

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

8 years agoviced: Ignore client loopback alternate addresses
Andrew Deason [Thu, 8 Jul 2010 16:25:19 +0000]
viced: Ignore client loopback alternate addresses

When we receive interface information from a client to determine its
alternate IP addresses, ignore any addresses that look like loopback.

Change-Id: I245ebfc74ad1e8bd2fcd235a00f000d29229668d
Reviewed-on: http://gerrit.openafs.org/2368
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

8 years agoWindows: Fix an ExtentResource trace message
Jeffrey Altman [Fri, 24 Feb 2012 17:23:28 +0000]
Windows: Fix an ExtentResource trace message

This instance is logging a SHARED acquisition not an EXCL one.

Change-Id: Id4e69bb275ff4eb242b2c145df80ed9b73313776
Reviewed-on: http://gerrit.openafs.org/6792
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: cm_UpdateCell never applies to Freelance mode
Jeffrey Altman [Fri, 24 Feb 2012 17:21:46 +0000]
Windows: cm_UpdateCell never applies to Freelance mode

The Freelance.Local.Cell is updated by the registry monitor
thread and cm_UpdateCell should be a no-op.  Make it so.

Change-Id: I2961114590af6b64b8ae06d608a97513e83aad4e
Reviewed-on: http://gerrit.openafs.org/6791
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: Redirector opens must set a valid FsContext
Vaibhav Kamra [Thu, 23 Feb 2012 17:58:07 +0000]
Windows: Redirector opens must set a valid FsContext

A successful open must have FileObject->FsContext set to a structure
with a valid/initialized FSRTL_ADVANCED_FCB_HEADER object.

Not having this breaks assumptions in the kernel.

Patchset edited by Jeffrey Altman <jaltman@your-file-system.com>

Change-Id: I70c9045bfa02c54074c015e6e871ead63efb6769
Reviewed-on: http://gerrit.openafs.org/6782
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 AFSOpenRedirector from AFSRedirLib
Jeffrey Altman [Thu, 23 Feb 2012 19:13:08 +0000]
Windows: remove AFSOpenRedirector from AFSRedirLib

The AFSOpenRedirector functionality must exist in the framework,
AFSRedir.sys, not the library, AFSRedirLib.sys.

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

8 years agoWindows: do not bugcheck in AFSExAllocatePoolWithTag
Jeffrey Altman [Thu, 23 Feb 2012 14:31:31 +0000]
Windows: do not bugcheck in AFSExAllocatePoolWithTag

If the Bug Check flag is set, the call to AFSBreakPoint() in
AFSExAllocatePoolWithTag() will trigger.  There is no need for
an explicit bug check test in AFSExAllocatePoolWithTag().

If AFSExAllocatePoolWithTag() returns NULL there is no need
to ASSERT() the return value since AFSBreakPoint() would already
have been called to signal a debugger.

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

8 years agoWindows: Revert "AFSRedir DebugFlags Turn on BugCheck"
Jeffrey Altman [Thu, 23 Feb 2012 14:28:49 +0000]
Windows: Revert "AFSRedir DebugFlags Turn on BugCheck"

This reverts commit 209df87d08fb07d9641b81858a0821b9fd95dbcc.

Turning on BugCheck by default was a good idea because we needed
to track down the cause of exceptions that were otherwise being
thrown resulting in resource leaks.  However, it is a bad idea
because it results in out of memory conditions throwing bug checks
that result in a BSOD.

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

8 years agoRewrite make_h_tree.pl in shell script
Andrew Deason [Fri, 24 Feb 2012 00:28:21 +0000]
Rewrite make_h_tree.pl in shell script

The current usage of make_h_tree.pl adds a build requirement of
/usr/bin/perl that we did not have prior to commit
1d6593e952ce82c778b1cd6e40c6e22ec756daf1. Do the same thing in a
bourne shell script instead, so we don't need perl.

Note that this is not as generalized as make_h_tree.pl, but it doesn't
need to be. Specifically, this does not strip a leading ../ from found
include directives (nothing in the tree that includes h/* files uses
this), and header filenames containing whitespace almost certainly do
not work correctly.

The h => sys mapping is also much more hardcoded, but that's all we
were using this for anyway.

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

8 years agosalvager: Do not fork for single VG salvage
Andrew Deason [Thu, 23 Feb 2012 19:02:13 +0000]
salvager: Do not fork for single VG salvage

Currently we always fork a child in the salvager in order to salvage a
volume group. I believe this is in order to protect SEGV, exit(), etc
in one salvage operation from preventing salvaging anything else. When
salvaging a single volume group, though, there appears to be little
benefit.

In addition, we need to keep the VG salvaging code in the same process
as the cleanup code for single-volume salvages, so we can know which
volumes were deleted by SalvageVolumeGroup, so we know which volumes
to bring back online. So, do not fork for the singleVolumeNumber case.

Note that for DAFS, we already never fork for the entire salvage
operation when salvaging an individual volume group. So, this is
effectively a non-DAFS-only change.

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

8 years agosalvager: Remove VolumeSummary->fileName
Andrew Deason [Wed, 22 Feb 2012 00:05:32 +0000]
salvager: Remove VolumeSummary->fileName

The 'fileName' field in VolumeSummary serves two apparent purposes:

 - Storing the filename of the volume header file (V0XXX.vol).

 - Indicating whether or not a given VolumeSummary object is
   referenced by any inodes on disk. fileName is set by
   AskVolumeSummary/GetVolumeSummary, and is cleared in
   SalvageFileSys1 when a matching inodeSummary entry is found.

This is very confusing. The first purpose is completely unnecessary;
we can always calculate the filename from the volume id for the
volume, and we already enforce the filename to be of that specific
format. The second purpose is very unclear in the current code, and
overloads the meaning of the field.

So instead, remove fileName entirely. Code that was using it to locate
the header file are changed to use VolumeExternalName_r. Code that was
using the field to determine if the volume is "unused" is changed to
use a field just called "unused", set to 0 or 1.

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

8 years agosalvager: Remove PrintVolumeSummary
Andrew Deason [Wed, 22 Feb 2012 00:03:24 +0000]
salvager: Remove PrintVolumeSummary

Nothing uses this function; remove it.

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

8 years agosalvager: Do not require MaybeZapVolume fileName
Andrew Deason [Tue, 21 Feb 2012 23:46:41 +0000]
salvager: Do not require MaybeZapVolume fileName

In MaybeZapVolume, currently we do not remove the volume header if the
given isp->volSummary->fileName is not set. This effectively means
that we only actually "zap" volumes for which we have just created the
header, or which are not referenced by any inodes.

For readonly volumes that have errors, we want to delete the volumes
instead of salvaging. Readonly volumes with valid headers will have
fileName as NULL, though (set back in SalvageFileSys1), so
MaybeZapVolume will refuse to remove them. What ends up happening is
that the headers will stay around, but since we do not finish checking
the volume, all of the inodes for the data in the volume will be
dec'd. This results in a volume whose header exists, but none of its
inodes (including special inodes) exist, so the volume will need to be
salvaged again, and during that salvage will be deleted (because there
are no inodes for the volume).

Avoid all this, and just delete volume headers for volumes that lack a
valid fileName. Instead try to avoid deleting headers with
volSummary->deleted set, just so we don't try to delete the same
headers twice.

Related issue reported by ├ůsa Andersson.

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

8 years agosalvager: Do not set fileName on header fixup
Andrew Deason [Tue, 21 Feb 2012 23:40:46 +0000]
salvager: Do not set fileName on header fixup

Currently, SalvageVolumeHeaderFile will set isp->volSummary->fileName
to a new string whenever the volume header needs to be created or
re-written. When control reaches back to SalvageFileSys1, this can
cause DeleteExtraVolumeHeaderFile to delete the header, since
vsp->fileName is used as a sort of indicator to see whether or not a
volume has been referenced by the inode summary.

When we create a new header, we avoid this because we allocate a new
VolumeSummary struct, which is not caught by the last
DeleteExtraVolumeHeaderFile for loop in SalvageFileSys1. However, we
do delete the header when we simply re-write a header, since we use
the existing VolumeSummary struct. Set fileName in neither, for
consistency.

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

8 years agoLINUX: Use afs_convert_code in afs_notify_change
Andrew Deason [Wed, 22 Feb 2012 21:40:20 +0000]
LINUX: Use afs_convert_code in afs_notify_change

afs_notify_change currently just returns "-code". This can cause a
panic if the error code is negative, since we will return a positive
error code, which may get interpreted as a valid pointer value in
higher levels.

Specifically, if we hit afs_notify_change via something like this code
path:

do_sys_open -> do_filp_open -> open_namei -> may_open -> do_truncate
-> notify_change -> afs_notify_change (via inode->i_op->setattr)

the positive error value will be interpreted by do_sys_open as a valid
'struct file' pointer, and will be dereferenced.

So pass the return value through afs_convert_code, like all of the
other vnode ops, so we ensure we return an error properly.

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

8 years agoLINUX: move afs_notify_change to osi_vnodeops.c
Andrew Deason [Wed, 22 Feb 2012 21:36:37 +0000]
LINUX: move afs_notify_change to osi_vnodeops.c

afs_notify_change is almost always used solely in inode_operations
structs, and is more similar to the other per-vnode functions. Put it
with the other per-vnode functions for better organization, and so
they can use the same static functions.

Move the helper functions iattr2vattr and vattr2inode along with it.

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

8 years agolibafs: retry retriable RPCs instead of abandoning
Derrick Brashear [Wed, 22 Feb 2012 20:57:46 +0000]
libafs: retry retriable RPCs instead of abandoning

if we get e.g. an idle dead error we should retry
retriable actions, namely data stores. in order
for writing files to work correctly given how
the writeback code is structured it's important that
this not interfere with analyze's shouldRetry decision
on those RPCs

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

8 years agolibafs: ensure one nat ping connection per srvAddr
Derrick Brashear [Mon, 13 Feb 2012 03:45:59 +0000]
libafs: ensure one nat ping connection per srvAddr

track the natping conn with the srvAddr, ensuring exactly one.

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

8 years agoWindows: invalidate data version on link creation
Jeffrey Altman [Wed, 22 Feb 2012 19:19:51 +0000]
Windows: invalidate data version on link creation

notify the redirector that the directory data version has
changed when a pioctl is used to create a symlink or mount point.

FIXES 130589

Change-Id: I07e1ae130b9db8d3dd68fef892c47de008be7cd4
Reviewed-on: http://gerrit.openafs.org/6747
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: AFSPerformObjectInvalidate hold ExtentsResource shared
Jeffrey Altman [Tue, 21 Feb 2012 01:50:53 +0000]
Windows: AFSPerformObjectInvalidate hold ExtentsResource shared

The AFSPerformObjectInvalidate() was obtaining exclusive
access to the Fcb ExtentsResource even though it was not
tearing down the extents list.  The ExtentsResource could
be held shared instead.  Doing so will avoid the following
deadlock:

Thread 1:
 nt!MmPurgeSection+0x403
 nt!CcPurgeCacheSection+0x100
 AFSRedirLib!AFSPerformObjectInvalidate+0xd4
 AFSRedirLib!AFSWorkerThread+0xa4
 nt!PspSystemThreadStartup+0x2e

Thread 2:
 AFSRedirLib!AFSAcquireShared+0x18
 AFSRedirLib!AFSMarkDirty+0x68
 AFSRedirLib!AFSNonCachedWrite+0x603
 AFSRedirLib!AFSCommonWrite+0x5fa
 AFSRedirLib!AFSWrite+0x20
 nt!IofCallDriver+0x45
 AFSRedir!AFSWrite+0x57
 nt!IofCallDriver+0x45
 fltMgr!FltpDispatch+0x6f
 nt!IofCallDriver+0x45
 AMFilter+0x2c6e
 nt!IofCallDriver+0x45
 PMDriver+0x112a
 nt!IofCallDriver+0x45
 OpLoader+0x1cd2
 nt!IofCallDriver+0x45
 savonaccesscontrol+0x6f15
 savonaccessfilter+0x2fa0
 nt!IofCallDriver+0x45
 nt!IoAsynchronousPageWrite+0xd0
 nt!MiMappedPageWriter+0x127
 nt!PspSystemThreadStartup+0x2e

Thread 1 is attempting to perform a cache purge which cannot complete
until Thread 2 is finished but Thread 2 requires the ExtentsResource
which is held by Thread 1.

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

8 years agoWindows: fsLockCount not accurate
Jeffrey Altman [Mon, 20 Feb 2012 06:48:20 +0000]
Windows: fsLockCount not accurate

Prior to 1.6.2 the file server does not report an accurate value
for the lock state.  In addition, callbacks are not broken when
locks are freed due to lease expiration.

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

8 years agoviced: lockcount only valid if not expired
Jeffrey Altman [Mon, 20 Feb 2012 06:40:03 +0000]
viced: lockcount only valid if not expired

locks are issued on a lease.  If the lock is expired, the lock
count is zero.

Change-Id: I628dd5b8b0d38694d653d9e8e82ff60ec2e1505c
Reviewed-on: http://gerrit.openafs.org/6740
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

8 years agovolser: Remove unused variable
Marc Dionne [Mon, 20 Feb 2012 22:56:29 +0000]
volser: Remove unused variable

tid is now unused - remove it to avoid a warning.

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

8 years agoviced: Relax "h_TossStuff_r failed" warnings
Andrew Deason [Fri, 17 Feb 2012 23:12:46 +0000]
viced: Relax "h_TossStuff_r failed" warnings

Currently, h_TossStuff_r bails out and logs a message if we detect
that somebody grabbed a reference or locked the host while we tried to
h_NBLock_r. The reasoning for this is that it is not legal for anyone
to h_Hold_r a host that has HOSTDELETED set (but the error is
detectable and recoverable); callers are supposed to check for
HOSTDELETED and not hold a host in that case.

However, HOSTDELETED may not be set when h_TossStuff_r is called,
since we call it if either HOSTDELETED _or_ CLIENTDELETED are set. If
CLIENTDELETED is set and HOSTDELETED is not, it's perfectly fine (and
necessary) for callers to grab a reference to the host. So, if that's
what is going on, don't log a message, since that's normal behavior.

Check for HOSTDELETED before we h_NBLock_r, since it is technically
possible (and legal) for someone to grab a reference to the host and
somehow set HOSTDELETED while we wait for h_NBLock_r to return. Also
log the flags when we see this message.

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

8 years agoviced: Remove extraneous h_AHTAHT_r in h_GetHost_r
Andrew Deason [Fri, 17 Feb 2012 22:24:16 +0000]
viced: Remove extraneous h_AHTAHT_r in h_GetHost_r

We added this address to the host with an addInterfaceAddr_r call just
a few lines before, which adds the host to the address hash table.
Another call to h_AddHostToAddrHashTable_r is pure overhead and
confusing.

Change-Id: Ib08817274e632f67776956ede8b56eaf0dce879e
Reviewed-on: http://gerrit.openafs.org/6729
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agoviced: Set h_GetHost_r probefail if MPAA_r fails
Andrew Deason [Fri, 17 Feb 2012 21:46:50 +0000]
viced: Set h_GetHost_r probefail if MPAA_r fails

Currently, in h_GetHost_r, if we get a connection whose address does
not match an extant host, but the reported uuid does, we ProbeUuid the
old host. If it fails, we call MultiProbeAlternateAddress_r and set
'probefail'. Later on, if 'probefail' is set, we always add the
connection address to the host, and remove the host->host,host->port
address from the host.

However, this is not always correct. Consider the following situation.

We have an existing host that has primary address 1.1.1.1, and also
has addresses 1.1.1.2 and 1.1.1.3 on the interface list but not on the
hash table. Say that host A stops responding on 1.1.1.1, and a
connection comes in from 1.1.1.2. We ProbeUuid 1.1.1.1 and get a
failure, so we call MultiProbeAlternateAddress_r.
MultiProbeAlternateAddress_r probes via rx_Multi the addresses 1.1.1.2
and 1.1.1.3. Say that 1.1.1.3 responds first, and responds
successfully, so MultiProbeAlternateAddress_r sets 1.1.1.3 to be the
primary address for the host.

After MultiProbeAlternateAddress_r returns, 'probefail' is set. A few
lines down, we see that oldHost->host does not match haddr, and
'probefail' is set, so we add 1.1.1.2 to the interface list, and
remove 1.1.1.3, and set 1.1.1.2 to be the primary address, even though
1.1.1.3 is the address we most recently 'know' is correct.

To fix this, only set 'probefail' if MultiProbeAlternateAddress_r also
fails after the failed ProbeUuid call. Conceptually this makes sense,
since if MultiProbeAlternateAddress_r succeeds, it found an address
that responds successfully to ProbeUuid, and it sets that address to
be the primary address. Therefore, after MultiProbeAlternateAddress_r
returns success, the situation is the same as if the 'good' address
was already the primary address, and the ProbeUuid call succeeded, so
'probefail' should be cleared.

Change-Id: Id32817916a8a42db567ad099aae00745b79598c5
Reviewed-on: http://gerrit.openafs.org/6728
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agoviced: Correctly update addrs on alt addr probe
Andrew Deason [Fri, 17 Feb 2012 19:14:31 +0000]
viced: Correctly update addrs on alt addr probe

The functions MultiBreakCallBackAlternateAddress_r and
MultiProbeAlternateAddress_r try to find a valid address in a host's
interface list of addrs. If they find one, they update host->host and
host->port. However, they do so just by changing those fields directly
and by calling h_DeleteHostFromAddrHashTable_r and
h_AddHostToAddrHashTable_r. This leaves the old host->host, host->port
on the interface list, and leaves it marked as 'valid'. Similarly, the
new host and port may still be marked as not 'valid'.

This can result in the host being on the addr hash table via an
address that is not on the host's interface list. After the above
situation occurs, we may call

  removeInterfaceAddr_r(host, host->host, host->port);

and then update host->host and host->port, which happens in a variety
of places. Since host->host, host->port is not marked as valid in the
interface list, it is not removed from the addr hash table, but it is
removed from the interface list. Eventually, this can cause the host
to be referenced from the addr hash table even after it has been
freed.

Since this can result in hash table entries pointing to the 'wrong'
host, this can result in FileLog messages such as:

Sun Feb  5 03:16:35 2012 Removing address that does not belong to host 0xdeadbeefdead (1.2.3.4:7001).

And bogus instances of the message:

Sun Feb  5 03:16:36 2012 CB: new identity for host 0xdeadbeefdead (1.2.3.4:7001), deleting(1 baadcafe 12345678-9abc-def0-12-34-456789abcdef fedcba98-76543210f-ed-cb-a9876543210f)

To fix this, make MultiBreakCallBackAlternateAddress_r and
MultiProbeAlternateAddress_r update the address list the same way as
all of the code in host.c does; by adding the new address with
addInterfaceAddr_r, removing it with removeInterfaceAddr_r, and
updating host->host and host->port.

Change-Id: I0a95e0186c03c1831c4df86daae901bf2462da0e
Reviewed-on: http://gerrit.openafs.org/6727
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agoviced: Delete dup host before probing old host
Andrew Deason [Thu, 16 Feb 2012 22:20:16 +0000]
viced: Delete dup host before probing old host

Currently, when the fileserver gets a new connection from an address
not on the addr hash table, we allocate a new host structure and add
that host to the addr hash table. If we then find that that host's
uuid matches the uuid of an extant host, we do the following:

 - probe the old host with the uuid, and MultiProbeAlternateAddress_r
   if the probe fails

 - mark the duplicate host as HOSTDELETED

 - manipulate the interface lists

Consider, for example, that we have an extant host ('oldHost') with
address 1.2.3.4:7001, but with 5.6.7.8:7001 on its alternate interface
list. At some point, the 1.2.3.4:7001 interface goes away or becomes
unreachable. A new connection comes in from that same host on
5.6.7.8:7001.

What will happen is we create a new host for address 5.6.7.8:7001, and
then detect the uuid collision. When we try to probe the old address
of 1.2.3.4:7001, it will fail, and we will try to
MultiProbeAlternateAddress_r. MultiProbeAlternateAddress_r will
determine that the alternate address 5.6.7.8:7001 responds
successfully to the probe, and it tries to set 5.6.7.8:7001 to be the
primary address of 'oldHost', and add 'oldHost' to the addr hash table
under 5.6.7.8:7001.

But the "new" host from the incoming connection is already hashed on
the address hash table under 5.6.7.8:7001, so the
h_AddHostToAddrHashTable_r call in MultiProbeAlternateAddress_r fails.
Since we later delete the new duplicate host, this results in
5.6.7.8:7001 being the primary address for the host, but that address
is not anywhere in the address hash table.

This behavior can be seen by the following pair of FileLog messages:

Wed Feb  1 11:02:38 2012 CB: ProbeUuid for 0xdeadbeefdead (1.2.3.4:7001) failed -01
Wed Feb  1 11:02:38 2012 h_AddHostToAddrHashTable_r: refusing to hash host beefdeadbaadcafe (5.6.7.8:7001) already hashed

While those message do not necessarily indicate this problem, this
problem will result in those messages.

To fix this, mark the duplicate host as HOSTDELETED before we do any
probing on 'oldHost'. This way, if MultiProbeAlternateAddress_r tries
to add 'oldHost' to the addr hash table under 5.6.7.8:7001, it will be
able to do so successfully, since the old duplicate host is deleted.

Change-Id: Id3aaab0718425492dca1deba892725160677b85f
Reviewed-on: http://gerrit.openafs.org/6726
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agovos: allow releases without offline time
Derrick Brashear [Tue, 13 Dec 2011 17:46:36 +0000]
vos: allow releases without offline time

allow releases using dumps to clones to avoid offline time

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

8 years agovos: refactor code
Derrick Brashear [Tue, 13 Dec 2011 17:29:30 +0000]
vos: refactor code

change vos to remove lots of duplicated code for volume deletes and clones

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

8 years agoRx: Avoid lastBusy/PEER_BUSY discrepancy
Andrew Deason [Mon, 13 Feb 2012 20:11:36 +0000]
Rx: Avoid lastBusy/PEER_BUSY discrepancy

If an rx call has the RX_CALL_PEER_BUSY flag set, but the call's
conn->lastBusy is not set, we can easily cause an rx caller to loop
infinitely. rx_NewCall will see that lastBusy for a call channel is
not set, and will use that call channel, but rxi_CheckBusy will note
that the call appears busy and that there are non-busy call channels
on the same conn, and so will return RX_CALL_BUSY.

This can currently happen in rxi_ResetCall, since we set
RX_CALL_PEER_BUSY on the call again if the call had that flag set when
rxi_ResetCall was called. If we are calling rxi_ResetCall with
'newcall' set, the passed in call is unrelated to the new call, since
it was obtained from the free list. Thus, the busy-ness of the call
should be ignored. Fix this by only paying attention to the incoming
RX_CALL_PEER_BUSY flag if 'newcall' is not set.

Also prevent this from happening by clearing RX_CALL_PEER_BUSY in
rx_NewCall when we select a call and clear lastBusy for that call.

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

8 years agovol: allow clones of readonly volumes
Derrick Brashear [Tue, 13 Dec 2011 17:00:52 +0000]
vol: allow clones of readonly volumes

allow writing of data where it's not user data we're changing
(e.g. allow a vnode to be marked cloned in the vnode index)

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

8 years agovolser: allow clonevol purge id to be new id
Derrick Brashear [Tue, 13 Dec 2011 16:24:16 +0000]
volser: allow clonevol purge id to be new id

effectively the same functionality that reclone already uses, but
for some reason we artificially limit it out of clone despite
the interface being there for it. it used to be there. put it back.

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

8 years agovolser: allow cloning non-rw volumes
Derrick Brashear [Tue, 13 Dec 2011 16:22:38 +0000]
volser: allow cloning non-rw volumes

remove EROFS error which is the only thing preventing a working clone
on a non-RW.

Change-Id: Ic3d4d07519188712e9a38267fc74ebd1eaef7d8a
Reviewed-on: http://gerrit.openafs.org/6249
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

8 years agoWindows: Dereg Lanman and Lsa reg values for afsredir
Jeffrey Altman [Sun, 19 Feb 2012 00:57:25 +0000]
Windows: Dereg Lanman and Lsa reg values for afsredir

If the machine has been upgraded from an AFS SMB Server to the
AFS Redirector, the registry will have leftover configuration
for the "AFS" netbios name in the Lsa BackConnectionHostNames
value and the LanmanWorkstation ReconnectableServers and
ServersWithExtendedSessTimeout values.   These values are not
useful with the AFS Redirector since \\AFS is owned by afsredir.sys
and not the SMB redirector.  Remove the "AFS" netbios name from
these values when afsd_service.exe has started in redirector mode.

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

8 years agodoc: replace hostnames with IETF example hostnames
Ken Dreyer [Sat, 11 Feb 2012 16:43:30 +0000]
doc: replace hostnames with IETF example hostnames

There were several different real and made-up hostnames and company names used
throughout our documentation examples.

The IETF has reserved "example.com" and other "example" TLDs for use in
examples (RFC 2606). Replace almost all references to ABC Corporation, DEF
Corporation, and State University, as well as "abc.com", "bigcell.com",
"def.com", "def.gov", "ghi.com", "ghi.gov", "jkl.com", "mit.edu",
"stanford.edu", "state.edu", "stateu.edu", "uncc.edu", and "xyz.com".
Standardize on "Example Corporation", "Example Network", "Example
Organization" (example.com, example.net, and example.org).

The Scout documentation in the Admin Guide contains PNG images that contain
the old cell names, so I left those references until the images can be
replaced.

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

8 years agoWindows: Explorer Shell Set Unix Mode bits
Jeffrey Altman [Sat, 18 Feb 2012 03:21:00 +0000]
Windows: Explorer Shell Set Unix Mode bits

The Unix Mode bits were not being saved.  This patch permits
them to be saved.

FIXES 130572

Change-Id: I6bf96c04115ee0f01e84b44b9efaacb578d95cbc
(cherry picked from commit 534d95ef90ac5e5ebf5deb227008e0b023e7ef8b)
Reviewed-on: http://gerrit.openafs.org/6734
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 unnecessary DirectoryEnumEvent
Jeffrey Altman [Fri, 17 Feb 2012 15:37:34 +0000]
Windows: remove unnecessary DirectoryEnumEvent

The DirectoryEnumEvent is not required to implement:

  AFSSetEnumerationEvent
  AFSClearEnumerationEvent
  AFSIsEnumerationInProgress

The DirectoryEnumCount is modified by interlocked operations
and can be used as a marker for when an enumeration is in progress.

Change-Id: I414ce2bc753b0fd60a3fac51c2cf3d264a32ab05
Reviewed-on: http://gerrit.openafs.org/6725
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: VolumeCB->ObjectInfoTree.TreeLock Deadlock
Jeffrey Altman [Fri, 17 Feb 2012 04:50:18 +0000]
Windows: VolumeCB->ObjectInfoTree.TreeLock Deadlock

AFSPrimaryVolumeWorkerThread held the VolumeCB->ObjectInfoTree.TreeLock
exclusively across calls to AFSCleanupFcb() which in turn triggers
a file extent release to the service which can in turn result in
an object invalidation.  Processing the invalidation requires shared
access to VolumeCB->ObjectInfoTree.TreeLock which results in a deadlock.

This patch alters the processing of AFSPrimaryVolumeWorkerThread
so that the VolumeCB->ObjectInfoTree.TreeLock is not held across
the AFSCleanupFcb() calls.

FIXES 130431

Change-Id: I3726df02ab47d2dcc83a32c75957a5dafcfbf20e
Reviewed-on: http://gerrit.openafs.org/6724
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 agovolinfo: initialize vnode details
Michael Meffie [Thu, 16 Feb 2012 15:58:50 +0000]
volinfo: initialize vnode details

Clear the vnode details object. Fixes the path lookup in volscan.

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

8 years agolibafs: kill rxevent daemon even in upcall mode
Derrick Brashear [Mon, 13 Feb 2012 21:11:19 +0000]
libafs: kill rxevent daemon even in upcall mode

the switch from rxk listener env to upcall env could leave the event
daemon running. fix that.

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

8 years agodoc: refer to aklog instead of klog
Ken Dreyer [Thu, 16 Feb 2012 03:12:56 +0000]
doc: refer to aklog instead of klog

klog (and kaserver) is deprecated. In generic examples, refer to the Kerberos
5 equivalents.

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

8 years agoWindows: disable afsdhook.dll reload by daemon
Jeffrey Altman [Wed, 15 Feb 2012 05:06:47 +0000]
Windows: disable afsdhook.dll reload by daemon

The daemon thread's loading and unloading of afsdhook.dll every
second prevents the disk drive from sleeping and forces a search
of the PATH.   Make the periodic reloading configurable and
disable it by default.

Change-Id: I7e1a5b2bc7e1c4d4ea39fc30cf34c1195a326ed2
Reviewed-on: http://gerrit.openafs.org/6715
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 install9x rules
Jeffrey Altman [Wed, 15 Feb 2012 02:52:28 +0000]
Windows: remove install9x rules

Change-Id: I293f982d0f1466fd9bf213db055eedafc3c79977
Reviewed-on: http://gerrit.openafs.org/6712
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 AFS_WIN95_ENV
Jeffrey Altman [Tue, 14 Feb 2012 21:02:02 +0000]
Windows: remove AFS_WIN95_ENV

No longer build for Win9x.  Remove AFS_WIN95_ENV conditionals.

Change-Id: I7082017a3aaa9a30723549974c4d8af50025b923
Reviewed-on: http://gerrit.openafs.org/6711
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 KTC_TOKEN_MUTEX_FAIL error code
Jeffrey Altman [Tue, 14 Feb 2012 20:35:07 +0000]
Windows: add KTC_TOKEN_MUTEX_FAIL error code

If acquisition of the Global\AFS_KTC_Mutex fails, return a
different error code from a pioctl failure since the pioctl
was never issued.

Change-Id: I001227f87e97a06bf419c68d6579843e4f93f032
Reviewed-on: http://gerrit.openafs.org/6710
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 GetComputerNameW call for all ioctl
Jeffrey Altman [Tue, 14 Feb 2012 17:01:38 +0000]
Windows: avoid GetComputerNameW call for all ioctl

Cache the value of GetComputerNameW() to avoid repeated calls
for each and every redirector ioctl request.

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

8 years agoRedHat: Fail openafs-client 'stop' on rmmod error
Andrew Deason [Wed, 8 Feb 2012 22:03:29 +0000]
RedHat: Fail openafs-client 'stop' on rmmod error

Currently, the openafs-client RPM init script ignores any error
reported by rmmod. If 'umount /afs' succeeds but rmmod does not, the
client may panic the machine if the client is started again (from e.g.
running the 'restart' init script method), since afsd will try to
initialize AFS with a libafs that has been shut down.

So, do not ignore errors from 'rmmod', and instead fail the 'stop'
method from the init script if we get an error.

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

8 years agodoc: fix AdminGuide
Jeffrey Altman [Sun, 12 Feb 2012 03:14:23 +0000]
doc: fix AdminGuide

The AdminGuide was broken by e99224f2fe049bc339e87c8b6c195de67dca2f08.

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

8 years agoWindows: default cell grand.central.org
Jeffrey Altman [Sat, 11 Feb 2012 22:31:00 +0000]
Windows: default cell grand.central.org

Change the default cell from openafs.org to grand.central.org
since there is no openafs.org cell.  All openafs software is
distributed from the grand.central.org cell.

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

8 years agoWindows: reset version to 0.0.0 on master
Jeffrey Altman [Sat, 11 Feb 2012 22:29:51 +0000]
Windows: reset version to 0.0.0 on master

Master does not track a particular version number.
For Windows builds on master, reset the version to
0.0.0 so that the builds are not confused with the actual
1.5.7600.

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

8 years agoWindows: AFSRemoveFcb() cannot race
Jeffrey Altman [Sat, 11 Feb 2012 17:49:33 +0000]
Windows: AFSRemoveFcb() cannot race

Modify AFSRemoveFcb to use InterlockedComparePointerExchange
to ensure that only one thread can remove and deallocate an
AFSFcb structure.

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

8 years agodoc: add section on direct volume access
Ken Dreyer [Fri, 10 Feb 2012 00:37:01 +0000]
doc: add section on direct volume access

Provide examples of the direct volume access syntax, using the
fictitious example.com cell.

Change-Id: Ia2ea592531e29f6b744d0bd6993d598d78a799c4
Reviewed-on: http://gerrit.openafs.org/6691
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: Perform rename to self check earlier
Jeffrey Altman [Fri, 10 Feb 2012 13:56:12 +0000]
Windows: Perform rename to self check earlier

In AFSSetRenameInfo(), the rename to itself check was performed
after the name collision check.  Move the check earlier in the
routine to ensure that we catch the no-op before any real work
is done.

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

8 years agoviced: Keep H_LOCK while locking host in h_Alloc_r
Andrew Deason [Tue, 20 Dec 2011 22:44:42 +0000]
viced: Keep H_LOCK while locking host in h_Alloc_r

Currently in h_Alloc_r, we h_Lock_r the host, so we have it locked on
return. However, h_Lock_r drops the host glock, which is bad in this
situation since we have already added the host to the global hash
table, so other threads may see it. This can mean that by the time
h_Alloc_r returns, the returned host may have HOSTDELETED set, and/or
the addresses associated with the host may be completely different.

h_Alloc_r's caller, h_GetHost_r, seems to assume that the host is
still associated with the address of the passed-in connection. When
this is not true, this can result in the host structure getting into a
strange state, such as the primary addr/port may not be hashed. The
host may also have HOSTDELETED set, in which case we're not supposed
to be dealing with it at all.

To avoid these problems, lock host->lock directly in h_Alloc_r,
without going through h_Lock_r and dropping H_LOCK. Also do it as one
of the first things we do to initialize the host, just to make sure
that if anybody else happens to see the host, it is locked by us when
they do.

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

8 years agoviced: Allow null host for BreakCallBack
Marc Dionne [Sun, 22 Jan 2012 14:45:22 +0000]
viced: Allow null host for BreakCallBack

For replication writes at the remote site, we will want to call
this without a host structure.

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

8 years agolibafsauthent, tvolser: fix objdir build
Jonathan A. Kollasch [Tue, 7 Feb 2012 21:23:23 +0000]
libafsauthent, tvolser: fix objdir build

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

8 years agoWindows: Release Notes corrections
Jeffrey Altman [Tue, 7 Feb 2012 20:56:12 +0000]
Windows: Release Notes corrections

Add missing BlockSize registry value

Correct AFSRedirector\NetworkProvider registry key description

Add note that LanAdapter value is ignored if SMB mode is not in use.

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

8 years agoWindows: OpenAFS reparse points are surrogates
Jeffrey Altman [Mon, 6 Feb 2012 17:00:58 +0000]
Windows: OpenAFS reparse points are surrogates

OpenAFS reparse points represent mount points, symlinks, and dfs
referrals.  All of which are file system objects that represent
another named entity in the system.  As a result the reparse tag
field must include the Reparse Tag Surrogate bit (0x20000000) set.

This permits the IsReparseTagNameSurrogate() macro provided in
winnt.h to be used to determine if the reparse point is a surrogate
or not.

See
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365197%28v=vs.85%29.aspx

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

8 years agoRW Replication: Add basic definitions
Marc Dionne [Wed, 18 Jan 2012 19:04:28 +0000]
RW Replication: Add basic definitions

Add some basic definitions that will be needed to handle RW
replicas.

A new volume type RWREPL is added.  Replicas will share the same
volume ID as the RW volume, so the array of volume IDs by volume
type is unchanged, as is the VLDB entry format.

A new flag bit ITSRWREPL/VLSF_RWREPLICA for serverFlags identifies
RW replica sites in VLDB entries.

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

8 years agovol: remove OPENAFS_VOL_STATS
Marc Dionne [Tue, 4 Oct 2011 21:47:48 +0000]
vol: remove OPENAFS_VOL_STATS

OPENAFS_VOL_STATS has been unconditionally defined since the IBM days.
Adjust the code to assume it is set.

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

8 years agoDisable kernel opt by default on Solaris 10 and 11
Andrew Deason [Mon, 6 Feb 2012 19:23:41 +0000]
Disable kernel opt by default on Solaris 10 and 11

With newer Solaris Studio (sometime in the 12.* series), cc started
adding SSE instructions to optimized x86 code, which is invalid for
kernel code and can generate panics. There appears to be no way to
turn this off currently (-xvector=%none is non-functional), so default
to not optimizing kernel code.

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

8 years agoRx: Add missing rx_packet.h includes
Andrew Deason [Fri, 3 Feb 2012 22:06:16 +0000]
Rx: Add missing rx_packet.h includes

We no longer include rx_packet.h from rx.h, so rx_kcommon.h was not
picking up some packet-related definitions. Some files
(SOLARIS/rx_knet.c, IRIX/rx_knet.c) were using packet-related defines
(e.g. RX_HEADER_SIZE) while just including rx_kcommon.h. Include
rx_packet.h in those files to get the relevant definitions.

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

8 years agoSOLARIS: Use kcred instead of afs_osi_cred
Andrew Deason [Thu, 2 Feb 2012 23:35:52 +0000]
SOLARIS: Use kcred instead of afs_osi_cred

For many vfs ops to the cache, we currently pass &afs_osi_cred for our
credentials, which is a mostly zeroed-out credential structure. In
some modern versions of Solaris (Solaris 11), at least some parts of
this structure need to not be NULL (cr_zone), or we will panic.

The Solaris kernel provides a 'kcred' credentials structure for the
purpose of using "kernel" credentials for i/o. So just use that
instead, since kcred has existed at least since Solaris 8.

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

8 years agoWindows: Avoid race during PIOCtl DirNode allocation
Jeffrey Altman [Sat, 4 Feb 2012 22:26:02 +0000]
Windows: Avoid race during PIOCtl DirNode allocation

Use InterlockedCompareExchangePointer to assign the DirNode to
ObjectInfo->Specific.Directory.PIOCtlDirectoryCB.  Otherwise,
one thread could race with another thread when allocating the
pioctl object.

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

8 years agoWindows: Hold Fcb references prior to service call
Jeffrey Altman [Sat, 4 Feb 2012 17:48:24 +0000]
Windows: Hold Fcb references prior to service call

If the Fcb reference count hits 0 while the service is called
it is possible that the Fcb can be garbage collected prior to
the completion of the call.

Change-Id: I32c3c5e3debb246fe63ac6f6cc5625b493ee47a9
Reviewed-on: http://gerrit.openafs.org/6660
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: Do not build NSIS by default
Jeffrey Altman [Sun, 5 Feb 2012 17:58:22 +0000]
Windows: Do not build NSIS by default

NSIS installers are no longer up to date and do not support 64-bit
builds.  OpenAFS no longer distributes them for 1.7 and beyond.
Stop building them by default.

Change-Id: I6b8c2b46ccc30654cfb4661c9bde50483bc99785
Reviewed-on: http://gerrit.openafs.org/6664
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 buf_InvalidateBuffers
Jeffrey Altman [Fri, 3 Feb 2012 16:35:33 +0000]
Windows: add buf_InvalidateBuffers

Add a utility function that invalidates all buffers for a
cm_scache_t object.

Change-Id: Ib10139fb2aefa03d597d5afd494652fade40432e
Reviewed-on: http://gerrit.openafs.org/6651
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: fix cm_DirOpDelBuffer assert
Jeffrey Altman [Fri, 3 Feb 2012 16:21:45 +0000]
Windows: fix cm_DirOpDelBuffer assert

In cm_DirOpDelBuffer() the data version field for a buffer
in cm_dirOp_t.buffers[] can be CM_BUF_VERSION_BAD if the buffer
was added to the buffer list but was never fetched from the file
server.  If the buffer was recycled by buf_Get() an attempt to
remove an entry from the directory will be failed as opposed to
fetching the buffer from the file server and performing the local
removal.

Change-Id: Id9af5180f2176c2a90ef9907ae84139e66ffe5d6
Reviewed-on: http://gerrit.openafs.org/6650
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: buffer DV ranges do not work for directories
Jeffrey Altman [Fri, 3 Feb 2012 16:17:40 +0000]
Windows: buffer DV ranges do not work for directories

In cm_MergeStatus, always set cm_scache_t.bufDataVersionLow
to the new data version because the cm_dir package does not
support version ranges.   All modified dir buffers have their
dataVersion field set to the current data version value.

Failure to update the bufDataVersionLow field can result in
B+ Trees being constructed from out of date directory information.

Change-Id: Ic6bb6f78275de9c6c7960f2fc7c06c507b1144c1
Reviewed-on: http://gerrit.openafs.org/6649
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: update btree debugging code
Jeffrey Altman [Fri, 3 Feb 2012 16:16:04 +0000]
Windows: update btree debugging code

B+Tree key strings were changed to wchars for unicode support,
the debugging printf format patterns were not updated to match.
Do so now.

Change-Id: I70619d2e3fbc007f3f21eaf56cc5d61503203818
Reviewed-on: http://gerrit.openafs.org/6648
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: Do not open file if shutdown in progress
Jeffrey Altman [Fri, 3 Feb 2012 16:14:50 +0000]
Windows: Do not open file if shutdown in progress

Perform the shutdown check earlier in AFSCommonCreate() to prevent
a request from being processed after the service indicates that
a shutdown has begun.

Change-Id: I8959141b5e2161ffe960e93a500b1153d9594a28
Reviewed-on: http://gerrit.openafs.org/6647
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 DebugFlags Turn on BugCheck
Jeffrey Altman [Wed, 1 Feb 2012 03:34:30 +0000]
Windows: AFSRedir DebugFlags Turn on BugCheck

Turn on bug checking by default via the installation.
This permits sites to disable the functionality but will allow
us to capture more meaningful minidump output.

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