openafs.git
10 years agosalvaged: Clean up command line parsing
Marc Dionne [Thu, 25 Apr 2013 14:50:11 +0000]
salvaged: Clean up command line parsing

Clean up the command line parsing in the salvage daemon by making
better use of the cmd library and avoiding hard coded offsets.

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

10 years agovolser: Add -config and -logfile options
Marc Dionne [Thu, 25 Apr 2013 12:57:27 +0000]
volser: Add -config and -logfile options

Add options to specify alternate locations for the configuration
files and the log file.  This will be helpful for testing.

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

10 years agovolser: Convert command line parsing to cmd
Marc Dionne [Wed, 24 Apr 2013 17:25:36 +0000]
volser: Convert command line parsing to cmd

Convert argument parsing to use the cmd library.

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

10 years agoWindows: Protect against cm_GetVolServerList failures
Jeffrey Altman [Sat, 1 Jun 2013 04:48:51 +0000]
Windows: Protect against cm_GetVolServerList failures

In cm_Analyze, if cm_GetVolServerList() fails volServerpp will be
NULL which will trigger an exception if passed to either
cm_SetServerBusyStatus or cm_ResetServerBusyStatus.

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

10 years agotests: Improve afstest_UnlinkTestConfig cleanup
Marc Dionne [Wed, 3 Apr 2013 20:09:53 +0000]
tests: Improve afstest_UnlinkTestConfig cleanup

Make afstest_UnlinkTestConfig clean up and remove the specified
directory regardless of which files are present.  This means
the function no longer has to track the current state of which
files may be present as tests are added and modified.

A sanity check is added to prevent damage in case the function is
called for an inappropriate directory.

As before, no cleaning is done if the test is run outside of a
"make check".

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

10 years agoApply cast from cfc9b348 to the else clause
Ben Kaduk [Tue, 7 May 2013 03:03:42 +0000]
Apply cast from cfc9b348 to the else clause

Clang on FreeBSD complains about format string mismatch as well.

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

10 years agoLinux: Fix tmpfs cache support
Marc Dionne [Wed, 22 May 2013 13:26:57 +0000]
Linux: Fix tmpfs cache support

As of kernel 3.1, tmpfs no longer has a readpage() operation in its
address space operations.  Some of the cache manager code relies on
this, causing an oops if tmpfs is used as backing store for the
cache.

As a minimal fix, detect that there is no readpage() and disable
the optimizations that depend on it.

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

10 years agocacheout: Add -encrypt option
Andrew Deason [Fri, 24 May 2013 19:02:11 +0000]
cacheout: Add -encrypt option

Add the -encrypt option to cacheout, for forcing communication with
servers over encrypted channels.

Change-Id: I1a2a9faf2fb72238102b018b7692a6691a7c0054
Reviewed-on: http://gerrit.openafs.org/9941
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoWindows: cm_DumpServers "down" is string not enum
Jeffrey Altman [Tue, 28 May 2013 15:40:12 +0000]
Windows: cm_DumpServers "down" is string not enum

When dumping the state of the servers, "down" is a string not an
enum value.

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

10 years agoLinux 3.10: Include linux/aio.h directly
Marc Dionne [Wed, 15 May 2013 19:19:22 +0000]
Linux 3.10: Include linux/aio.h directly

This file needs bits from linux/aio.h, but gets them indirectly
from the inclusion of aio.h by sched.h.  That gets removed for
Linux 3.10.

Since this header is not of general interest elsewhere, just include
it directly here.

Change-Id: I432bde282a1c5425ba6780bca28e308bf70a79e7
Reviewed-on: http://gerrit.openafs.org/9912
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

10 years agovol: return VNOVNODE if vnode is not allocated
Jeffrey Altman [Mon, 13 May 2013 10:45:34 +0000]
vol: return VNOVNODE if vnode is not allocated

If a request for a vnode fails because the vnode is not allocated
within the volume, the error returned to the client should be VNOVNODE to
indicate that the requested FID does not exist and not VIO indicating a
transient disk i/o error or other transient internal inconsistency.

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

10 years agoSort all libtool symbol lists
Simon Wilkinson [Sat, 11 May 2013 19:20:38 +0000]
Sort all libtool symbol lists

The original plan for the libtool symbol lists was that they be in
alphabetical order. This should make them easier to maintain, as it
becomes harder to accidentaly introduce duplicates, and makes merge
conflicts when adding new symbols less likely.

However, not all of them are properly sorted. Update the ones that
aren't. This was done with

    for A in `find . -name *.la.sym`; do sort $A -o $A; done

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

10 years agolibafs: fix Afs_syscall definition for UKERNEL
Marc Dionne [Wed, 6 Mar 2013 00:38:34 +0000]
libafs: fix Afs_syscall definition for UKERNEL

For the UKERNEL case, Afs_syscall is prototyped and used as (void).
Make the function definition use the void keyword to avoid a warning
about an old style definition.

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

10 years agovolser: -log restore operations
Michael Meffie [Mon, 20 May 2013 15:32:04 +0000]
volser: -log restore operations

Add vos restore to the list of operations which are logged
when the volserver is running with the -log option. Example
log line:

    admin on 172.16.50.141 is executing Restore 536870969

Change-Id: Ia6eb07258831865dfe2c85d1b9df078f33c4b640
Reviewed-on: http://gerrit.openafs.org/9926
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoRemove kauth from libuafs
Chaskiel Grundman [Thu, 9 May 2013 14:43:36 +0000]
Remove kauth from libuafs

Remove the uafs_klog() apis from afs_usrops. Nothing uses it except
the obsolete afsweb stuff that isn't built anymore.

Stop linking in all kauth and pts components. Also remove some other
objects from libauth, rxkad, and com_err, that were only present as
dependencies of kauth and pts components

Change-Id: Idf83b3dd1098e874d90244fe72609666b13216a4
Reviewed-on: http://gerrit.openafs.org/9887
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoman-pages: build bos getrestricted / setrestricted
Jeffrey Altman [Mon, 27 May 2013 20:15:19 +0000]
man-pages: build bos getrestricted / setrestricted

build missing bos man pages on windows.

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

10 years agoLinux 3.10: Replace create_proc_entry() with proc_create()
Marc Dionne [Tue, 7 May 2013 00:20:07 +0000]
Linux 3.10: Replace create_proc_entry() with proc_create()

Add an afs_proc_create() compat function that uses the
appropriate kernel function based on a configure test.

Change-Id: I4f3929849af032f2a483bc06bc5769f64085f1c4
Reviewed-on: http://gerrit.openafs.org/9854
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agovolser: Adjust TLV tag range
Marc Dionne [Sat, 25 May 2013 14:43:45 +0000]
volser: Adjust TLV tag range

Tag values up to D_MAX cannot be used as TLV tags, as the parsing
logic assumes anything up to D_MAX is a control tag.  Adjust
MIN_TLV_TAG to 21 so that the TLV range sits just above D_MAX.

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

10 years agolinux: remove linux osi_alloc hash stats
Dan van der Ster [Fri, 24 May 2013 08:12:14 +0000]
linux: remove linux osi_alloc hash stats

The bucket stat vector is maintained but never read. And it is
occasionally annoying since it can flood messages with
"afs_get_hash_stats: Warning! exceeded max bucket len ..."
Remove it.

Change-Id: Ibc2101c038e40c9ff6ab0401c89fd41af75ed831
Reviewed-on: http://gerrit.openafs.org/9937
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: Return bytes_read count from cm_GetData
Jeffrey Altman [Thu, 23 May 2013 20:57:21 +0000]
Windows: Return bytes_read count from cm_GetData

The existing interface for cm_GetData takes an input buffer and
a buffer size and no method by which the number of bytes read into
the buffer can be returned.  Add an output parameter to permit it.

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

10 years agoDAFS: Avoid useless attach2 error message
Andrew Deason [Mon, 13 May 2013 20:33:42 +0000]
DAFS: Avoid useless attach2 error message

Since commit 53230846a202a50f6c3a61b38d62ccba8876f89d, attach2 logs an
error when we force a volume to an error state due to attachment
errors. This is to ensure that we never end up with a volume in an
error state without logging a message about it.

However, while this is useful for the fileserver, for non-fileserver
programs this situation is very common for VNOVOL errors and does not
represent an actual problem. For the fileserver, nonexistent volumes
should be caught before we hit attach2 (in e.g. GetVolume when we
can't find a volume structure), so errors here can be significant and
should be rare. But for e.g. the volserver, when we try to use a given
volume id, we just try to attach it directly, so if the volume doesn't
exist, we will hit this code path.

This can happen pretty often for the volserver, since many volume
operations try to determine if a volume already exists by trying to
attach it. In those cases, this error message is pretty much useless
noise. So, get rid of it if we are non-fileserver, and the error we
got is VNOVOL. It is not as important for non-fileserver that we put a
volume in an error state, since volume states are much more transient
for non-fileserver programs, since the volume structs don't stay
around very long.

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

10 years agovldb_check: print vlentry file offsets
Michael Meffie [Mon, 13 May 2013 17:59:50 +0000]
vldb_check: print vlentry file offsets

To aid in debugging, consistently print the vlentry database "address"
and the file offset when displaying errors for vlentries.  Print the
vlentry file offsets when printing all the entries with the -entries
option.

Change-Id: I3ef37e6654280f0cff9b2449da29aebe7c5e3aad
Reviewed-on: http://gerrit.openafs.org/9906
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agovldb_check: cope with broken names and volids
Michael Meffie [Mon, 13 May 2013 17:47:06 +0000]
vldb_check: cope with broken names and volids

Fix-up broken vlentry names and rw volid so entries can be looked
up in the vlserver and can be deleted with vos delentry if needed.

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

10 years agolinux: Fix leaked dentry reference in the revalidate op
Marc Dionne [Wed, 24 Apr 2013 13:11:09 +0000]
linux: Fix leaked dentry reference in the revalidate op

In one error case, we exit the function without release the
reference on the parent dentry.  This dangling reference can cause
an oops when the client is shut down.

Change-Id: I1632b581f6e7a557bb54a999dc1837c31b8381bf
Reviewed-on: http://gerrit.openafs.org/9802
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoroken: export rk_vasprintf
Jeffrey Altman [Wed, 15 May 2013 19:37:39 +0000]
roken: export rk_vasprintf

missing on windows

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

10 years agoWindows: Protect against infinite VIO retries
Jeffrey Altman [Fri, 17 May 2013 16:06:00 +0000]
Windows: Protect against infinite VIO retries

Keep track of the number of VIO errors reported by the file servers.
If the count exceeds 100, abandon the request.

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

10 years agoWindows: AFSNameArrayClone leak in AFSCommonCreate
Jeffrey Altman [Thu, 16 May 2013 19:47:11 +0000]
Windows: AFSNameArrayClone leak in AFSCommonCreate

Do not leak the AFSNameArrayClone if AFSLocateName fails.

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

10 years agoWindows: remove unused and leaked uniRootFileNameClone
Jeffrey Altman [Thu, 16 May 2013 10:47:13 +0000]
Windows: remove unused and leaked uniRootFileNameClone

In AFSCommonCreate remove the allocated but never used but leaked
'uniRootFileNameClone' Unicode string.

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

10 years agoWindows: NotifyHardLink avoid null ptr reference
Jeffrey Altman [Mon, 13 May 2013 14:09:11 +0000]
Windows: NotifyHardLink avoid null ptr reference

In AFSNotifyHardLink, if the TargetDirectoryCB out parameter is non-NULL
but pDirNode is NULL, do not attempt to increment the
DirOpenReferenceCount because doing so will trigger an exception.

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

10 years agoWindows: Fix trace msg typo in AFSDeleteDirEntry
Jeffrey Altman [Tue, 9 Apr 2013 16:26:31 +0000]
Windows: Fix trace msg typo in AFSDeleteDirEntry

The name of the function in the trace messages is wrong.

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

10 years agoLinux: osi_TryEvictVCache: Don’t skip the first dentry if D_ALIAS_IS_HLIST
Anders Kaseorg [Tue, 7 May 2013 04:27:33 +0000]
Linux: osi_TryEvictVCache: Don’t skip the first dentry if D_ALIAS_IS_HLIST

An hlist doesn’t begin with a sentinel like a list does, so the old
code would skip the first dentry or crash with a NULL dereference if
there wasn’t one.  Use the kernel’s list_for_each_entry or
hlist_for_each_entry macros instead of trying to do it manually.

Should fix a crash observed by Alex Chernyakhovsky on kernel 3.6 and
newer.

Change-Id: I6d7bd190013a0250ca896af8d5182df55a3376b0
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/9857
Reviewed-by: Alex Chernyakhovsky <achernya@mit.edu>
Tested-by: Alex Chernyakhovsky <achernya@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agopt_util: gcc warning fix
Derrick Brashear [Wed, 1 May 2013 19:59:41 +0000]
pt_util: gcc warning fix

it's claimed these are not initialized before use.
squelch compiler errors. has to be in parent as otherwise
we will zero them in our loop where we potentially want the
parent group id, which is not on "this" line as we add members.

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

10 years agopt_util: be admin
Derrick Brashear [Wed, 1 May 2013 19:58:50 +0000]
pt_util: be admin

cheat and use the noauth flag so we pass the admin checks

Change-Id: Ie064db4fb930529fe474317d096238c915d1ef5b
Reviewed-on: http://gerrit.openafs.org/9839
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: AFSCleanup move CCb access inside try block
Jeffrey Altman [Fri, 10 May 2013 01:48:16 +0000]
Windows: AFSCleanup move CCb access inside try block

A crash dump was examined which showed a deadlock due to the leak
of a SectionObjectResource in a code path in which the holding thread
could not have obtained it.  The FileObject->FsContext2 (Ccb) pointer
referred to invalid memory which may have been due to pool corruption.
The only code path in which the SectionObjectResource is held exclusive
and then the Ccb pointer is used outside of a try-except block is in
AFSCleanup().  Move this reference inside the try-except block just in
case.  If the Ccb is invalid, at least this way AFSRedirLib will catch
the exception and free the SectionObjectResource before continuing.

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

10 years agoWindows: AFSClose Set FsContext* to NULL
Jeffrey Altman [Thu, 9 May 2013 22:31:19 +0000]
Windows: AFSClose Set FsContext* to NULL

After the Fcb OpenReferenceCount is decremented it is no longer
safe for the Fcb pointer to be referenced.  Set FsContext to NULL.

After the AFSRemoveCcb() call, it is no longer safe to reference
the Ccb pointer.  Set FsContext2 to NULL.

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

10 years agoWindows: AFSClose remove dead code
Jeffrey Altman [Thu, 9 May 2013 22:30:42 +0000]
Windows: AFSClose remove dead code

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

10 years agoWindows: AFSCommonWrite do not leak SectionObjectResource
Jeffrey Altman [Thu, 9 May 2013 22:28:09 +0000]
Windows: AFSCommonWrite do not leak SectionObjectResource

If the write request is neither an extending write nor a non-cached
write and (liStartingByte.QuadPart + ulByteCount) >=
pFcb->Header.FileSize.QuadPart, then the SectionObjectResource pointer
will be leaked.  Instead release it before retrying.

Change-Id: Id1ea7a3829a6e2be19280f366e665a11e14fba62
Reviewed-on: http://gerrit.openafs.org/9888
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoubik: Avoid use of freed string
Marc Dionne [Thu, 9 May 2013 16:30:39 +0000]
ubik: Avoid use of freed string

If cellName was just set to dir->cellName, afsconf_Close() will
free the string before fprintf uses it.  Just change the order
so we don't access freed memory and print garbage.

Change-Id: I66792dc50addf2d8242f71923db09fcc178cc450
Reviewed-on: http://gerrit.openafs.org/9886
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: RDR_GetVolumeInfo do not always return success
Jeffrey Altman [Wed, 8 May 2013 18:10:01 +0000]
Windows: RDR_GetVolumeInfo do not always return success

If the call failed because all servers are down or all instances
of the volume are offline or busy, tell the caller.  Do not return
fake data.

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

10 years agoWindows: cm_Analyze if no retry don't sleep
Jeffrey Altman [Wed, 8 May 2013 18:08:59 +0000]
Windows: cm_Analyze if no retry don't sleep

If error handling response is not going to result in a retry of the
call, do not sleep.

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

10 years agoWindows: only retry ALLBUSY for five minutes
Jeffrey Altman [Wed, 8 May 2013 17:08:30 +0000]
Windows: only retry ALLBUSY for five minutes

Add a volbusyCount field to cm_req_t.  Increment the count each time
CM_ERROR_ALLBUSY is processed by cm_Analyze for a given request.
Wait 15 seconds between retries and retry up to 20 times and then
fail.  This prevents requests from blocking for a volume that isn't
going to come back online for hours.

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

10 years agoFreeBSD: VOP_MMAP has been dead since 1996
Ben Kaduk [Thu, 28 Mar 2013 21:10:29 +0000]
FreeBSD: VOP_MMAP has been dead since 1996

Clang complains that our (K&R!) declaration of struct vop_mmap_args
will only be visible within the (empty) function.
With the kernel's CFLAGS, though, this is fatal.
Remove the dead code.

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

10 years agoWindows: Release Notes updates
Jeffrey Altman [Wed, 8 May 2013 01:50:40 +0000]
Windows: Release Notes updates

Document ReparsePointPolicy registry value.

Document known Explorer Shell Paste bug.

Update ShortNames registry value.

Document Cygwin 1.7.18-1 support for AFS Symbolic Links.

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

10 years agoWindows: AFSLibExFreePool*() macros
Jeffrey Altman [Mon, 6 May 2013 19:12:54 +0000]
Windows: AFSLibExFreePool*() macros

Introduce the AFSLibExFreePool() and AFSLibExFreePoolWithTag() macros
which simply call ExFreePool() and ExFreePoolWithTag().

The prefix AFSLib indicates that memory allocated by
AFSLibExAllocatePoolWithTag() must be freed before unloading.
AFSExFreePool*() cannot be used because that is a pointer to a
function provided by AFSRedir.sys which may not be assigned when
memory must be freed.

The only time that ExFreePool() should be used is if the memory was
allocated by a system function.

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

10 years agoWindows: Use AFSLibExAllocatePool for library local
Jeffrey Altman [Mon, 6 May 2013 19:05:10 +0000]
Windows: Use AFSLibExAllocatePool for library local

If the memory allocation is for an object that must be freed before
the afsredirlib.sys driver unloads, use the AFSLibExAllocatePoolWithTag
interface.   AFSExAllocatePoolWithTag allocates the memory from
afsredir.sys which prevents Verifier from being used to detect leaks.

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

10 years agoWindows: RDR_Initialize must cleanup threads on failure
Jeffrey Altman [Tue, 7 May 2013 22:36:16 +0000]
Windows: RDR_Initialize must cleanup threads on failure

If RDR_Initialize() fails after instantiating the worker thread
pool it must call RDR_ShutdownFinal() to destroy the pool before
exiting.  Otherwise, the threads will spin endlessly as each
DeviceIoControl call to the redirector fails.

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

10 years agoWindows: IOCTL_AFS_GET_DEBUG_TRACE
Jeffrey Altman [Wed, 17 Apr 2013 22:21:40 +0000]
Windows: IOCTL_AFS_GET_DEBUG_TRACE

Pemrit the active Debug Flags and Trace Configuration to be
queried by administrators.

Change-Id: I0c798bd2eb8f2445c81a0b45c112bbaf72d15522
Reviewed-on: http://gerrit.openafs.org/9798
Reviewed-by: Peter Scott <pscott@kerneldrivers.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>

10 years agoWindows: Add IOCTL_AFS_GET_REPARSE_POLICY
Jeffrey Altman [Wed, 17 Apr 2013 22:18:30 +0000]
Windows: Add IOCTL_AFS_GET_REPARSE_POLICY

Introduce IOCTL_AFS_GET_REPARSE_POLICY to permit the global
and active authgroup reparse point policies to be queried.

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

10 years agoWindows: "ReparsePointPolicy" registry key
Jeffrey Altman [Mon, 15 Apr 2013 01:08:20 +0000]
Windows: "ReparsePointPolicy" registry key

HKLM\SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters

  DWORD "ReparsePointPolicy"

Valid values are:

 0 - No global policy set
 1 - Reparse Points to Files treated as the target File

Change-Id: Ib8f4f6a4c5c3b2faaf86a6650a4ce3ebcbbdf0e0
Reviewed-on: http://gerrit.openafs.org/9789
Reviewed-by: Peter Scott <pscott@kerneldrivers.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>

10 years agoWindows: CreateFile Reparse Point to File as File
Jeffrey Altman [Mon, 4 Mar 2013 04:10:51 +0000]
Windows: CreateFile Reparse Point to File as File

Apply the Reparse Point to File as File Policy to CreateFile.  If the
FILE_OPEN_REPARSE_POINT flag is specified to the CreateFile operation
and AFSIgnoreReparsePointToFile() returns TRUE, evaluate the target
object (if possible) and if the object is a FILE, then ignore the
FILE_OPEN_REPARSE_POINT flag.  Otherwise, re-evaluate the request to
attempt to open a reparse point if it exists.

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

10 years agoWindows: DirControl Reparse Point to File as File
Jeffrey Altman [Sat, 2 Mar 2013 06:06:52 +0000]
Windows: DirControl Reparse Point to File as File

Implement the Reparse Point to File as File Policy for directory queries.

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

10 years agoWindows: AFSRedirLib AFSIgnoreReparsePointToFile
Jeffrey Altman [Sun, 14 Apr 2013 22:57:53 +0000]
Windows: AFSRedirLib AFSIgnoreReparsePointToFile

AFSIgnoreReparsePointToFile() is a helper routine that uses the
global reparse point policy to decide whether or not a reparse point
whose target is a file should be reported to applications as a file.
When per-AuthGroup or per-Process policy is supported, this function
should be modified.

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

10 years agoWindows: IOCTL_AFS_SET_REPARSE_POLICY
pete scott [Wed, 27 Feb 2013 15:51:44 +0000]
Windows: IOCTL_AFS_SET_REPARSE_POLICY

IOCTL_AFS_SET_REPARSE_POLICY is a new ioctl that can be executed
by anyone to alter the behavior of AFS Symlink-to-File reparse point
processing.   Policy can be set for a global default or for the active
authentication group.  If the AFS_REPARSE_POINT_TO_FILE_AS_FILE policy is
active, afs symlinks will not be reported as reparse points if the symlink
target is known to be a file.

This patchset implements the ioctl but not the "reparse point to file as
file" functionality.  Per authgroup policy setting is not permitted by the
ioctl but is not supported at this time.

This patchset was modified by Jeffrey Altman.

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

10 years agoWindows: Report Case Sensitive Search
Jeffrey Altman [Sat, 4 May 2013 15:56:30 +0000]
Windows: Report Case Sensitive Search

Return the FILE_CASE_SENSITIVE_SEARCH volume flag as part of afs
volume properties.   NTFS does and our search algorithm is case
sensitive first, then case insensitive.

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

10 years agoWindows: Introduce CM_CONN_FLAG_NEW
Jeffrey Altman [Fri, 3 May 2013 15:23:31 +0000]
Windows: Introduce CM_CONN_FLAG_NEW

The new CM_CONN_FLAG_NEW flag is set on the cm_conn object whenever
a new rx_connection has been created.   The flag is cleared in cm_Analyze
if the call succeeded or if the error is one that is generated as a
result of communicating with the peer.  If no communication with the
peer has taken place the connection is considered "new".

For errors that would result in forcing a new connection, check whether
the existing connection is already "new".  This avoids an extra
RX_CALL_DEAD timeout period in the case where a "new" connection was
already in use.

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

10 years agoWindows: Use interlocked ops for cm_conn flags
Jeffrey Altman [Fri, 3 May 2013 15:21:39 +0000]
Windows: Use interlocked ops for cm_conn flags

cm_conn flags can be modified by multiple threads.
Use interlocked operations for thread safety.

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

10 years agoWindows: Use mtafsutil library when linking with pthreads
Marc Dionne [Fri, 3 May 2013 13:11:50 +0000]
Windows: Use mtafsutil library when linking with pthreads

Use the multi-threaded version of the util library in a few places
that are linking with pthreads but use the standard version.

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

10 years agodoc: Fix a few typos in vlserver man page
Marc Dionne [Wed, 24 Apr 2013 20:05:51 +0000]
doc: Fix a few typos in vlserver man page

Fix a few errors in the vlserver manpage, a typo in a word and a
few missing delimiters that mess up the formatting slightly.

Change-Id: I1ec9887dfcbfd4f2a38c0a15fe7760d99682a194
Reviewed-on: http://gerrit.openafs.org/9804
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agodasalvager: use pthreads
Derrick Brashear [Thu, 2 May 2013 12:32:51 +0000]
dasalvager: use pthreads

salvageserver already uses this code, and it appears to do the
right thing.

Change-Id: I4c0f2ec503f2388a1483e89a04ff78eda270659b
Reviewed-on: http://gerrit.openafs.org/9843
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agopt: let pt_util create the groups it wants
Derrick Brashear [Wed, 1 May 2013 20:07:09 +0000]
pt: let pt_util create the groups it wants

if you are rebuilding from pt_util, data sanitization should
not randomly chown and/or rename your groups. likewise,
an admin should have the ability to do this.

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

10 years agodoc: quote list items in POD
Ken Dreyer [Wed, 1 May 2013 03:59:32 +0000]
doc: quote list items in POD

Recent versions of Pod::Simple complain if we use integers or other
special characters in an =item list. We have a couple bulleted lists
that happen to have integers or other special characters as the list
values. Quote the items with C<> so that Pod::Simple can correctly parse
them again.

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

10 years agoRemove unused variable
Ben Kaduk [Thu, 25 Apr 2013 21:47:06 +0000]
Remove unused variable

volser has apparently never supported bcrypt from the intial IBM
import.  There's no need to keep around the code to fetch that key.

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

10 years agopt_util: fix group line check for input files
Michael Meffie [Tue, 30 Apr 2013 15:30:15 +0000]
pt_util: fix group line check for input files

Fix the check for requiring group lines before any membership lines. Do
not clear flag indicating the presence of a group after reading each
line.  (This error was caught by the pt_util-t unit test.)

Fix for commit 12ced70c95fe8efbcec09a372f0af81d819bb8cd

Change-Id: Iaa47e3ab7936668e8a5b761dd8d3f933d459a16a
Reviewed-on: http://gerrit.openafs.org/9832
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agotests: make a plan for man page checks
Michael Meffie [Tue, 30 Apr 2013 19:38:24 +0000]
tests: make a plan for man page checks

Split the man page check routine into two routines; one to get the list
of sub-commands for a command, and another to verify a man page exists
for each sub-command.  Use the list of sub-commands to set up the
Test::More plan before running the tests.

Setting the plan before running the tests allows the the man page tests
to run on systems which ship older versions the Test::More module.

Change-Id: I1ed6fb87989e1deff4696562f3b917140592ed17
Reviewed-on: http://gerrit.openafs.org/9835
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agotests: posix signal constants in rx/perf test
Michael Meffie [Tue, 30 Apr 2013 23:57:21 +0000]
tests: posix signal constants in rx/perf test

Export the posix signal constants in the rx/perf perl test. Fixes a
perl syntax error on solaris.

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

10 years agoafs: Do not invalidate all dcaches on startup
Andrew Deason [Tue, 30 Apr 2013 19:37:54 +0000]
afs: Do not invalidate all dcaches on startup

Commit 20b0c65a289e2b55fb6922c8f60e873f1f4c6f97 changed
afs_UFSGetDSlot to always treat a dslot entry as invalid if
'datavalid' was 0. This was to force the invalidation of the given
dslot if we were reading in a dslot from the free or discard list,
since the data in that dslot is not valid.

However, 'datavalid' is also 0 when we read in dcache entries from
disk on startup. So, this means that we invalidated all cache entries
when the client started up, effectively making our persistent cache
worthless.

Fix this by only forcing this invalidation when we are reading from a
free or discarded dcache, and not during the initial cache scan. That
is, when 'indexvalid' is 1, and 'datavalid' is 0.

The parameters for these Get*DSlot variants should maybe be changed to
be a little more clear, but for now, this is a targeted fix for this
specific issue.

FIXES 131655

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

10 years agoWindows: pSrcObject instead of pSrcFcb->ObjectInformation
Jeffrey Altman [Thu, 25 Apr 2013 03:30:53 +0000]
Windows: pSrcObject instead of pSrcFcb->ObjectInformation

In AFSSetFileLinkInfo and AFSSetRenameInfo consistently use the
variable pSrcObject instead of pSrcFcb->ObjectInformation.  pSrcObject
is a local alias.  Mixing both forms in the same function is confusing.

Change-Id: I6b078d783389eb57ed5d36cbc463018e6199e17d
Reviewed-on: http://gerrit.openafs.org/9810
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: AFSLocateNameEntry incorrect pCurrentObject
Jeffrey Altman [Thu, 18 Apr 2013 00:17:09 +0000]
Windows: AFSLocateNameEntry incorrect pCurrentObject

pCurrentObject is supposed to be an alias for pDirEntry->ObjectInformation
but it was not always being updated when pDirEntry was replaced.  As a
result several tests were being performed incorrectly and the wrong data
was being logged.

Change-Id: I69913788acd243d0bfdfee88e281a1eaa2adca6a
Reviewed-on: http://gerrit.openafs.org/9809
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: More ObjectInformation RefCnt Protection
Jeffrey Altman [Wed, 17 Apr 2013 22:35:36 +0000]
Windows: More ObjectInformation RefCnt Protection

Protect addition ObjectInformation Reference count
transitions with the VolumeCB.ObjectInfoTree.TreeLock.

AFSProcessUserFsRequest
AFSSetRenameInfo
AFSInvalidateCache
AFSInvalidateVolume
AFSAllocateObjectInfo
AFSDeleteObjectInfo
AFSGetObjectStatus
AFSDeleteDirEntry

Change-Id: Icd108bb8253e5e84c673f3de04f882afea725274
Reviewed-on: http://gerrit.openafs.org/9799
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: AFSExamineVolume drop TreeLock if waiters
Jeffrey Altman [Sat, 13 Apr 2013 05:57:56 +0000]
Windows: AFSExamineVolume drop TreeLock if waiters

After each call to AFSExamineObject drop the ObjectInfoTree.TreeLock
if there are threads waiting for access.  The garbage collection process
should not delay real work.

Change-Id: I2bd009d71b534d92d7e1b321b6db2204643e4666
Reviewed-on: http://gerrit.openafs.org/9786
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: AFSPerformObjectInvalidate hold TreeLock
Jeffrey Altman [Sat, 13 Apr 2013 05:56:39 +0000]
Windows: AFSPerformObjectInvalidate hold TreeLock

When decrementing the ObjectInfoCB reference count hold the Volume's
ObjectInfoTree.TreeLock shared.

Change-Id: I6ac2fe3cc19bcc97a2a6e38f2e1a4b3d0952b304
Reviewed-on: http://gerrit.openafs.org/9785
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: ObjectInfoCB update last access time
Jeffrey Altman [Sat, 13 Apr 2013 05:55:26 +0000]
Windows: ObjectInfoCB update last access time

Each time the ObjectInformationCB object is looked up
from the ObjectInfoTree the LastAccessCount field should be updated
except in cases of invalidation, garbage collection, and extent
processing.  This is particularly important when an ObjectInfoCB
is attached to DirectoryCB in AFSInitDirEntry and when constructing
directory snapshots or validating directory content.

Change-Id: Ife412b723a1bdc922ffdfeca71061fcfd1ce721a
Reviewed-on: http://gerrit.openafs.org/9784
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: AFSFindObjectInfo update last access time
Jeffrey Altman [Sat, 13 Apr 2013 05:52:45 +0000]
Windows: AFSFindObjectInfo update last access time

Add a boolean parameter to AFSFindObjectInfo() which is used
to indicate whether or not the last access time for the found
ObjectInfoCB should be updated.

Set the new parameter in all calls to AFSFindObjectInfo().

Change-Id: Ib50d772af6857db7b8c13f2054e910f1ef5a1b7e
Reviewed-on: http://gerrit.openafs.org/9783
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: AFSInvalidateVolume ObjectInfo refcnt decrement
Jeffrey Altman [Fri, 12 Apr 2013 15:12:13 +0000]
Windows: AFSInvalidateVolume ObjectInfo refcnt decrement

In AFSInvalidateVolume a reference count is obtained in order to
ensure that the object is valid throughout the invalidation request.
Although the refcnt is obtained while holding the TreeLock the refcnt
was not released while holding the TreeLock which could open the door
for another thread to race.

Change-Id: I5c7ee91b78a2ce5f03cdc5f835b15357ecbec443
Reviewed-on: http://gerrit.openafs.org/9782
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: AFSInitDirEntry allocated ObjInfoCBs valid
Jeffrey Altman [Fri, 12 Apr 2013 14:58:47 +0000]
Windows: AFSInitDirEntry allocated ObjInfoCBs valid

In AFSInitDirEntry the pattern was to find or allocate an
ObjectInfoCB then destroy it if the DirectoryCB creation fails
for some reason.  The problem with this approach is that once the
VolumeCB ObjectInfoTree.TreeLock is dropped the ObjectInfoCB is findable.
That means that the contents of the ObjectInfoCB must be valid.

This patchset makes three changes.  First, in the case where the
ObjectInfoCB is allocated, the fields of the ObjectInfoCB are populated
from the DirEnumEntry before the TreeLock is dropped.  Second, if the
DirectoryCB allocation fails the ObjectInfoCB is not deleted.  It is
perfectly valid and can be used by a subsequent AFSInitDirEntry call.
Perhaps one that is racing with this thread.   It will eventually be
cleaned up by the AFSPrimaryVolumeWorkerThread.  Finally, when the
ObjectInfoCB reference count is decremented the TreeLock is held shared in
order to prevent races with other threads that might be incrementing it
themselves.

Change-Id: If3091d4fa640bbb614a1a405c3afc910d649aad6
Reviewed-on: http://gerrit.openafs.org/9781
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: AFSSetDispositionInfo Verify Dir Enum
Jeffrey Altman [Fri, 12 Apr 2013 05:53:54 +0000]
Windows: AFSSetDispositionInfo Verify Dir Enum

Before testing whether or not a directory is empty, the directory
must be enumerated.  If it is not, enumerate it.

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

10 years agoWindows: Reset CM_VOLUMEFLAG_RO_SIZE_VALID flag
Jeffrey Altman [Thu, 25 Apr 2013 15:16:11 +0000]
Windows: Reset CM_VOLUMEFLAG_RO_SIZE_VALID flag

The CM_VOLUMEFLAG_RO_SIZE_VALID flag was being reset using the
wrong field which resulted in the flag never being cleared and
the correct volume size not being reported.

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

10 years agoWindows: fail if pSrcParentObject cannot be resolved
Jeffrey Altman [Thu, 25 Apr 2013 03:33:13 +0000]
Windows: fail if pSrcParentObject cannot be resolved

In AFSSetFileLinkInfo and AFSSetRenameInfo return STATUS_INVALID_PARAMETER
if pSrcParentObject cannot be determined.  Otherwise, a NULL pointer
dereference will occur.

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

10 years agoWindows: SetFileRenameInfo Do not replace pSrcParentObject
Jeffrey Altman [Thu, 25 Apr 2013 03:34:45 +0000]
Windows: SetFileRenameInfo Do not replace pSrcParentObject

If pSrcParentObject is replaced by pTargetParentObject then the
reference count obtained by the AFSFindObjectInfo() call at the
start of AFSFileRenameInfo will be released on the wrong object.
This will result in a reference leak on pSrcParentObject and an
undercount on pTargetParentObject.  pTargetParentObject can then
be garbage collected while it is in use.

Change-Id: Id10db257afbd4996a31eb98ad7eca69343297274
Reviewed-on: http://gerrit.openafs.org/9806
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoLINUX: Sometimes let dentry_open handle refcounts
Andrew Deason [Wed, 17 Apr 2013 23:04:58 +0000]
LINUX: Sometimes let dentry_open handle refcounts

When Linux changed dentry_open to use a 'path' argument, they also
changed it so dentry_open handles incrementing the relevant ref
counts. So now, sometimes we need to inc the dentry and vfsmount
refcounts ourselves, and sometimes we need to leave them alone.

To accommodate this, change afs_dentry_open to also handle refcounting
itself, and 'get' the given dentry and vfsmount if necessary.

Also note that currently, afs_linux_raw_open can call afs_dentry_open
twice in the case of an error, but it does not dget(dp). This means
that dp could be undercounted, since dentry_open on older kernels will
dec the refcount on the given dentry in the case of an error. This
change should also fix this so dp is not undercounted in that case.

FIXES 131613

Change-Id: I0e9deb7ce57633ff65b76d2444a0416ecbe329fd
Reviewed-on: http://gerrit.openafs.org/9801
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>

10 years agoRevert "LINUX: Avoid duplicate mntget in afs_linux_raw_open"
Andrew Deason [Wed, 17 Apr 2013 22:39:09 +0000]
Revert "LINUX: Avoid duplicate mntget in afs_linux_raw_open"

This reverts commit 5ccbbda19f11e7027300409c46715155f439424a.

dentry_open, at least on older kernels, decs the refcount on its
arguments in the case of an error. So calling mntget for each
dentry_open invocation actually is the correct thing to do.

This code may need to be further fixed in order to work for newer
kernels, but for now, at least put it back the way it was so we don't
undercount ref counts on older kernels.

Change-Id: Ie5e064b065bc41321c1cea8e0272cc4ea697e3b5
Reviewed-on: http://gerrit.openafs.org/9800
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

11 years agoWindows: RDR_DeleteFileEntry test for empty directory
Jeffrey Altman [Fri, 12 Apr 2013 05:14:39 +0000]
Windows: RDR_DeleteFileEntry test for empty directory

RDR_DeleteFileEntry should check to see that a directory entry
that is a directory is in fact empty.  The most frequent use of
RDR_DeleteFileEntry is to check whether the object can be deleted
prior to setting the DeletePending state which in turn results in
the object being deleted during Cleanup.  If the directory is not
empty during Cleanup it is too late for the error to be seen by
the application.

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

11 years agoWindows: cm_MapRPCErrorRmdir EEXIST == ENOTEMPTY
Jeffrey Altman [Fri, 12 Apr 2013 05:11:22 +0000]
Windows: cm_MapRPCErrorRmdir EEXIST == ENOTEMPTY

If the file server is asked to remove a directory that is not empty
one might expect it to return UAENOTEMPTY but instead it returns UAEEXIST.

The error translation function cm_MapRPCErrorRmdir did not include
EEXIST in the list of errors that convert to CM_ERROR_NOTEMPTY.

Prior to IBM AFS 3.5 the file server did return ENOTEMPTY and if a
particular platform did not define ENOTEMPTY, ENOTEMPTY was defined to
be EEXIST.  To late to change things back now.

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

11 years agoWindows: cm_BPlusDirIsEmpty
Jeffrey Altman [Fri, 12 Apr 2013 05:09:13 +0000]
Windows: cm_BPlusDirIsEmpty

Provide a function to determine if a directory is empty or not.

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

11 years agoMake ihandle sync behavior runtime-configurable
Andrew Deason [Fri, 29 Mar 2013 18:40:41 +0000]
Make ihandle sync behavior runtime-configurable

The actual behavior of FDH_SYNC has changed a bit over the years, and
some people want one behavior, and some want another. Make it possible
to make this choice at runtime with the new -sync option, instead of
making this decision by running with different patches.

Note that FDH_SYNC is not a macro anymore, nor is it an inline
function. While it could be a macro, it would look a bit complex, and
there are some oddities with trying to use vol_io_params inside the
FDH_SYNC expansion (vol_io_params is not declared for LWP, for
example). And having it be an inline function causes problems with
some odd linking dependencies. For example, vlib.a contains volume.o,
but does not contain a definition for DFlushVolume (dir/buffer.c),
which is referenced in volume.o.  'vos' uses vlib.a, but does not
bring in anything that defines DFlushVolume. Currently this appears to
not cause a problem because 'vos' uses nothing from volume.o, so the
dependencies of volume.o don't matter. Adding an inline FDH_SYNC for
platforms that don't support 'static inline' would add a dependency to
volume.o (via vol_io_params), which causes an error for the lack of a
DFlushVolume.

Those are possibly just some problems, and may not be all. So instead,
make it so we don't have to deal with that and just have a normal
function. While FDH_SYNC may be called in a performance-critical
section, the overhead of a real function call is nowhere near the
delay of an actual fsync(), so presumably any overhead doesn't matter.

Change-Id: I23620bd8ac31b9019e9d55cb46ec9f3a75f5675c
Reviewed-on: http://gerrit.openafs.org/9694
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

11 years agoLINUX: Avoid duplicate mntget in afs_linux_raw_open
Andrew Deason [Wed, 17 Apr 2013 06:33:07 +0000]
LINUX: Avoid duplicate mntget in afs_linux_raw_open

In the unlikely event that our afs_dentry_open call fails with
cache_creds, we call afs_dentry_open again with the current creds as a
fallback. However, we call mntget on afs_cacheMnt for each call. So if
we actually hit the second call, we'll have added 2 refs to
afs_cacheMnt, but we only actually opened one file, causing a slight
overcount on afs_cacheMnt refs.

To avoid this, just call mntget once, before any of the
dentry_open-related calls.

Change-Id: I7ec3e8c193dd7782ab629fb5d7615d83f8385b6c
Reviewed-on: http://gerrit.openafs.org/9791
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

11 years agoLINUX: Avoid duplicate mntget in afs_dentry_open
Andrew Deason [Wed, 17 Apr 2013 06:27:47 +0000]
LINUX: Avoid duplicate mntget in afs_dentry_open

Our caller already got a ref to 'mnt'; getting another one here will
overcount refs on 'mnt'.

This can make it impossible to unmount the filesystem the cache
resides on (even after the client is stopped), since it's ref count
will be very high.

FIXES 131613

Change-Id: I3f0cd0fd6c0c2ced74f2d799ea0d8f8701a20141
Reviewed-on: http://gerrit.openafs.org/9790
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

11 years agoWindows: cm_Analyze VICECONNBAD and VICETOKENDEAD
Jeffrey Altman [Thu, 11 Apr 2013 13:20:03 +0000]
Windows: cm_Analyze VICECONNBAD and VICETOKENDEAD

cm_Analyze forces new rx connections in response to VICECONNBAD and
VICETOKENDEAD errors but failed to mark the cm_req_t with
CM_REQ_NEW_CONN_FORCED and failed to set 'forcing_new' to true ensuring
that a retry would take place even if the cm_req_t included the no retry
flag.

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

11 years agoWindows: Force new connection upon RXKADEXPIRED
Jeffrey Altman [Thu, 11 Apr 2013 13:17:53 +0000]
Windows: Force new connection upon RXKADEXPIRED

cm_Analyze invalidated the credentials for the cell upon receiving an
RXKADEXPIRED error from a server but failed for force the establishment of
a new rx connection to the server.  As a result, the expired credentials
would continue to be used until the credential expires.

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

11 years agoWindows: Comment CommonWrite VDL Change
Jeffrey Altman [Tue, 9 Apr 2013 14:48:12 +0000]
Windows: Comment CommonWrite VDL Change

Add a comment reminding the reader that CcSetFileSizes only needs
to be called on a ValidDataLength change if the VDL value has decreased.
A write operation cannot result in a decrease therefore CcSetFileSizes
does not need to be called from within AFSCommonWrite().

Change-Id: Iaf867ec876a6265dc2c8a7ba2319fdf67503a467
Reviewed-on: http://gerrit.openafs.org/9757
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

11 years agoWindows: CcPurge range modified by non-cached write
Jeffrey Altman [Tue, 9 Apr 2013 14:35:52 +0000]
Windows: CcPurge range modified by non-cached write

When a non-cached non-paging write occurs, the update bypasses the
Windows cache.  As a result any cached data in the modified range is
now invalid and must be purged.

CcPurgeCacheSection is known to trigger some filter drivers to open
the file from a worker thread.  To avoid a deadlock on the
Fcb->NPFcb->Resource that resource must be dropped.  Holding the
SectionObjectResource exclusive is sufficient to protect against races
with other writes, reads and SetEndOfFile operations.  While purging the
cache prior to calling the service might be more desireable, it cannot be
done safely without violating the lock hierarchy.  Therefore, the purge is
performed after any call to the service completes.

Change-Id: I953a74a0675875eb6be85f85ce924473deb3347f
Reviewed-on: http://gerrit.openafs.org/9756
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

11 years agoWindows: Race between NonCached and Cached Writes
Jeffrey Altman [Tue, 9 Apr 2013 12:12:29 +0000]
Windows: Race between NonCached and Cached Writes

The following race was identified by Rod Widdowson.

 A. File is complete up to 1000 Eof=1000, VDL=1000
 B. File Eof is set to 2000.  Eof=2000, VDL=1000 (SetInfo doesn't move VDL)
 C. Locks dropped.

Thread1) Write comes in for 1000 for 500.  This is not extending.
         Locks taken shared.
Thread1) Data Written to Server.  Thread stalls.
Thread2) Read comes in for 1000 for 1000.  Locks taken shared
         so it proceeds.
Thread2) CcRead calls CcZero and so the cache get zeros from 1000 to 2000
Thread1) VDL moves forward.

The windows cache is now poisoned between 1000 and 1500 and protected by
the VDL.  Any future reads gets the wrong data and any write to that part
will cause an overwrite of zeros.

Instead of holding the Fcb->NPFcb->Resource and
Fcb->NPFcb->SectionObjectResource shared during a NonCached write, hold it
exclusive because the write is occurring behind the back of the windows
cache.

Change-Id: I2244e1247dcee2c3ca0d95e6ee11de3187d491c5
Reviewed-on: http://gerrit.openafs.org/9754
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

11 years agoWindows: DirectIO AFS_INVALIDATE_DATA_VERSION
Jeffrey Altman [Sat, 6 Apr 2013 20:38:59 +0000]
Windows: DirectIO AFS_INVALIDATE_DATA_VERSION

Implement cache flush and purge operations in response to
AFS_INVALIDATE_DATA_VERSION requests when DirectIO processing is in use.

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

11 years agoWindows: AFS_INVALIDATE_DATA_VERSION only by service
Jeffrey Altman [Sat, 6 Apr 2013 20:31:07 +0000]
Windows: AFS_INVALIDATE_DATA_VERSION only by service

Let the service make all decisions regarding when a data version
invalidation should be initiated.  If during directory enumeration
or entry validation a data version change is noticed, that is an
indication that the meta data should be updated.

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

11 years agoWindows: Update ValidDataLength on all nonPagingIo
Jeffrey Altman [Sun, 7 Apr 2013 12:26:18 +0000]
Windows: Update ValidDataLength on all nonPagingIo

Instead of updating the Fcb->Header.ValidDataLength only when
processing cached writes, update it for all non-PagingIo extending writes.
This ensures that a file that is extended by a mixture of cached and
non-cached (NO_INTERMEDIATE_BUFFERING) writes will properly trigger a
page fault when the Windows cache manager does not have a complete page
cached.

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

11 years agoWindows: hold locks during non-cached writes
Jeffrey Altman [Mon, 8 Apr 2013 12:56:31 +0000]
Windows: hold locks during non-cached writes

Writes can alter both the EndOfFile (Fcb FileSize) and the ValidDataLength
which must remain synchronized with the data known to the service.
Dropping the Fcb.Resource and the SectionObjectResource prior to
performing non-cached writes opens the possibility of a race in which
data changes and length updates can be altered independently.

Efforts are made to avoid holding locks across calls to the service
because they can result in deadlocks with object invalidation or extent
management.  However, object invalidation for data version changes are
now handled in a worker thread.  It should be safe to hold onto the
Fcb Resource and SectionObjectResource across non-cached write processing.

The locks are not held in the paging IO path so paging non-cached
writes (which cannot be extending) will not prevent cached writes from
taking place in parallel.

The reason it is critical for the ValidDataLength and the FileSize to
remain in sync with the data for non-paging non-cached writes is that
these values are used to determine whether the Windows cache manager
should trigger a page fault to read data from the service upon receiving
an extending cached write that doesn't fill the page.

Change-Id: If3edb2a7412623dbec10a6efd2ee8d3b92ac992d
Reviewed-on: http://gerrit.openafs.org/9745
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

11 years agoWindows: DOS Device VolumeInfo max name length
Jeffrey Altman [Tue, 9 Apr 2013 03:41:48 +0000]
Windows: DOS Device VolumeInfo max name length

In 1.7.2200 the AFS Redirectory began to return

  cellname{%,#}volume

as the volume label in the Volume Information response.  For UNC
paths this is fine but for DOS devices on Windows 7 and earlier returning
a volume label that is longer than the NTFS maximum label length (32
characters) results in the Explorer Shell treating the volume as if it
does not support long file names.

From this patchset forward if the FileObject->FileName indicates that
the query is for a DOS Device, only return the AFS volume name and not the
cell informmation in the Volume Information response.

FIXES 131632

Change-Id: Iee26a00e0042e2594a5e039ee57688b61b10da45
Reviewed-on: http://gerrit.openafs.org/9751
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

11 years agoWindows: \\afs\all is not a server for NP enumeration
Jeffrey Altman [Tue, 9 Apr 2013 03:37:39 +0000]
Windows: \\afs\all is not a server for NP enumeration

\\afs\all is a special share name that refers to the global root
which in the AFS redirector is actually \\AFS.  However, from the
perspective of the network provider interface \\afs\all is just a
share which refers to a directory.   Do not treat attempts to evaluate
it as if they were the same as evaluating \\AFS.  One is a global
enumeration (\\AFS) and the other is just a hidden share name.

Change-Id: I24af24ec005c729bb1430c55254f2b68689932ed
Reviewed-on: http://gerrit.openafs.org/9750
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

11 years agoWindows: AFSConfigureTrace process DebugFlags
Jeffrey Altman [Tue, 9 Apr 2013 01:54:57 +0000]
Windows: AFSConfigureTrace process DebugFlags

Do not ignore the DebugFlags value if it is only value that has
been changed.

Change-Id: Ibaad12d2a8a47711adf09f4c0811efbaad1df7fc
Reviewed-on: http://gerrit.openafs.org/9749
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

11 years agoWindows: Runtime RDR Trace Toggle
Jeffrey Altman [Tue, 9 Apr 2013 01:51:48 +0000]
Windows: Runtime RDR Trace Toggle

Modify the IOCTL_AFS_CONFIG_LIBRARY_TRACE DeviceIoControl message
to pass an AFSDebugTraceConfigCB which is used to toggle the value
of the Library's AFSDebugTraceFnc pointer.   When the trace log is
enabled, the AFSDbgLogMsg parameter is non-NULL and when the log is
disabled, the parameter is NULL.

Change-Id: I71b951f244b760487f2ece94409cefaa7a73ea31
Reviewed-on: http://gerrit.openafs.org/9748
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>