Windows: Decrement Fcb OpenHandleCount while locked

AFSCleanup performs tests on the Fcb Open Handle Count to determine
when to perform final cleanup tasks on the last handle close.  The
test is protected by holding the Fcb Resource.  If the Open Handle
Count is decremented after dropping the Resource, it creates a
race with other threads that might be blocked entering AFSCleanup
to close their handle on the same object.

Change-Id: I0403d8aeafd736484728a25c5c48ab28e8b8a804
Reviewed-on: http://gerrit.openafs.org/8863
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: handle CM_ERROR_RETRY in cm_Analyze()

cm_Analyze() was not forcing a retry when it received CM_ERROR_RETRY.

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

Change-Id: Ifba4f0d54032bd9580c97e7a94d2550e49b1a1ac
Reviewed-on: http://gerrit.openafs.org/8950
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Update Bulk I/O Descriptor

Update the cm_bulkIO_t and associated functions such that
the 'reserved' field is no longer a boolean indicated whether
or not buffers have been reserved but instead becomes a count
of the number of buffers that have been reserved.

buf_TryReserveBuffers is modified to return an afs_uint64
count of the number of buffers reserved instead of a boolean.

cm_SetupStoreBIOD, cm_SetupFetchBIOD, and cm_ReleaseBIOD altered
to store the reserved buffer count and use it when freeing the
BIOD.

Prior to this change it was not possible to reserve a count other
than the number of buffers it takes to store one chunkSize of data.

Change-Id: I78d71c77ffddd7f34278314fcfe9ee568b835a8b
Reviewed-on: http://gerrit.openafs.org/8951
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: rename 'rbytes' to 'rxbytes' for clarity

Throughout cm_dcache.c, the various 'rbytes' represents the number
of bytes to be read from the next rx_Read or rx_Readv call.
Rename the variable to 'rxbytes' to improve clarity.

Change-Id: Iffd8dd397c0e6ab4cc44019b7f937a80f5d492d2
Reviewed-on: http://gerrit.openafs.org/8952
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
rx: atomic bit ops

Add rx_atomic_test_bit, rx_atomic_set_bit, and rx_atomic_clear_bit
to provide bitwise operations over atomic types. These allow the
use of atomic flag variables.

Uses native platform atomic operations wherever these are available,
otherwise falls back to our 'standard' MUTEX based implementation.

LICENSE BSD

Change-Id: I161631b2408e85f757ff04bf831a631ccb1f930d
Reviewed-on: http://gerrit.openafs.org/8936
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
libafsrpc: avoid more concurrent libtool

libtool gets confused if it is running two instances in the same
directory, so make sure we build libafsrpc.a after the other things
we already single-stream.

Change-Id: I4c26b5707fdb73319563b063b45eb40b7ca1457e
Reviewed-on: http://gerrit.openafs.org/9017
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Disable hard dead timeout for RDR File Server connections

The UNIX cache manager does not implement hard dead timeouts
on file server connections.  The Windows cache manager had to
because of the SMB connection timeout requirements.  For the
AFS redirector there is no timeout requirement.  Therefore,
when the SMB stack is disabled the Windows cache manager can
disable the hard dead timeout.

The idle dead timeouts are in place to cancel connections when
file servers stop replying with real data.

Change-Id: I44f77b78a52e7cac3a88a53830748b77f3ff4000
Reviewed-on: http://gerrit.openafs.org/8828
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
darwin: stop processing upcalls once rx shutdown starts

we have a chicken and egg. can't stop upcall without
killing socket; can't kill socket while rx might try to transmit on it.
cheat, and if rx is shut down, don't process things upcall receives.

FIXES 131577

Change-Id: I6b72f6e7aefb7937b768dcb9c0a83d0ee3317bfa
Reviewed-on: http://gerrit.openafs.org/8931
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
rx: convert rxinit_status to atomic

we don't need to use a lock just for this; switch to atomic and use that
to trigger configuration.

Change-Id: Ia96ec308dda51d1f6d13f290a23251c66665e499
Reviewed-on: http://gerrit.openafs.org/8930
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
fix some typos in bos_setrestricted

the real name of the command is: 'bos setrestricted'
it is sufficient to name 'bos install' only once

Change-Id: Ic68f7cb55466e1c92c34eeda37c0a64a11b7e4d8
Reviewed-on: http://gerrit.openafs.org/8990
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
rx: Fix AIX test_and_set_bit

The AIX definition of rx_atomic_test_and_set_bit had its test the
wrong way round - so an already set bit would return false, and a clear
bit would return true. Fix this.

Change-Id: I7778c411016bca53b38257fca59ae0f7aaad64ae
Reviewed-on: http://gerrit.openafs.org/9021
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
auth: Permit NULL fallback in localauth case

Allow the caller of afsconf_PickClientSecObj to specify both
local authentication, and to request fallback to null authentication
if local auth isn't available.

Change-Id: Ib3b801bfde3f32b4cb9cdc7c08a3d8ab985c080f
Reviewed-on: http://gerrit.openafs.org/9022
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
tests: Don't use libafsauthent

Use liboafs_auth.la directly, rather than using libafsauthent, to
build the auth tests

Change-Id: Idf0e7a32626802b6113d21833ded09d9e20e3659
Reviewed-on: http://gerrit.openafs.org/9023
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
vlclient: add -probe option

Add a new option to the vlclient test program to call the
probe server RPC to ping the vlservers in a cell. Uses a multi
rx call to do the probes in parallel.

The existing -host option can be used to ping a single
vlserver.

Change-Id: I25666b7ff139ae43364ac04869b14997f3ed0d53
Reviewed-on: http://gerrit.openafs.org/8911
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
windows: Update raw fetch/store operations

rawops.c is a hold over from Eric Williams' original attempt
to implement an AFS redirector.  When the rest of the his code
was purged from the tree and replaced with a more complete
implementation based upon the Kernel Drivers's File System
framework rawops.c was left behind.

Although the source file has been compiled as part of the build,
its functions ReadData and WriteData have never been called.  This
patchset:

 1. renames the functions to raw_ReadData and raw_WriteData

 2. modifies the function signatures and provides a header
    with prototypes

 3. requires that cm_scache.rw be write-locked upon entry

 4. renames variables

 5. removes the #define CM_BUF_BUFSIZE and relies upon
    cm_data.blockSize instead

 6. Always write back the current range as an async store
    instead of the previous chunk as random write patterns
    will fail to store all of the dirty buffers.

Change-Id: I1594b2950ab14da0c0de2a382fd1ba8248a9d1c6
Reviewed-on: http://gerrit.openafs.org/8953
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Reduce RDR Object Lifetime

Adjust the redirector object lifetime from 10 minutes (600 seconds)
to 20 seconds.  The object lifetime is how long an object can remain
idle before garbage collection is permitted.

Change-Id: I8db89bfb0ccd40e9295dcbb30fbc2c96813d9fc9
Reviewed-on: http://gerrit.openafs.org/8954
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: AFS_SUBSYSTEM_OBJECT_REF_COUNTING fixes

A large number of trace messages monitoring ObjectInformationCB
reference counting were categorized under AFS_SUBSYSTEM_FCB_REF_COUNTING
instead of AFS_SUBSYSTEM_OBJECT_REF_COUNTING.  This patchset applies
the correct subsystem category.

Change-Id: I6c309b42b3d679f961d82c1a975d84122c9275f9
Reviewed-on: http://gerrit.openafs.org/8955
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Categorize ObjectInformationCB RefCnts

To assist in tracking down the source of ObjectInformationCB
overcounts and undercounts, add an advisory array which tracks
the reference counts by category.  In the procress ensure that
all reference count changes are logged by tracing.

Change-Id: I813cd0af5e12e36ba9863577dbd35abef6339414
Reviewed-on: http://gerrit.openafs.org/8956
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: Move VolumeWorkerContext to NonPaged pool

The VolumeWorkerContext contains a KEVENT which must be allocated
from the NonPaged pool.  Move it to the AFSNonPagedVolumeCB struct.

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