openafs.git
7 years agoAdd configure option to not install kauth
Ben Kaduk [Thu, 8 Nov 2012 23:40:57 +0000]
Add configure option to not install kauth

Per http://www.openafs.org/pages/no-more-des.html the kaserver
suite of utilities is deprecated and is not supposed to be built
anymore in this post-1.6 world.
Not building them at all requires some effort, but not installing
them is pretty easy.  Do the easy part for now, and leave the hard
parts for a follow-up commit.

Change-Id: I1c400a7398b8708e7c9dc6613cd183b9b67e7a7f
Reviewed-on: http://gerrit.openafs.org/8457
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

7 years agoviced: Sanity check file link count during CoW
Andrew Deason [Wed, 19 Dec 2012 00:49:49 +0000]
viced: Sanity check file link count during CoW

A few ihandle bugs in the past have caused the CopyOnWrite code to
open cached file handles for files which have been deleted. When we
CoW, both of the files we're dealing with had better actually be on
disk, so bail out and flag an error if either of them appear unlinked.

FIXES 131530

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

7 years agoihandle: Add FDH_ISUNLINKED
Andrew Deason [Fri, 21 Dec 2012 18:30:24 +0000]
ihandle: Add FDH_ISUNLINKED

Add the FDH_ISUNLINKED functionality to ihandle. This lets the caller
know if the file for the underlying file descriptor has been deleted
out from under us. This is useful for sanity checks in some callers.

Change-Id: I59d4fffba853cfa1b900a08b7b43134c29bbf844
Reviewed-on: http://gerrit.openafs.org/8838
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>

7 years agoihandle: Indent ifdef maze
Andrew Deason [Fri, 21 Dec 2012 11:11:00 +0000]
ihandle: Indent ifdef maze

According to the mesoamerican long count calendar, ifdef ladders will
destroy the world in 2012.

Change-Id: Ie9b16d600e4743eba3d934f8c3cf4d299abbf7e3
Reviewed-on: http://gerrit.openafs.org/8837
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>

7 years agovolser: Check vnode length on dump
Andrew Deason [Fri, 14 Dec 2012 21:05:53 +0000]
volser: Check vnode length on dump

Commit aadf69eabb1962496fa93745ab560a5b48cacd61 adds length checks on
vnodes during fileserver read/write operations. Do the same thing when
we dump volume data from the volserver, to ensure that we don't
transmit incorrect data e.g. to other RO sites when releasing.

FIXES 131530

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

7 years agoWindows: GetResourceParent processing for \\afs
Jeffrey Altman [Mon, 24 Dec 2012 07:40:08 +0000]
Windows: GetResourceParent processing for \\afs

When the input name is \\afs the parent must be an empty
NETRESOURCE structure.  The null lpRemoteName field represents
no parent.

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

7 years agoWindows: Add SERVERHASINLINEBULK macros
Jeffrey Altman [Wed, 19 Dec 2012 21:59:57 +0000]
Windows: Add SERVERHASINLINEBULK macros

Implement SERVERHASINLINEBULK and SET_SERVERHASINLINEBULK macros.
Apply them to cm_vnodeops.c.

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

7 years agoWindows: move SERVERHAS64BIT macros to cm_conn.h
Jeffrey Altman [Wed, 19 Dec 2012 21:58:25 +0000]
Windows: move SERVERHAS64BIT macros to cm_conn.h

Move the SERVERHAS64BIT and SETSERVERHASNO64BIT macros to
cm_conn.h from cm_dcache.c.

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

7 years agoWindows: Fix smb_GetCallerAccess prototype
Jeffrey Altman [Wed, 19 Dec 2012 21:47:36 +0000]
Windows: Fix smb_GetCallerAccess prototype

to supress warnings.

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

7 years agoWindows: SetRenameInfo do not reference deleted name
Jeffrey Altman [Mon, 24 Dec 2012 04:15:59 +0000]
Windows: SetRenameInfo do not reference deleted name

After the Target Dirctory CB has been deleted, it is not
safe to reference the FileName component.  Use the uniTargetName
in the error log message.

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

7 years agoRemove AFSLore from wiki URLs
Michael Laß [Sat, 22 Dec 2012 21:54:20 +0000]
Remove AFSLore from wiki URLs

The URL of the openafs wiki doesn't contain "AFSLore" anymore. Although
these old URLs still work, replace them to point users to the correct
address in the first place. Also be consistent and always use a
trailing /.

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

7 years agoWindows: more warnings on kernel builds
Rod Widdowson [Sun, 23 Dec 2012 14:48:14 +0000]
Windows: more warnings on kernel builds

This is the same sort of changes a per git commit 8a4094e9ffa5d0f96501817c8ffd3cc8dc7ec62b
but this time for the fs tree.  Again most of the work is UNREFERENCED_PARAMETER, initialize
variables where the compiler lacks the smarts and remove unused locals.

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

7 years agoWindows: Remove unused AFSVolumeWorkerThread
Jeffrey Altman [Wed, 19 Dec 2012 16:45:56 +0000]
Windows: Remove unused AFSVolumeWorkerThread

The currently implmentation does all maintenance work in the
AFSPrimaryVolumeWorkerThread which is associated with the
AFSGlobalRoot volume object.   Remove AFSVolumeWorkerThread as
it is unused.

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

7 years agoWindows: Wait for all worker threads to exit
Jeffrey Altman [Wed, 19 Dec 2012 14:31:06 +0000]
Windows: Wait for all worker threads to exit

The signalling mechanism for waking and shutting down worker threads
relies upon a per-queue event.  Therefore it is not guaranteed that
the worker thread that AFSShutdown*Thread() is attempting to wait
for is in fact the thread that will be woken and exit.  Modify the
code to loop waking threads until the one that is being waited for
does in fact exit.

Subsequent calls to AFSShutdown*Thread() will bypass the wait if
the thread has already exited.

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

7 years agoWindows: warnings on kernel builds
Rod Widdowson [Fri, 21 Dec 2012 16:17:34 +0000]
Windows: warnings on kernel builds

I turned some new warning (by virtue of a more modern compiler) and
threw up a few hundred.  This checked supresses them:

- Mostly remove variables which are never used
- Make unused parameters UNREFERENCED_PARAMETER
- Initialize a couple of variables which were either forgotton or
  the compiler wasn't smart enough to notice were initialized.

Also strip out some extraneous tabs which had crept in.

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

7 years agomacos: avoid leaking iocount on synthetic fsevents
Derrick Brashear [Tue, 18 Dec 2012 14:04:15 +0000]
macos: avoid leaking iocount on synthetic fsevents

in certain cases we could leak an iocount. clean up even if
our event couldn't be run

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

7 years agoUpdate configure help msg to match actual defaults
Michael Laß [Fri, 14 Dec 2012 16:06:30 +0000]
Update configure help msg to match actual defaults

The defaults for LINUX_KERNEL_PATH and LINUX_KERNEL_BUILD in
acinclude.m4 were changed in 2cfd611, 94ff565 and 3f9d982 without updating
the output of ./configure --help. Change the description of
linux-kernel-headers and linux-kernel-build to show the correct defaults.

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

7 years agoLinux: Restructure kernel header detection
Stephan Wiesand [Sat, 15 Dec 2012 14:36:24 +0000]
Linux: Restructure kernel header detection

As of kernel 3.7, version.h has moved, and hence utsrelease.h was
no longer found. Loop over candidate directories and locations
within, and look for the files we're actually after.

FIXES 131525

Change-Id: I686212a283b9e0ce769b1351e3cb75e08f4b110c
Reviewed-on: http://gerrit.openafs.org/8761
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

7 years agoubik: Do not count votes from error'd connections
Andrew Deason [Tue, 20 Nov 2012 21:00:15 +0000]
ubik: Do not count votes from error'd connections

If the given connection has a connection-wide error on it, the vote we
got from that site is probably not valid, and we could easily be
interpreting an error code as a vote time. So instead, treat the host
as if we got a network error from it.

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

7 years agoWindows: AFSLocateNameEntry Evaluate Symlink Target
Jeffrey Altman [Sat, 15 Dec 2012 17:26:18 +0000]
Windows: AFSLocateNameEntry Evaluate Symlink Target

Instead of validating the symlink target if both the TargetFID
and the Target Name fields are undefined, perform the validating
if either of them are undefined.

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

7 years agoWindows: AFSLocateNameEntry Absolute Symlink Cell resolution
Jeffrey Altman [Sat, 15 Dec 2012 17:23:58 +0000]
Windows: AFSLocateNameEntry Absolute Symlink Cell resolution

During AFSLocateNameEntry processing of an absolute symlink the
component being searched for in the AFSGlobalRoot volume may not
be found.  In this case, use AFSCheckCell() to query the service
to resolve the name.  If the AFSGlobalRoot happens to be the
Freelance Root Volume then the service can resolve it even though
it is not present in the directory listing.

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

7 years agoWindows: cm_NameI Freelance Eval of Absolute Symlinks
Jeffrey Altman [Sat, 15 Dec 2012 17:19:31 +0000]
Windows: cm_NameI Freelance Eval of Absolute Symlinks

In cm_NameI() it is possible that a symlink to an absolute path
is reached for which the component after the 'mountRoot' is not
present in the mountRoot directory.  If the mountRoot is the
Freelance root.volume then it is appropriate to attempt automatic
cell resolution.

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

7 years agoWindows: Set Symlink mpDV after reading target string
Jeffrey Altman [Sat, 15 Dec 2012 17:18:52 +0000]
Windows: Set Symlink mpDV after reading target string

When a cm_scache object, symlink, has its mountPointString field
successfully populated by cm_GetData(), the mpDV field must be
assigned the current dataVersion value in order to prevent unnecessary
queries of the mountPointString from the file server.

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

7 years agoWindows: If no inlinebulkstat, set the flag correctly
Jeffrey Altman [Fri, 14 Dec 2012 04:33:54 +0000]
Windows: If no inlinebulkstat, set the flag correctly

If RXAFS_InlineBulkStatus fails with RXGEN_OPCODE,
cm_SetServerNoInlineBulk must be called with the 'no' parameter
set to True.   Otherwise, thE cm_server object will not remember
that the RPc is not supported.

This is important for avoiding unnecessary timeouts on IBM AFS 3.6
servers.

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

7 years agoWindows: *ParseIoctlPath path has trailing slash
Jeffrey Altman [Thu, 13 Dec 2012 18:27:21 +0000]
Windows: *ParseIoctlPath path has trailing slash

Make it explicit that a pioctl input path that ends in a trailing
slash is consistently interpretted as a directory.

  \\afs\cell\mp\dir\  == \\afs\cell\mp\dir\.

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

7 years agoUpdate 'vos shadow' man page
Arne Wiebalck [Thu, 6 Dec 2012 15:23:05 +0000]
Update 'vos shadow' man page

Change the 'vos shadow' man page to say that updating the
VLDB with shadow volumes does only work if the VLDB entries
for the corresponding source volumes are deleted first.

Change-Id: I2764776b7a03346b5b2809f796d1deed0c32933b
Reviewed-on: http://gerrit.openafs.org/8652
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Dan van der Ster <daniel.vanderster@cern.ch>
Tested-by: Dan van der Ster <daniel.vanderster@cern.ch>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>

7 years agoWindows: Release Notes updates
Jeffrey Altman [Sun, 9 Dec 2012 23:23:59 +0000]
Windows: Release Notes updates

document adobe reader protected mode issues

Explain Stats, Volumes, and Cells registry values

many other minor improvements.

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

7 years agoWindows: Correct RDR Subsystem value overlap
Jeffrey Altman [Sun, 9 Dec 2012 23:13:01 +0000]
Windows: Correct RDR Subsystem value overlap

AFS_SUBSYSTEM_LOAD_LIBRARY and AFS_SUBSYSTEM_PROCESS_PROCESSING
were both assigned value 0x00010000.  Ensure that all values are
unique and match the documentation.

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

7 years agoWindows: buf_usedCount can be 64-bit
Jeffrey Altman [Sun, 9 Dec 2012 06:18:03 +0000]
Windows: buf_usedCount can be 64-bit

If buf_usedCount is 64-bit, must use 64-bit Interlocked operations.
Define buf_IncrementUsedCount() and buf_DecrementUsedCount() macros
to wrap the 32-bit and 64-bit Interlocked operations as appropriate.

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

7 years agoWindows: RDR Dynamic root Freelance only
Jeffrey Altman [Sun, 9 Dec 2012 05:31:58 +0000]
Windows: RDR Dynamic root Freelance only

commit 6c708d1415b27bf8f2804f3407e4fbe2f7bf1009 does not restrict
the AFS redirector dynamic root detection only to the Freelance
volume root directory.  This logic should not apply to arbitrary
mount point target paths.

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

7 years agoWindows: AFSProcessOpen !MmFlush release SectionObjectResource
Jeffrey Altman [Thu, 6 Dec 2012 19:24:12 +0000]
Windows: AFSProcessOpen !MmFlush release SectionObjectResource

Restructure the code around the MmFlushImageSection() call in
AFSProcessOpen() to ensure that the SectionObjectResource is
released even when the flush fails.

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

7 years agoWindows: AFSCachedWrite reset LastServerFlush when Forced
Jeffrey Altman [Fri, 7 Dec 2012 04:24:44 +0000]
Windows: AFSCachedWrite reset LastServerFlush when Forced

If the ForceFlush parameter to AFSCachedWrite is set to TRUE,
the Fcb->Specific.File.LastServerFlush value must be reset to
ensure that the AFSPrimaryVolumeWorkerThread will trigger an
extent flush on its next pass.  The LastServerFlush value will
not be reset by AFSNonCachedWrite() when called as a result of
a CcFlushCache() call as it appears to be PagingIo.

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

7 years agoWindows: Periodic Worker CleanupFcb to Flush Dirty Extents
Jeffrey Altman [Fri, 7 Dec 2012 04:20:57 +0000]
Windows: Periodic Worker CleanupFcb to Flush Dirty Extents

The AFSPrimaryVolumeWorkerThread must not check the ObjectInformationCB
reference count when determining whether or not to call AFSCleanupFcb().
One of the tasks of AFSCleanupFcb() is to flush dirty extents to the
service.

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

7 years agoWindows: SetDispositionInfo !MmFlush SectionObjectResource
Jeffrey Altman [Thu, 6 Dec 2012 19:59:22 +0000]
Windows: SetDispositionInfo !MmFlush SectionObjectResource

In AFSSetDispositionInfo() if MmFlushImageSection() fails,
be sure to release the SectionObjectResource.

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

7 years agoWindows: SetVolumeState is not an invalidation
Jeffrey Altman [Thu, 6 Dec 2012 13:16:01 +0000]
Windows: SetVolumeState is not an invalidation

Volume state notifications (online, offline, unknown) from the
afsd_service.exe to the afs redirector are not invalidation
events.  The verify flag should not be set, the extents should
not be purged, etc.  Just set or clear the AFS_VOLUME_FLAGS_OFFLINE.

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

7 years agocache bypass: fix afs_bypass_copy_page memcpy oops
Marc Dionne [Wed, 5 Dec 2012 23:23:34 +0000]
cache bypass: fix afs_bypass_copy_page memcpy oops

The two memory copy cases were inverted when the code was
refactored, causing an oops when cache bypass is enabled.

Change-Id: I30a9a51b7280883fb9b7bbeebbabe464c139b714
Reviewed-on: http://gerrit.openafs.org/8617
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

7 years agoWindows: AFSSetRenameInfo Drop TreeLocks MmForceSectionClosed
Jeffrey Altman [Wed, 5 Dec 2012 18:07:08 +0000]
Windows: AFSSetRenameInfo Drop TreeLocks MmForceSectionClosed

If the Target directory TreeLock is held across the
MmForceSectionClosed() call in AFSSetRenameInfo() Trend Micro's
TmPreFlt!TmpQueryFullName call can deadlock in its worker thread
when AFSCommonCreate() attempts to AFSLocateNameEntry() which
requires shared access to the TreeLock for the search.

Reorganize the Target Entry Exists case to call MmForceSectionClosed()
after the directory entry has been deleted.  That should throw
a monkey wrench into Trend Micro's attempt to scan it.

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

7 years agoWindows: Prevent lock inversion SetFileRenameInfo
Jeffrey Altman [Tue, 4 Dec 2012 21:57:36 +0000]
Windows: Prevent lock inversion SetFileRenameInfo

SetFileRenameInfo calls MmForceSectionClosed() which can call
back to the afs redirector via the Cleanup processing.  AFSCleanup()
requires an exclusive hold of Fcb->Resource so we must obtain the
lock first in AFSSetFileRenameInfo() prior to obtaining the
SectionObjectResource.

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

7 years agoWindows: addition debug for --validate-cache
Jeffrey Altman [Tue, 4 Dec 2012 21:56:21 +0000]
Windows: addition debug for --validate-cache

Print the value of the header size, the magic value and the
dirty flag.

Fail check if header size and magic do not match current
version of afsd_service.exe

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

7 years agoWindows: AFSProcessDFSLink to Dos Device
Jeffrey Altman [Tue, 4 Dec 2012 18:27:59 +0000]
Windows: AFSProcessDFSLink to Dos Device

Support msdfs links to <drive>:\<path>

Map them to IOMgr as \??\<drive>:\<path>

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

7 years agoWindows: fs getcalleraccess
Jeffrey Altman [Mon, 3 Dec 2012 18:39:18 +0000]
Windows: fs getcalleraccess

Implement VIOC_GETCALLERACCESS and associated 'fs getcalleraccess'
for Windows.  Varies from the Unix implementation in the following
ways:

 * getcalleraccess supports the -literal switch to permit
   querying rights of symlinks and mount points

 * multiple files can be provided on a single command line

The VIOC_GETCALLERACCESS pioctl returns the user access rights
and the anyuser access rights.

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

7 years agoWindows: AFSDevControl print control if exception
Jeffrey Altman [Sat, 24 Nov 2012 16:44:16 +0000]
Windows: AFSDevControl print control if exception

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

7 years agorx: RX_INVALID_OPERATION abort unknown service only
Jeffrey Altman [Sun, 25 Nov 2012 00:47:01 +0000]
rx: RX_INVALID_OPERATION abort unknown service only

Patchset 1fbe83f9aacfc36a9c426ba1fd18ad7c72869dc1 introduced the
sending of RX_INVALID_OPERATION aborts for connection attempts
requesting a service not offered by the rx peer.  By sending aborts
for all failures of rxi_FindConnection() the set of incoming packets
that are responded to is broader than simply those with non-matching
serviceIds.  This patchset restricts the transmission of
RX_INVALID_OPERATION aborts only to the explicit case in which
rxi_FindConnection() attempted to find a service and either failed
to find a match or couldn't apply the requested security class/level
to that service.

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

7 years agorx: Add rx_GetNetworkError
Andrew Deason [Tue, 13 Nov 2012 20:54:10 +0000]
rx: Add rx_GetNetworkError

Add the function rx_GetNetworkError to rx, to allow callers to
retrieve some information about the last ICMP error received for a
connection's peer. This can be useful if a call on that connection was
recently ended due to ICMP errors.

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

7 years agoafs: Apply VLRU safety check for Linux too
Andrew Deason [Wed, 28 Nov 2012 21:12:12 +0000]
afs: Apply VLRU safety check for Linux too

This invariant should apply to all platforms, not just those with
dynamic vcaches. Since this prevents an infinite loop if the list os
corrupt or something, having this around everywhere seems useful. So,
drop the check for afsd_dynamic_vcaches.

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

7 years agoafs: Fix VLRU traversal sanity check
Andrew Deason [Fri, 16 Nov 2012 20:18:32 +0000]
afs: Fix VLRU traversal sanity check

On non-Linux, the number of vcaches in the VLRU can easily exceed
afs_maxvcount, since we allocate new vcaches when we run out. So,
assume we only have afs_vcount vcaches on the VLRU, instead of
assuming we have at most afs_maxvcount vcaches.

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

7 years agoubik: Try to detect VOTE_Beacon errors
Andrew Deason [Tue, 20 Nov 2012 20:18:47 +0000]
ubik: Try to detect VOTE_Beacon errors

Currently the way ubik dbsites vote for each other is via the "return
value" of the Beacon VOTE RPC. Since this is really an Rx abort, this
can easily collide with actual errors on the wire, such as rxkad
errors.

Try to detect these by detecting vote times that are very different
than the current timestamp (more than an hour in the future or past),
and treat it like a network error.

If we do not do this, a single site reporting an error can cause us to
never reach quorum, since we calculate our sync site expiration based
on the oldest 'yes' vote, which for most known Rx aborts will be far
in the past.

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

7 years agotools: example sysvmq audit reader
Michael Meffie [Tue, 20 Nov 2012 13:49:39 +0000]
tools: example sysvmq audit reader

A user contributed sysvmq audit log example reader. Shows
how to read the sysvmq audit log using core only perl modules.

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

7 years agoafs_open: Deal with afs_GetDCache returning NULL
Andrew Deason [Tue, 6 Nov 2012 05:47:06 +0000]
afs_open: Deal with afs_GetDCache returning NULL

afs_open was assuming afs_GetDCache always returned non-NULL. Make it
deal with a NULL return.

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

7 years agoconfig: provide inlines to make 64bit ints printable
Derrick Brashear [Wed, 28 Nov 2012 20:32:45 +0000]
config: provide inlines to make 64bit ints printable

same idea as the 32 bit versions. make it so you can print something
the compiler would otherwise stand in the way of.

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

7 years agoafs: log ICMP errors for downed servers
Andrew Deason [Tue, 13 Nov 2012 20:58:11 +0000]
afs: log ICMP errors for downed servers

When we notice a server is unreachable, log the ICMP error we got for
that server, if any.

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

7 years agomacos: decode mountain lion panics
Derrick Brashear [Mon, 19 Nov 2012 20:54:35 +0000]
macos: decode mountain lion panics

security hardening in the mountain lion kernel
screws up our decoder. apple doesn't bother to document
what to do, but after some head smashing, here we are.

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

7 years agoWindows: shuffle trace messages for clarity
Jeffrey Altman [Mon, 3 Dec 2012 15:01:24 +0000]
Windows: shuffle trace messages for clarity

Some of the trace messages for VolumeReferenceLocks and
VolumeReferenceCounts were in odd places.  Move them for consistency and
clarity.

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

7 years agoWindows: Handle AFSLocateNameEntry() STATUS_REPARSE
Jeffrey Altman [Mon, 3 Dec 2012 14:11:14 +0000]
Windows: Handle AFSLocateNameEntry() STATUS_REPARSE

AFSLocateNameEntry() can return STATUS_REPARSE in addition to
NTSTATUS failure codes.  As in the case of an NTSTATUS code other
than STATUS_OBJECT_NAME_NOT_FOUND, the reference counts are decremented in
AFSLocateNameEntry() if STATUS_REPARSE is returned.

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

7 years agoWindows: Decr. used buf count flush and deleted files
Jeffrey Altman [Sat, 1 Dec 2012 12:54:59 +0000]
Windows: Decr. used buf count flush and deleted files

When flushing the cache (fs flush*) or when deleting files or
when a file server reported error indicates that the buffer is
bad, decrement the used cache count so "fs getcacheparms" now
indicates a floating value based upon the number of buffers
containing potentially valid data.

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

7 years agoWindows: Restore "fs getcacheparms" used space
Jeffrey Altman [Sat, 1 Dec 2012 12:30:57 +0000]
Windows: Restore "fs getcacheparms" used space

buf_Init() adds all of the available buffers to the free queue
at startup and cm_data.buf_freeCount tracks the number of items
in the free queue.  So it cannot be used as a method of reporting
how much of the cache space has been used.   Add a new buf_usedCount
parameter to the cm_memmap data to track the number of cache blocks
that have been used up to the total number of allocated blocks.
buf_usedCount can then be used in cm_IoctlGetCacheParms to restore
the original behavior.

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

7 years agoWindows: QFileInfo only Verify Entry when necessary
Jeffrey Altman [Thu, 29 Nov 2012 08:14:42 +0000]
Windows: QFileInfo only Verify Entry when necessary

During a QueryFileInformation request only call AFSVerifyEntry()
when the AFS_OBJECT_FLAGS_VERIFY flag is set on the ObjectInformationCB.
The AFS_OBJECT_FLAGS_VERIFY flag is set in response to an invalidation
event from the cache manager.  Let the cache manager decide when our
data is no longer consistent with the file server.

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

7 years agoWindows: Dir Enum only validate when necessary
Jeffrey Altman [Thu, 29 Nov 2012 08:13:11 +0000]
Windows: Dir Enum only validate when necessary

During a directory enumeration, do not call AFSValidateEntry()
for every DirectoryCB.  Instead only do so when the
AFS_OBJECT_FLAGS_VERIFY is set on the ObjectInformationCB.

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

7 years agoWindows: AFSTearDownFcbExtents count extents properly
Jeffrey Altman [Thu, 29 Nov 2012 08:02:48 +0000]
Windows: AFSTearDownFcbExtents count extents properly

Fcb->Specific.File.ExtentsCount cannot be used directly
in the for loop conditional because each call to AFSFreeExtent()
decrements the value.  Instead, save the original value to
'lFcbExtentCount' and use that in the loop conditional.

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

7 years agoWindows: AFSCleanup calls AFSDeleteFcbExtents
Jeffrey Altman [Thu, 29 Nov 2012 08:00:48 +0000]
Windows: AFSCleanup calls AFSDeleteFcbExtents

When the hard link count of the file drops to zero, call
AFSDeleteFcbExtents() instead of AFSTearDownFcbExtents()
because the file has been deleted and the extents have been
implicitly released.

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

7 years agoWindows: AFSDeleteFcbExtents()
Jeffrey Altman [Thu, 29 Nov 2012 07:58:46 +0000]
Windows: AFSDeleteFcbExtents()

Similar to AFSTearDownFcbExtents() but does not release the
extents to afsd_service.exe.  It is intended for use when the
FCB's extents are implicitly released as the result of file
deletion.

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

7 years agoWindows: Fcb sectionObjectResource
Jeffrey Altman [Wed, 28 Nov 2012 07:48:48 +0000]
Windows: Fcb sectionObjectResource

Add a SectionObjectResource to the AFS_FCB structure.  This lock
replaces the Fcb.Resource in protecting the SectionObjectPointers.

The new resource is being added to assist in avoiding deadlocks
caused by Trend Micro and perhaps other AV products when
CcPurgeCacheSection() is called while holding the Fcb.Resource
which is required in AFSProcessOpen().

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

7 years agoWindows: Implement dynamic cell detection for RDR
Jeffrey Altman [Tue, 27 Nov 2012 19:26:21 +0000]
Windows: Implement dynamic cell detection for RDR

RDR_EvaluateNodeByName knew how to parse \\afs\foo#bar\ notation
but couldn't perform a lookup for a cell that wasn't already
in the root directory.  Add support for autorecognition.

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

7 years agoWindows: PrimaryVolumeWorkerThread Garbage Collect Fcb
Jeffrey Altman [Tue, 27 Nov 2012 05:35:20 +0000]
Windows: PrimaryVolumeWorkerThread Garbage Collect Fcb

Revert commit cecd99abd3837ef820d78fb15e450c8688b0f39b.  Failing
to garbage collect the FCB from the ObjectInformationCB at the
earliest opportunity opens the door to a deadlock with Trend Micro's
anti-virus driver.  Trend Micro attempts to make a copy of the
file data each time a CcPurgeCacheSection() is performed on the
FCB.  If during AFSValidateEntry or AFSVerifyEntry a DirectoryCB->
ObjectInformationCB->FCB is discovered which has a non-NULL
SectionObjectPointers.DataSectionObject and the data version in
the DirEnumEntryCB differs from the ObjectInformationCB, a
CcPurgeCacheSection() call is performed while holding the
FCB->NPFcb->Resource exclusively.  Trend Micro will deadlock the
thread making the CcPurgeCacheSection() call when it attempts
to open the file in one of its worker threads.

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

7 years agorx: set abort client_initiated flag to match direction
Jeffrey Altman [Sun, 25 Nov 2012 01:10:49 +0000]
rx: set abort client_initiated flag to match direction

In a recent incident involving packet reflection back to the
file server, aborts were being sent by the file server in response
to a server sent packet.  The aborts sent in response also failed
to set the CLIENT_INITIATED flag in the header which permitted the
the actual client to confuse the Abort as applying to its client
initiated connection.

in rxi_SendRawAbort, set the CLIENT_INITIATED flag to the opposite
of the packet the abort is being sent in response to.

Thanks to Chaskiel Grundman for the suggestion.

Change-Id: Iea4189f022ac050e2e005e80c427f1c02c2251db
Reviewed-on: http://gerrit.openafs.org/8513
Reviewed-by: Chaskiel Grundman <cg2v@andrew.cmu.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

7 years agorx: Make rxevent_Put NULL the event ptr being put
Simon Wilkinson [Sun, 4 Nov 2012 17:06:41 +0000]
rx: Make rxevent_Put NULL the event ptr being put

Change rxevent_Put so that it takes a pointer to the event being
put, and NULLs that pointer. This removes a lot of duplicate code
in callers, as well as making it harder to reuse a discarded event.

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

7 years agorx: Return success value when cancelling an event
Simon Wilkinson [Thu, 22 Nov 2012 08:41:51 +0000]
rx: Return success value when cancelling an event

When cancelling an event that holds reference counts, we need
to know whether the attempt to cancel the event was successful
or not, otherwise references can be double put when the
cancellation races with the event firing. Take the follwing

Thread A Event Thread
========= ============

... event fired ...
MUTEX_ENTER(&obj->lock);
if (obj->event) {
    rxevent_Cancel(&obj->event);
    obj_put(&obj->refcnt);
}
MUTEX_EXIT(&obj->lock)
MUTEX_ENTER(&obj->lock);
if (event == obj->event)
    rxevent_Put(&obj->event);
...
MUTEX_EXIT(&obj->lock);
obj_put(&obj->refcnt);

Holding obj->lock doesn't control whether the event is fired or
not. Only putting the reference if the event being fired matches
that in obj doesn't help - it just leaks a reference in a different
race.

So, make rxevent_Cancel return true if it did actually cancel the
event, and false if the event has already been fired. This means
that Thread A can become

MUTEX_ENTER(&obj->lock);
if (rxevent_Cancel(&obj->event)
    obj_put(&obj->refcnt);
MUTEX_EXIT(&obj->lock)

In the example above, rxevent_Cancel would return false.

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

7 years agorx: Don't treat calls specially in event package
Simon Wilkinson [Sat, 3 Nov 2012 23:15:50 +0000]
rx: Don't treat calls specially in event package

Many different structures can be passed to the rxevent package as
data. Don't give calls special treatment by making rxevent aware of
how to release their reference counts when an event is cancelled.

Update all of the callers of rxevent_Cancel to use the new arguments,
and where they were cancelling functions with calls as parameters add
the appropriate CALL_RELE directives. In many cases, this has led to
new helper functions to cancel particular call-based events.

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

7 years agorx: Remove unused origPeer parameter to FindPeer
Simon Wilkinson [Thu, 1 Nov 2012 17:44:07 +0000]
rx: Remove unused origPeer parameter to FindPeer

rxi_FindPeer took an 'origPeer' parameter, which was originally
there as an optimisation to decrement a reference count when replacing
a peer on a connection structure. However, we don't do that any more,
and the origPeer parameter is never used.

Just remove it to simplify this bit of code.

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

7 years agorx: Remove unused timeoutEvent
Simon Wilkinson [Thu, 15 Nov 2012 18:21:27 +0000]
rx: Remove unused timeoutEvent

The timeoutEvent pointer in the rx_call structure is unused. Remove
it to reduce confusion about which events can hold call reference
counts.

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

7 years agorx: CheckBusy doesn't drop conn_call_lock
Simon Wilkinson [Fri, 9 Nov 2012 23:20:42 +0000]
rx: CheckBusy doesn't drop conn_call_lock

As rxi_CheckBusy doesn't drop the conn_call_lock when it checks for
busy call slots, it doesn't need to deal with someone replacing a
call behind its back.

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

7 years agoWindows: RefCounts, Asserts, and Trace Logging
Jeffrey Altman [Mon, 26 Nov 2012 16:25:43 +0000]
Windows: RefCounts, Asserts, and Trace Logging

Rename DirectoryCB.OpenReferenceCount to DirOpenReferenceCount
to distinguish it from the FCB.OpenReferenceCount.  This makes
it easier to search for instances within an editor or debugger.

Ensure that all InterlockedIncrement and InterlockedDecrement
calls on a reference count field assign their value to a local
'lCount' variable.  Ensure that 'lCount' is used within any
trace log messages and conditionals.

Add ASSERT( lCount >= 0) after all reference count decrements
in order to catch underflows.

Change conditionals from (RefCount == 0) to (RefCount <= 0) so
that object destruction can occur when there has been an underflow.
This is important in release builds for which ASSERT() is a no-op.

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

7 years agoWindows: AFSClose File FCB/CCB cleanup before DirCB
Jeffrey Altman [Mon, 26 Nov 2012 16:16:56 +0000]
Windows: AFSClose File FCB/CCB cleanup before DirCB

Move the processing of FCB and CCB cleanup ahead of the
DirectoryCB cleanup.  It is not safe to dereference the
Ccb->DirectoryCB until after the CCB has been destroyed.

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

7 years agoWindows: AFSDeleteObjectInfo not on volume roots
Jeffrey Altman [Sun, 25 Nov 2012 23:13:53 +0000]
Windows: AFSDeleteObjectInfo not on volume roots

The VolumeCB embeds an ObjectInformationCB structure which must
not be freed by calling AFSDeleteObjectInfo().  Add an assert
in the checked build and return without destroying the object
in the free build.

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

7 years agoWindows: Missing DirEntry Ref incr AFSLocateName
Jeffrey Altman [Mon, 26 Nov 2012 12:10:05 +0000]
Windows: Missing DirEntry Ref incr AFSLocateName

In the STATUS_NAME_COLLISION error path the DirEntry refcnt must
be incremented because it will be decremented before exit from
AFSLocateName().

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

7 years agoWindows: AFSLocateNameEntry move InsertNextEntry
Jeffrey Altman [Mon, 26 Nov 2012 06:18:19 +0000]
Windows: AFSLocateNameEntry move InsertNextEntry

In AFSLocateNameEntry, move the InsertNextEntry to name array
call from before the directory entry DirOpenReferenceCount is
incremented to afterwards.  This permits InsertNextEntry() to
consistently assert based upon the DirOpenReferenceCount value.

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

7 years agoWindows: AFSInvalidateCache volume refcounts
Jeffrey Altman [Sun, 25 Nov 2012 23:06:17 +0000]
Windows: AFSInvalidateCache volume refcounts

AFSInvalidateCache failed to release the volume reference count
when FileId is the volume root.   In the non-root case it released
it too early permitting a race with AFSPrimaryVolumeWorkerThread
calling AFSRemoveVolume().

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

7 years agoWindows: Fail RX_INVALID_OPERATION errors
Jeffrey Altman [Sat, 24 Nov 2012 19:36:46 +0000]
Windows: Fail RX_INVALID_OPERATION errors

RX_INVALID_OPERATION errors were not resulting in an eventual
failure and the RPC was being repeated indefinitely.  There were
three subtle problems:

 1. RX_INVALID_OPERATION was being processed by cm_Analyze()
    resulting in a retry in all cases.  Even those where no
    connp was passed in as NULL.  connp == NULL implies that
    no server could be obtained so the RPC was not issued on
    this pass.  As a result there should be no retry.

 2. RX_INVALID_OPERATION was mapped to CM_ERROR_UNKNOWN which
    is not an error that is reported to the AFS redirector.

 3. RDR_BkgFetch was setting CM_REQ_NORETRY and permitting
    the retries to be handled by the cm_daemon threads.  However,
    CM_ERROR_UNKNOWN was not treated as a fatal error by cm_Daemon.

Address the failures in the following ways:

 A. cm_Analyze no longer retries calls which did not take place.

 B. Create a new CM_ERROR_INVAL_NET_RESP error for RX_INVALID_OPERATION
    which is translated to the Win32 STATUS_INVALID_NETWORK_RESPONSE
    error.  This is now returned to the AFS redirector and treated
    as a fatal error.

 C. RDR_BkgFetch no longer queues tasks to cm_Daemon with the
    CM_REQ_NORETRY flag set.

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

7 years agovol: Let non-usable volumes attach for non-DAFS
Andrew Deason [Wed, 28 Nov 2012 23:22:21 +0000]
vol: Let non-usable volumes attach for non-DAFS

Before DAFS, volumes that were not inService/blessed were not
accessible by normal clients, but were still allowed to attach. That
is, access to clients was prevented at VGetVolume-time, rather than at
attach-time. Commit 939382c5 tried to short-circuit this by detecting
this volume state at attach-time. However, volume utilities (e.g.
volserver) can give us back a volume over FSSYNC when they are done
with the volume, and for non-DAFS, we then try to attach the volume.
So, with 939382c5 that attachment will fail when volserver gives us
back a volume that is not inService/blessed (which can happen for some
normal volume operations).

This situation is not terrible, since either way the volume is not
usable by clients (since the volume didn't attach), and the volume is
still usable by volserver (since volserver is allowed to check out
nonexistent volumes). But it is a deviation from pre-DAFS behavior and
it can result in confusing error messages, so revert the 939382c5
behavior for non-DAFS.

For DAFS, this behavior is fine, since the fileserver does not attach
a volume unless it is trying to service a client request. So, leave it
for DAFS.

FIXES 131505

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

7 years agorx: Add a no-op afs_kcondvar_t for LWP
Simon Wilkinson [Fri, 9 Nov 2012 23:11:16 +0000]
rx: Add a no-op afs_kcondvar_t for LWP

Remove the need to protect afs_kcondvar_t with RX_ENABLE_LOCKS, by
typedefing it as an int in rx_lwp.c. This is identical to what we
already do with afs_kmutex_t, and should let us get rid of some more
preprocessor spaghetti.

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

7 years agorx: Lock call for KeepAliveOn/KeepAliveOff
Andrew Deason [Wed, 14 Nov 2012 05:30:41 +0000]
rx: Lock call for KeepAliveOn/KeepAliveOff

rxi_KeepAliveOn/Off expect the call lock to be held after the call has
been initialized. So, hold it in the rx_KeepAliveOn/Off callers.

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

7 years agoafs: Handle VNOSERVICE as a timeout
Andrew Deason [Wed, 14 Nov 2012 00:27:11 +0000]
afs: Handle VNOSERVICE as a timeout

For whatever reason, the fileserver uses VNOSERVICE to indicate that
an Rx call was killed due to an idledead timeout. It is not used for
any volume errors, so treat it like the idle dead error codes.

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

7 years agoWindows: cm_LookupInternal obtain type of target
Jeffrey Altman [Tue, 27 Nov 2012 05:16:58 +0000]
Windows: cm_LookupInternal obtain type of target

cm_LookupInternal needs to return the target of a mount point
if the matching directory entry is a mount point.  Therefore, if
the target type is unknown the status information must be queried.

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

7 years agoWindows: cm_GetNewSCache init mpDV to BAD
Jeffrey Altman [Tue, 27 Nov 2012 05:08:30 +0000]
Windows: cm_GetNewSCache init mpDV to BAD

when allocatiing a new cm_scache_t object the mpDataVersion
field must be initialized to CM_SCACHE_BAD_VERSION.  Zero is
a valid data version for a mount point or symlink.

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

7 years agoafs: Slight restructuring in afs_Analyze
Andrew Deason [Wed, 14 Nov 2012 00:15:21 +0000]
afs: Slight restructuring in afs_Analyze

We test for acode < 0 && acode != VRESTARTING, but then immediately
test for specific values for acode. Move this conditional down, and
remove a level of indentation for the next couple of acode checks.

This commit should introduce no functional change.

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

7 years agorx: Generate BUSY packets for error call channels
Andrew Deason [Wed, 14 Nov 2012 04:46:34 +0000]
rx: Generate BUSY packets for error call channels

Currently, if a call is error'd out but still active, we won't
generate BUSY packets if another call comes in on the same channel.
This is because we bail out earlier, here, before we get to the BUSY
processing.

The comments suggest that this is for if we enter an error state while
waiting for TQ to clear. So, only do this if our error has changed.

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

7 years agoWindows: AFSValidateEntry Symlink TargetName
Jeffrey Altman [Sun, 25 Nov 2012 19:30:07 +0000]
Windows: AFSValidateEntry Symlink TargetName

During an AFSValidateEntry if the data version of the symlink
object has not changed, do not discard or rebuild the target
name if already assisgned.

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

7 years agoWindows: Panic if RDR_Initialize SERVICE_DISABLED
Jeffrey Altman [Mon, 26 Nov 2012 04:56:47 +0000]
Windows: Panic if RDR_Initialize SERVICE_DISABLED

If RDR_Initialize() fails with ERROR_SERVICE_DISABLED it means that
the AFSRedir.sys driver loaded but the AFSRedirLib.sys driver library
cannot be loaded.  In this situation neither the RDR nor SMB interfaces
can successfully be used.  Panic!

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

7 years agoWindows: GetResourceInformation print path earlier
Jeffrey Altman [Fri, 16 Nov 2012 22:20:33 +0000]
Windows: GetResourceInformation print path earlier

In the network provider, GetResourceInformation was logging the
input resource path after the afs redirector chopped it up.  Log
it before the DeviceIoControl call.

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

7 years agoLINUX: Dir follow_link should set LAST_BIND
Andrew Deason [Wed, 21 Nov 2012 16:39:51 +0000]
LINUX: Dir follow_link should set LAST_BIND

For our faux-symlink directory follow_link operation, we leave the
given nameidata struct with an invalid 'last' component. That is,
nd->last is not changed or set to anything meaningful.

Usually the callers of our follow_link op do not care about the last
component of the nameidata. However, at least one caller does: the
caller near the do_link label in open_namei(). This is called during
processing for O_CREAT operations on symlinks, and since our
directories look like symlinks, it gets called. It tries to use
nd->last to look up the last component of the dereferenced path (so it
can try to create it, as necessary), but since our nd->last is not
set, this will not work.

Specifically, our nd->last.name is not pointing into the names cache,
so the subsequent putname/__putname on it will corrupt the names
cache. However, even if this were not a problem, the actual contents
of the last component do not seem meaningful so this would probably
result in incorrect behavior anyway.

To avoid all of this, set nd->last_type to LAST_BIND, so any callers
know that the last component of the given nd is not valid, and we are
pointing directly to the target component with a dentry.

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

7 years agoDo not call afs_MarinerLog when afs_mariner is not set
Hans-Werner Paulsen [Mon, 26 Nov 2012 14:46:26 +0000]
Do not call afs_MarinerLog when afs_mariner is not set

When mariner log is not set up (afs_mariner=0), do not call afs_MarinerLog,
otherwise a osi_NetSend() to hostaddress=0 is tried, which will give you
ICMP messages in the socket error queue.
Do not call afs_AddMarinerName, when afs_mariner is not set.

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

7 years agoWindows: Add Hard Link support to Service
Jeffrey Altman [Sat, 17 Nov 2012 05:43:00 +0000]
Windows: Add Hard Link support to Service

Implement Hard Link support to the redirector interface in the
service.  It is implemented to support hard links across directories
even though AFS does not currently support it.  cm_Link() will
check before issuing an RPC to the file server.   ReplaceIfExists
functionality is implemented by cm_Unlink() followed by cm_Link()
if required.

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

7 years agoWindows: Add Hard Link support to AFS Redirector
Jeffrey Altman [Sat, 17 Nov 2012 03:27:02 +0000]
Windows: Add Hard Link support to AFS Redirector

Both Windows and AFS support the notion of hard links to files.
Add an implementation to the AFS redirector.  The body of the
functionality and the IOCTL to the service permits the specification
of hard links to files across directory boundaries.  There is a
restriction within AFSSetFileLinkInfo() which prevents cross-directory
requests.  However, this can be taken out if AFS ever permits them.

Decrement object information link counts on directory entry
deletions.  Do not delete object information context blocks if the
link count is greater than 0.  Increment link counts when hard
links are added.

A subsequent patchset will implement the afsd_service support.

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

7 years agoWindows: Trend Micro QueryDirectory deadlock
Jeffrey Altman [Thu, 22 Nov 2012 16:52:11 +0000]
Windows: Trend Micro QueryDirectory deadlock

Trend Micro will deadlock both itself and the AFS redirector by
calling a worker thread to generate a temporary file name during
an active FindFirst Directory Query.  The Trend Micro worker will
also attempt to enumerate the directory.   If the directory contains
an entry for which the data version as reported by the service is
different than the data version in the ObjectInformationCB a deadlock
will occur on the matching FileCB Resource.

To avoid this deadlock, prevent AFSValidateEntry from purging or
updating the ObjectInformationCB and FileObject information when
called from AFSQueryDirectory.

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

7 years agoWindows: Missing lock in AFSNotifyRename
Jeffrey Altman [Mon, 19 Nov 2012 20:33:33 +0000]
Windows: Missing lock in AFSNotifyRename

If the ParentObjectInformation and TargetParentObjectInformation
are different, the TreeLock for each must be held.

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

7 years agoWindows: AFSSetRenameInfo always set pRenameInfo
Jeffrey Altman [Mon, 19 Nov 2012 20:30:09 +0000]
Windows: AFSSetRenameInfo always set pRenameInfo

Make it easier to debug AFSSetRenameInfo by setting pRenameInfo
so that the FILE_RENAME_INFORMATION structure is visible within
the debugger on all code paths.

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

7 years agoWindows: SetFileRenameInfo Improve Error Handling
Jeffrey Altman [Fri, 16 Nov 2012 04:13:17 +0000]
Windows: SetFileRenameInfo Improve Error Handling

If a Target FileObject is not provided by the IOManager and
a Target RootDirectory Handle is provided something has gone
wrong.  Return STATUS_INVALID_PARAMETER to indicate the
invalid state.

If the target directory is not specified by FileObject and a full
target path is provided return STATUS_NOT_SAME_DEVICE to force
an object Move instead of Rename.

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

7 years agoWindows: smb_ReceiveTran2QFileInfo Pioctl support
Jeffrey Altman [Wed, 21 Nov 2012 23:08:35 +0000]
Windows: smb_ReceiveTran2QFileInfo Pioctl support

Similar to the QueryPathInfo support for _._AFS_IOCTL_._ the
QueryFileInfo interface must respond to pioctl queries.  When
GetFileAttributes() on XP is called from the afslogon.dll the
QFileInfo path is used instead of the QPathInfo path.

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

7 years agoWindows: afslogon do not specify smbName for tokens
Jeffrey Altman [Wed, 21 Nov 2012 23:03:10 +0000]
Windows: afslogon do not specify smbName for tokens

The smbName was added to the Windows ktc_SetTokens() interface
to provide a mechanism for passing the Windows account name
that the tokens should be associated with via Integrated Logon.
This was only required when the Authentication Provider did not
impersonate the user context prior to calling ktc_SetTokens().
Now that impersonation is used, the ktc_SetTokens() call will
do the right thing without the smbName.  In fact, when impersonation
is used setting the smbName does the wrong thing by specifying
the AFS_PIOCTL_LOGON flag which is only valid if the SYSTEM account
is issuing the ktc_SetToken() call.

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

7 years agoWindows: Fix smb_ReceiveTran2QPathInfo Pioctl support
Jeffrey Altman [Wed, 21 Nov 2012 06:13:49 +0000]
Windows: Fix smb_ReceiveTran2QPathInfo Pioctl support

The path check should needs to include the root directory slash
when comparing to the \_._AFS_IOCTL_._ path to detect a pioctl
request.

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