openafs.git
7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 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>

7 years agoWindows: CM_CONFIG_DATA_VERSION 23
Jeffrey Altman [Mon, 8 Apr 2013 13:26:28 +0000]
Windows: CM_CONFIG_DATA_VERSION  23

The cm_volume_t data structure changed.  Increment the data version
for the 1.7.24 release.

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

7 years agoIncrease size of space for ACL in "up" command.
Antoine Verheijen [Tue, 9 Apr 2013 02:51:52 +0000]
Increase size of space for ACL in "up" command.

The amount of space allocated for use by the pioctl call to
obtain the ACL for the source directory in the "up" command
is not large enough and the call fails when access lists get
sufficiently large.

This change increases the size of the space provided to
pioctl to the maximum possible. This allows for much larger
access lists and is consistent with a similar call in the
"fs listacl" command).

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

7 years agoOpenBSD 5.3: Replace use of copyinstr for setting mount point name.
Antoine Verheijen [Tue, 9 Apr 2013 02:29:58 +0000]
OpenBSD 5.3: Replace use of copyinstr for setting mount point name.

As a result of a realignment of kernel memory in OpenBSD 5.3,
the copyinstr() routine no longer works for copying the mount
point name into the internal mount table structure. It also
fails silently, so it's not noticed until someone looks at
the mount table and discovers that the mount point name for
AFS is missing.

This patch replaces the use of copyinstr() with strlcpy() for
copying the mount point name in OpenBSD 5.3.

Note that this is consistent with how other similar device
support has addressed the same issue in OpenBSD 5.3.

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

7 years agobudb: fix signedness of hash address logging
Derrick Brashear [Wed, 3 Apr 2013 14:54:11 +0000]
budb: fix signedness of hash address logging

lots of places we print an unsigned int as a signed int.
the resulting output is confusing. so. stop that.

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

7 years agoaklog: Probe for libasn1 on heimdal
Andrew Deason [Thu, 28 Mar 2013 21:42:58 +0000]
aklog: Probe for libasn1 on heimdal

aklog uses encode_EncTicketPart and some other encode_* ASN.1 routines
when we're building against heimdal. Our krb5 autoconf logic from
c-rra-util is not guaranteed to include libasn1 in KRB5_LIBS, since
it's not required for functions in the krb5 API. So, specifically test
for it.

Related issue reported by Måns Nilsson.

Change-Id: I5d1ab07ec481e48710bafcdc53fe58f529cc6dde
Reviewed-on: http://gerrit.openafs.org/9693
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

7 years agoliboafs_ubik: Export DISK_GetFile
Andrew Deason [Fri, 5 Apr 2013 19:19:35 +0000]
liboafs_ubik: Export DISK_GetFile

The symbols StartDISK_GetFile and EndDISK_GetFile can be useful to
ubik users. Put them in the export list.

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

7 years agoWindows: Avoid unnecessary Ccb->DirectoryCB->ObjectInformation
Jeffrey Altman [Thu, 4 Apr 2013 14:47:38 +0000]
Windows: Avoid unnecessary Ccb->DirectoryCB->ObjectInformation

In almost all cases where an AFSCcb is present the associated AFSFcb
is also present.  The AFSFcb has a direct pointer to the AFSObjectInfoCB.
This patchset replaces the Ccb->DirectoryCB->ObjectInformation references
with Fcb->ObjectInformation.  This avoids one level of pointer indirection
and will make it easier to remove the DirectoryCB ObjectInformation
pointer in the future.

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

7 years agoWindows: AFSInitPIOCtlDirectoryCB Vol ObjInfoTree
Jeffrey Altman [Thu, 4 Apr 2013 03:37:53 +0000]
Windows: AFSInitPIOCtlDirectoryCB Vol ObjInfoTree

Hold the VolumeCB->ObjectInfoTree.TreeLock exclusively when calling
AFSAllocateObjectInfo() in order to protect the lists of child objects.

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

7 years agoWindows: Switch to Interlocked ops for RDR Set/Clear
Jeffrey Altman [Thu, 4 Apr 2013 03:33:40 +0000]
Windows: Switch to Interlocked ops for RDR Set/Clear

Switch to using interlocked operations for the SetFlag and ClearFlag
macros.

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

7 years agoWindows: AFSDeleteDirEntry set input to NULL
Jeffrey Altman [Tue, 2 Apr 2013 18:13:57 +0000]
Windows: AFSDeleteDirEntry set input to NULL

AFSDeleteDirEntry() frees the memory allocated to the DirectoryCB.
To ensure that an invalid memory pointer is not accidentally used
by the caller after the memory is freed, use
InterlockedCompareExchangePointer() to set the input parameter to
NULL prior to destroying the DirectoryCB.

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

7 years agoWindows: AFSPrimaryVolumeWorkerThread reorg
Jeffrey Altman [Tue, 2 Apr 2013 04:46:27 +0000]
Windows: AFSPrimaryVolumeWorkerThread reorg

Periodically there is a lost race which results in a valid DirectoryCB
with a non-NULL ObjectInformation pointer that refers to freed memory.
This major reorganization simplifies the logic and attempts to close
potential loopholes.

First, the AFSExamineDirectory() function is removed and replaced by
a call to AFSDeleteDirEntry().  The AFSExamineDirectory() function
examined all of the children AFSObjectInfoCB objects which in turn
duplicated much of the logic of AFSExamineObjInfo at the cost of
increased complexity due to the additional layer of locked objects.
Once the AFSDirectoryCB is removed a subsequent pass of the worker
thread will free the AFSObjectInfoCBs.

Second, the AFS_OBJECT_REFERENCE_DIRENTRY category had been used for
both DirectoryCB references and the Pioctl references.  A new
AFS_OBJECT_REFERENCE_PIOCTL category has been created to improve the
ability to track the allocations and releases.

Third, the AFSPrimaryVolumeWorker thread now attempts to hold onto the
VolumeCB TreeLock exclusively.  Previously the lock was held shared.
However, it is not safe for both the garbage collection and the find
routines to both be shared.  One has to be exclusive.  Although holding
the TreeLock exclusively in the garbage collection processing will result
in the lock being held for extended periods of time, it is more likely
that there will be benefits from parallel access during AFSFindObjectInfo()
calls.

Attempts to obtain most other locks are non-blocking.  If the lock cannot
be obtained, the object must be in use.  Therefore, it should not be
garbage collected.

Change-Id: I75e0302c1737aadfbd9afc0c8a03e28513e785f5
Reviewed-on: http://gerrit.openafs.org/9720
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: FindObjectInfo refcnt under lock
Jeffrey Altman [Tue, 2 Apr 2013 04:40:54 +0000]
Windows: FindObjectInfo refcnt under lock

AFSFindObjectInfo performed the search of Volume object tree protected by
the TreeLock but dropped the lock before incrementing the reference count.
This behavior contributed to a race with the AFSPrimaryVolumeWorkerThread
which has to drop the VolumeCB TreeLock periodically in order to safely
cleanup FCBs.

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

7 years agoWindows: AFSDeleteDirEntry Protect against NULL reference
Jeffrey Altman [Thu, 28 Mar 2013 04:32:37 +0000]
Windows: AFSDeleteDirEntry Protect against NULL reference

Now that AFSDeleteDirEntry can be called with a DirectoryCB
whose ObjectInformation pointer can be NULL, protect against unintentional
dereference.

Change-Id: I6ffd21c35da5581a7ebac6987324e2ff3a8ccd2b
Reviewed-on: http://gerrit.openafs.org/9691
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
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>

7 years agoWindows: AFSDeleteObjectInfo AFS_OBJECT_HELD_IN_SERVICE
Jeffrey Altman [Tue, 26 Mar 2013 13:02:00 +0000]
Windows: AFSDeleteObjectInfo AFS_OBJECT_HELD_IN_SERVICE

Move the check for AFS_OBJECT_HELD_IN_SERVICE until after the TreeLock
is held.

Change-Id: I38d095c83dc5878770a7a31bee08048a777cb3cb
Reviewed-on: http://gerrit.openafs.org/9674
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 comment to AFSInitDirEntry
Jeffrey Altman [Tue, 26 Mar 2013 13:01:17 +0000]
Windows: Add comment to AFSInitDirEntry

Change-Id: I6e6164b1dd5c7c8a2c51bcb4cba47667bd343e79
Reviewed-on: http://gerrit.openafs.org/9673
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
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: AFSDeleteDirEntry deleted flag shuffle
Jeffrey Altman [Tue, 26 Mar 2013 12:59:14 +0000]
Windows: AFSDeleteDirEntry deleted flag shuffle

Move the assignment of the deleted flag earlier in AFSDeleteDirEntry()
to avoid potential invalid memory access.

Change-Id: I6d0e1272cc9f2bb491ad291a65b94c53ced9a354
Reviewed-on: http://gerrit.openafs.org/9672
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: Protect AFSDeleteObjectInfo calls
Jeffrey Altman [Tue, 26 Mar 2013 12:56:19 +0000]
Windows: Protect AFSDeleteObjectInfo calls

Only permit AFSDeleteObjectInfo() to be called if the reference
count returned by AFSObjectInfoDecrement() is zero.

Change-Id: I6fd65ac41467ec2aa82d4f86f0d57f91595930c1
Reviewed-on: http://gerrit.openafs.org/9671
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
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: AFSExamineObject() refcnt underflows
Jeffrey Altman [Tue, 26 Mar 2013 12:52:59 +0000]
Windows: AFSExamineObject() refcnt underflows

Now that the reference counting is likely to be correct, do not
garbage collect objects with negative reference counts.  If the
reference counts are wrong the objects will never be destroyed but
that is now a safer choice than freeing memory that might be in use.

Change-Id: Ic8e781c4a775f8bcc66227b6f08f894c2fb85157
Reviewed-on: http://gerrit.openafs.org/9670
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
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 agovos: Restore some VNOVOL error messages
Andrew Deason [Wed, 3 Apr 2013 21:39:07 +0000]
vos: Restore some VNOVOL error messages

Many places in vos/vsprocs have code to delete a volume. Commit
f4e73067cdef990262c69c38ac98761620a63f25 tried to refactor them by
consolidating the common "delete" code into DoVolDelete. However, not
all of the removed code had exactly the same behavior, and some of
these variants were not handled by DoVolDelete.

One such variation is that DoVolDelete always printed an error message
if the target volume did not exist. But for some call sites this
condition is not an error, and prior to the refactoring they did not
print such an error message. Commit
1092cbe34fc8519826b3fa0565505b7bd81bc922 tried to correct this by
suppressing the error message if the target volume does not exist.
However, this means that all DoVolDelete calls do not print such an
error, where some should and some should not print an error. This
means that in some edge cases when we encounter an unexpected VNOVOL
error, we now skip printing the specific error we got and instead go
right to cleanup/recovery/exit. For a few other cases, we used to
print an error and continue (because it is a non-fatal error or a
warning), but now we print nothing when we encounter a VNOVOL error.

Fix this by specifically printing an error for the VNOVOL error for
DoVolDelete call sites that used to print such an error. Do this for
all such sites except ones where we obviously print an error
immediately afterwards anyway.

This is just a quick targeted fix. A future more robust fix should
involve altering DoVolDelete to handle all of the different behaviors
expected by its various callers.

Change-Id: Ia79bce3d2fed4acd62d517064db5b6be77f6e987
Reviewed-on: http://gerrit.openafs.org/9704
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

7 years agoWindows: FileSystemAttributes = FILE_READ_ONLY_VOLUME
Jeffrey Altman [Sun, 31 Mar 2013 00:16:48 +0000]
Windows: FileSystemAttributes = FILE_READ_ONLY_VOLUME

Instead of testing for Characteristics = FILE_READ_ONLY_DEVICE
which applies to the entire device, only return media protected
errors if the volume FileSystemAttributes include FILE_READ_ONLY_VOLUME.

Change-Id: Ice716083c7f0ecb9e80d0ca9e3e143249293d28e
Reviewed-on: http://gerrit.openafs.org/9699
Tested-by: BuildBot <buildbot@rampaginggeek.com>
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: RDR DeviceObject Characteristics
Jeffrey Altman [Sun, 31 Mar 2013 00:15:42 +0000]
Windows: RDR DeviceObject Characteristics

Set both FILE_DEVICE_SECURE_OPEN and FILE_DEVICE_REMOTE when
creating Device Objects for the AFS Redirector.

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

7 years agoWindows: Move AFSVolume functions to new file
Jeffrey Altman [Sat, 30 Mar 2013 23:58:12 +0000]
Windows: Move AFSVolume functions to new file

In an effort to declutter AFSFcbSupport.cpp, move AFSVolume
functions to a new source file, AFSVolume.cpp.

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

7 years agoWindows: Move Name Array functions to new file
Jeffrey Altman [Sat, 30 Mar 2013 23:54:11 +0000]
Windows: Move Name Array functions to new file

In an effort to reduce some of the clutter in AFSGeneric.cpp,
move the Name Array functions to AFSNameArray.cpp.

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

7 years agovolser: Make VolListOneVolume errors consistent
Andrew Deason [Tue, 26 Mar 2013 22:50:31 +0000]
volser: Make VolListOneVolume errors consistent

Currently, VolXListOneVolume errors out with ENODEV if any attachment
error occurs with the specified volume. But VolListOneVolume always
returns success if it can find the indicated volume, and any
attachment errors and such are reported in the 'status' field of the
volume info structure.

These two functions do pretty much the same thing; VolXListOneVolume
just provides more info than VolListOneVolume. So make them behave the
same way, and provide more specific information, whether or not
somebody ran 'vos examine' or 'vos examine -extended'.

The 'vos' binary has always handled errors in the 'status' volume info
structure for both "extended" and non-"extended" queries. This
difference appears to just have been a mistake from OpenAFS 1.0.

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

7 years agovolser: Restore Vol*ListOneVolume error handling
Andrew Deason [Tue, 26 Mar 2013 22:26:23 +0000]
volser: Restore Vol*ListOneVolume error handling

In the 1.4 series, the volserver VolListOneVolume function always
returned success if the specified volume was found in any way, and
ENODEV otherwise. The VolXListOneVolume returned ENODEV if the volume
was not found, or if any error occurred.

DAFS (specifically, commit ed25934c1fe96b143715025b49104e75dce9a361)
changed these so they both behave the same way. That is, they both
return success if the volume was found at all, and ENODEV otherwise.

Commit 53cc2ebaea5e5488d5285f0d13ffa47069ee986f changed both of these
functions so that we always return an error on any attachment error.

These changes mean that a 'vos examine' for a volume with an existing
volume transaction now indicates that a volume is offline/unattached,
but in the 1.4 series, the volume was indicated as "busy".

So, restore the original 1.4 behavior of these functions, so the
volume status is reported as it always was. This effectively reverts
53cc2ebaea5e5488d5285f0d13ffa47069ee986f, and slightly changes the
post-DAFS code to look more like the 1.4 code. This also removes the
'code' variable from VolListOneVolume and adds an explicit comment
about what's going on, to make this a little more clear.

While changing the behavior of VolXListOneVolume to match that of
VolListOneVolume perhaps makes sense, for now just restore the exact
1.4 behavior, and make the function flow look a little more like the
1.4 code did. A future change may make them the same again.

Reported by Andy Malato.

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

7 years agoWindows: AFSDeleteObjectInfo InterlockedCompareExchangePointer
Jeffrey Altman [Thu, 28 Mar 2013 16:06:34 +0000]
Windows: AFSDeleteObjectInfo InterlockedCompareExchangePointer

Correct the third parameter passed to InterlockedCompareExchangePointer
in AFSDeleteObjectInfo() which prevented *ppObjectInfo from being set
to NULL.

Change-Id: I4edc1d69114c02ffff8181b176a5f0bac82f6802
Reviewed-on: http://gerrit.openafs.org/9689
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: additional AFS_SUBSYSTEM_OBJECT_REF_COUNTING
Jeffrey Altman [Thu, 28 Mar 2013 04:28:35 +0000]
Windows: additional AFS_SUBSYSTEM_OBJECT_REF_COUNTING

Add missing cases of reference count value changes which were
not being logged.

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

7 years agopackaging: remove largefile-fileserver option from spec file
Arne Wiebalck [Wed, 20 Feb 2013 15:09:06 +0000]
packaging: remove largefile-fileserver option from spec file

Remove the obsolete --enable-largefile-fileservers option from
the RedHat spec file.

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

7 years agoWindows: add AFS_OBJECT_REFERENCE_FS_REQ
Jeffrey Altman [Tue, 26 Mar 2013 12:21:49 +0000]
Windows: add AFS_OBJECT_REFERENCE_FS_REQ

Add a new object reference category AFS_OBJECT_REFERENCE_FS_REQ which
is used to avoid overloading AFS_OBJECT_REFERENCE_DIRENTRY.

Change-Id: I428940005dd7b4502329d4171b7307282099af44
Reviewed-on: http://gerrit.openafs.org/9668
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: cache readonly volume size information
Jeffrey Altman [Wed, 27 Mar 2013 04:49:56 +0000]
Windows: cache readonly volume size information

Cache the volume size information for .readonly volumes which can
be reset when the volume callback is broken.  This reduces the number
of RXAFS_GetVolumeStatus RPC calls issues on .readonly volumes.

Change-Id: Ie0e63ca9082a004da71098e28df1315d42d364ff
Reviewed-on: http://gerrit.openafs.org/9681
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: btree enumeration bulk stats
Jeffrey Altman [Tue, 26 Mar 2013 13:08:58 +0000]
Windows: btree enumeration bulk stats

Each of the btree enumeration bulk stat operations include the
directory object in the bulk stat list.  If the only object in the
list is the directory object, do not perform the bulk stat rpc as
it just wastes time.  All of the required objects are already cached
with current callbacks.

Change-Id: Ic0fac50f36bdca1e79f48ca308c373a2b3152675
Reviewed-on: http://gerrit.openafs.org/9675
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 agoFix build with separate objdirs
Ben Kaduk [Tue, 26 Mar 2013 21:57:28 +0000]
Fix build with separate objdirs

The conversion of pam/ to use libtool introduced references to
file names with LT_CCRULE that are not subject to make's vpath
searching.

Sprinkle ${srcdir} accordingly to fix the build.

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

7 years agovolser: Indicate busy volume with VBUSY
Andrew Deason [Tue, 26 Mar 2013 22:00:05 +0000]
volser: Indicate busy volume with VBUSY

Commit 34fc86bcc749f3bd059831b7e5dae03dc09a9393 changed several uses
of VBUSY to VOLSERVOLBUSY in order to detect retriable operations.
However, one such change did not change an Rx abort code, but instead
was used for the 'status' field for a volintInfo or volintXInfo
structure. That is not really a general error code, but a field with a
few specific known values (at least, that is how existing clients
interpret it).

Go back to using VBUSY, so clients indicate the volume as busy,
instead of as offline/unattached.

Reported by Andy Malato.

Change-Id: Ia569633d98266cb15c059e66150d8d7f91d20dca
Reviewed-on: http://gerrit.openafs.org/9678
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 agoaklog: Only try to use krb5-weak.conf if it exists
Andrew Deason [Tue, 26 Mar 2013 18:27:33 +0000]
aklog: Only try to use krb5-weak.conf if it exists

The logic we use for using krb5-weak.conf to allow 'weak crypto'
requires us to know where the default krb5.conf is. The default
krb5.conf local can vary significantly depending on the platform, and
we don't have a good way of figuring out what it is, so we guess. We
may guess wrong.

To limit the cases where we guess wrong, only try to do this
workaround if the krb5-weak.conf file actually exists.

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

7 years agoFix DARWIN build with clang
Ben Kaduk [Tue, 26 Mar 2013 21:42:38 +0000]
Fix DARWIN build with clang

In 1d8937b86050 we added a function call to kauth_cred_unref in the
DARWIN100 case (replacing a macro), but added the inclusion of
sys/kauth.h only when using versions older than DARWIN80.
On DARWIN100 and above, clang detects that the now-implicit function
declaration is in conflict with the actual prototype, which is included
later through afs/sysincludes.h when compiling the kernel rx code.

Since including sys/kauth.h seems to have been harmless for old versions,
just include it always.

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

7 years agoaklog: Search for /etc/krb5/krb5.conf
Andrew Deason [Tue, 26 Mar 2013 18:14:30 +0000]
aklog: Search for /etc/krb5/krb5.conf

aklog tweaks the KRB5_CONFIG environment var when performing one of
our 'weak crypto' workarounds. We assume that the default krb5.conf is
/etc/krb5.conf, but for Solaris 11 libkrb5, krb5.conf is in
/etc/krb5/krb5.conf. Although this file could be anywhere, try
/etc/krb5/krb5.conf too, so we at least work on stock Solaris.

Change-Id: I1f53b9b58549da04f2a27f1f579dd0084796e51d
Reviewed-on: http://gerrit.openafs.org/9666
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 agodafs: prevent corruption in large fsstate.dat files
Mark Vitale [Wed, 13 Mar 2013 02:13:20 +0000]
dafs: prevent corruption in large fsstate.dat files

If while writing to the fsstate.dat file, it exceeds the current
size of the file (multiples of FS_STATE_INIT_FILESIZE (8MiB)),
we call fs_stateResizeFile.  This un-mmaps, truncates, and
re-mmaps the file.  Unfortunately, fs_stateMapFile() resets the
state->mmap.offset and .cursor, so any writes in flight over
the resize will overwrite the first bytes of the file (and leave
zeros in the file where the data should have been written).

Upon return from the write that caused a file resize, the offset
is eventually corrected and the state dump continues with a
silent failure.  Eventually the state dump completes and the
file header is rewritten; this may conceal some or all of
the overwrite damage at offset 0.  However, any zeros near the 8MiB
offset (and its multiples) remain as corruption.

Add a flag to fs_stateMapFile() to allow the caller to specify if
the offset and cursor should be preserved.  Modify fs_stateResizeFile()
to use this capability.

testing note: temporarily reduced FS_STATE_INIT_FILESIZE to 256 bytes
during testing in order to make the problem easier to reproduce.
This problem would normally occur only on relatively large/active
DAFS fileservers.

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

7 years agosalvager: prevent assertion during -orphans attach
Mark Vitale [Fri, 25 Jan 2013 23:47:49 +0000]
salvager: prevent assertion during -orphans attach

Improve JudgeEntry() detection of orphaned directories to
prevent unintentional deletion of their '.' and '..' entries.
This in turn prevents a later assert (opr_Verify) when we try to
delete and re-add '..' in order to attach the orphan.

In JudgeEntry(), 2 sources of information about a
directory entry are compared for consistency:
 - vnodeEssence (unique) from its vnode index entry
 - name, vnodeNumber and unique from its dir blob entry

A directory entry may be ignored, deleted, or repaired/replaced,
based upon the results of these and other tests (e.g. dirOprhaned).

The '.' and '..' entries are treated as special cases because
we do not want to delete them at this point if this directory
is orphaned.  However, the current test for orphanhood
(vnodeEssence->unique == 0) is not sufficient; it could be
zero for other reasons.  This commit now uses the dirOrphaned
flag to test for this.

However, we are still interested in doing the right thing
for '.' and '..' entries with vnodeEssence->unique == 0.
This may indicate that the dir blob entry is pointing at the
wrong vnode, and that vnode has unique==0.  The current code
incorrectly ignores (returns 0) this case.  This commit now
now falls through to the repair/replace code so that we can
find the correct vnode for this entry.

The current code assumes that the 'vnodeEssence == 0 &&
!dirOrphaned' case doesn't exist.

Thanks to Andrew Deason for his assistance.

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

7 years agoEnable dvolser and tvolser for FreeBSD
Ben Kaduk [Wed, 13 Mar 2013 17:27:32 +0000]
Enable dvolser and tvolser for FreeBSD

The top-level Makefile did not recurse into dvolser or tvolser for
FreeBSD.  They compile just fine, so enable them.

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

7 years agoutil: fix dirpath use of clntEtcDir on Windows
Jeffrey Altman [Tue, 19 Mar 2013 20:14:18 +0000]
util: fix dirpath use of clntEtcDir on Windows

When commit 9b0a7f5d13115fe5760db16587fe81dd35a5a0ef added the variable
'clntEtcDir' it failed to assign it a value on Windows.

Change-Id: I02cfb994a28e3e1032741d1b2710acb5d40d9bfd
Reviewed-on: http://gerrit.openafs.org/9635
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 agovol: remove duplicate stmp declaration
Jeffrey Altman [Fri, 15 Mar 2013 03:27:25 +0000]
vol: remove duplicate stmp declaration

Patchset 38cf31463e3f3c675de727c1e793e117a90e6d20 added a definition of
afs_ino_str_t stmp which should have replaced the b64_string_t stmp
declaration that was already present.

Thanks to Jason Madar for noticing.

FIXES 131620

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

7 years agoUpdate NEWS for 1.6.2.1
Stephan Wiesand [Thu, 14 Mar 2013 09:35:30 +0000]
Update NEWS for 1.6.2.1

Change-Id: I2c08474cc6034d40cef0d77d94c070bcdd8d4563
Reviewed-on: http://gerrit.openafs.org/9602
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

7 years agoMake NEWS match the 1.6.2 Release Notes
Stephan Wiesand [Thu, 14 Mar 2013 09:16:30 +0000]
Make NEWS match the 1.6.2 Release Notes

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

7 years agoWindows: Create Symlinks in Volume Roots
Jeffrey Altman [Sat, 23 Mar 2013 01:14:48 +0000]
Windows: Create Symlinks in Volume Roots

Permit the CreateSymbolicLink API to create symlinks in volume
root directories.

Change-Id: I779f127f9a7e4ddfee41fe7a9398f20175843be0
Reviewed-on: http://gerrit.openafs.org/9656
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: Robocopy Symlinks
Jeffrey Altman [Fri, 22 Mar 2013 20:10:54 +0000]
Windows: Robocopy Symlinks

This patchset enables AFS Symlinks and DFSlinks to be copied to
a local NTFS disk using robocopy's /SL option.

Separate print names and substitute names are now provided permitting
the reparse data copied from AFS to be applied to a local disk object
for recreation.

Change-Id: I7bab4e8352a069a14b9ac4b3b2e22819f3de7a23
Reviewed-on: http://gerrit.openafs.org/9655
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: NPAddConnection no local name and connected
Jeffrey Altman [Thu, 21 Mar 2013 11:57:34 +0000]
Windows: NPAddConnection no local name and connected

The WN_ALREADY_CONNECTED error is only to be returned if a local
device name (aka drive letter) is provided in the request.  Otherwise,
the proper return status is WN_SUCCESS if an unnamed connection is
requested.

Change-Id: I1e1ca47a84e353db66e2830ec11f968a3578c4f6
Reviewed-on: http://gerrit.openafs.org/9642
Tested-by: BuildBot <buildbot@rampaginggeek.com>
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: NPCancelConnection without drive letter
Jeffrey Altman [Wed, 20 Mar 2013 20:23:59 +0000]
Windows: NPCancelConnection without drive letter

When canceling a network connection to a UNC path, do not match
connections that have drive letters assigned.  Only cancel the connection
if there it matches the UNC path and has no local name.

Change-Id: I2c27c6d08cec65406f7e7f9eb61cd6d6c7be1f5c
Reviewed-on: http://gerrit.openafs.org/9640
Tested-by: BuildBot <buildbot@rampaginggeek.com>
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: AFSDeleteObjectInfo InterlockedExchange
Jeffrey Altman [Fri, 22 Mar 2013 04:54:36 +0000]
Windows: AFSDeleteObjectInfo InterlockedExchange

Use InterlockedExchangePointer to disconnect the ObjectInformationCB
pointer from the caller.  This ensures that only one thread can
successfully call AFSDeleteObjectInfo on the same object at a time.

Change-Id: Ie70f52fc443f88c3cb4be41f12caa91466d92905
Reviewed-on: http://gerrit.openafs.org/9644
Tested-by: BuildBot <buildbot@rampaginggeek.com>
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: FSCTL_SET_REPARSE_POINT NULL ptr dereference
Jeffrey Altman [Thu, 21 Mar 2013 23:34:25 +0000]
Windows: FSCTL_SET_REPARSE_POINT NULL ptr dereference

Avoid a potential NULL pointer dereference if the ParentObjectInfo
object cannot be found.  If the Btree lookup fails, do not call
AFSCreateSymlink() and do not decrement the ObjectInfo refcount.
Doing so will result in a BSOD.

Change-Id: Ibd3e4ebb343f6c3cff8bf1cb160e42938d0f906c
Reviewed-on: http://gerrit.openafs.org/9643
Tested-by: BuildBot <buildbot@rampaginggeek.com>
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: Remove Driver Verifier warning of memory leak
Jeffrey Altman [Thu, 21 Mar 2013 10:28:25 +0000]
Windows: Remove Driver Verifier warning of memory leak

Work items are now queued in an AFSRedir.sys data structure
and are not freed when AFSRedirLib.sys is unloaded.  Therefore,
do allocate the memory with AFSLibExAllocatePoolWithTag().
The allocation by AFSLibExAllocatePoolWithTag results in a false
Driver Verifier warning of a memory leak on unload.

Change-Id: I268c4b6d20090e88114456a24b7648eef59f6289
Reviewed-on: http://gerrit.openafs.org/9641
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
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: buf_ClearRDRFlag and cm_directIO
Jeffrey Altman [Wed, 20 Mar 2013 14:10:03 +0000]
Windows: buf_ClearRDRFlag and cm_directIO

When 'cm_directIO' is true, there are no RDR held buffers therefore
there is nothing for buf_ClearRDRFlag() to do.  Do not pass 'Go',
do not obtain cm_scache.rw exclusive nor buf_globalLock shared.
Simply return immediately.

Change-Id: I4c6d1486e3a2bef987a3eb36d8de446e9009e0d2
Reviewed-on: http://gerrit.openafs.org/9638
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: buf_RDRBuffersExist and cm_directIO
Jeffrey Altman [Wed, 20 Mar 2013 14:08:21 +0000]
Windows: buf_RDRBuffersExist and cm_directIO

If 'cm_directIO' is true, then no RDR buffers exist.  Return immediately,
do not pass 'Go', and do not lock and walk the buffer hash table.

Change-Id: I9c6499d429d7591c8bd67ce3077ff4c4e7d6d62d
Reviewed-on: http://gerrit.openafs.org/9637
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: buf_CleanVnode avoid lock contention
Jeffrey Altman [Wed, 20 Mar 2013 14:04:41 +0000]
Windows: buf_CleanVnode avoid lock contention

In the middle of the big loop do not obtain buf_globalLock unless
cm_buf.qFlags & CM_BUF_QREDIR is non-zero.  buf_globalLock is heavily
contested and any reduction in contention is an improvement.
CM_BUF_QREDIR is never set when 'cm_directIO' is true (now the default)
so this is a huge win.

Change-Id: I0b150bf77a0f1d748f94026d3b74bc7d90e7c3c6
Reviewed-on: http://gerrit.openafs.org/9636
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: AFSQueryDirectoryQueryDirect no Symlinks
Jeffrey Altman [Tue, 19 Mar 2013 15:48:42 +0000]
windows: AFSQueryDirectoryQueryDirect no Symlinks

When evaluating symlinks for directory enumerations, the response
must properly set the FILE_ATTRIBUTE_DIRECTORY flag based upon the
file attributes of the target.  At the present time the target is
not evaluated by the service and AFSQueryDirectoryQueryDirect does
not have the correct context in which to evaluate the target.

Instead of returning an incorrect result to the application, exit
AFSQueryDirectoryQueryDirect() returning STATUS_REPARSE_OBJECT which
is interpreted by AFSQueryDirectory() to perform a full directory
enumeration.

Change-Id: Ic35dcff31f1098b9f40f3a37534b79439e0e3f1f
Reviewed-on: http://gerrit.openafs.org/9633
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: 1.7.23 Release Notes
Jeffrey Altman [Tue, 19 Mar 2013 02:43:09 +0000]
Windows: 1.7.23 Release Notes

Add explanation of Win 7 Explorer Shell Read-Only Volume vs Network Drive
Letter Mapping bug.

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

7 years agoLinux 3.9: hlist iterator change
Marc Dionne [Wed, 6 Mar 2013 01:54:50 +0000]
Linux 3.9: hlist iterator change

hlist iterators have been reworked to not require a temporary
node parameter.

Change-Id: Ibea1295163bd39ff2901a2194aa46c3d342f5128
Reviewed-on: http://gerrit.openafs.org/9403
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: Avoid cm_Analyze race on cm_serverRef lists
Jeffrey Altman [Mon, 18 Mar 2013 16:07:55 +0000]
Windows: Avoid cm_Analyze race on cm_serverRef lists

cm_Analyze() accepted as a parameter a pointer to the first element
on a cm_serverRef list which is only ever used for VL operations.

cm_Analyze() would separately call cm_GetVolServerList() to obtain
the cm_serverRef list for RXAFS operations.  Then the variable 'serversp'
would be set to the first element of the list.

'serversp' was then used to refer to the list and would be passed to
cm_SetServerBusyStatus() and cm_ResetServerBusyStatus() which would
in turn obtain the cm_serverLock while it manipulated the cm_serverRef
status flags for the elements in the list.

The problem is that passing a pointer to the first element of the
cm_serverRef list without holding cm_serverLock can permit the list
contents to be altered including removal of the first element.  If the
race is lost and the memory associated with the first element is freed
before access, the afsd_service.exe will crash.

This patchset makes a number of changes.  First, the cm_serverRef_t
parameter is changed from a pointer to the first element of the list
to be a pointer to the HEAD pointer of the list.  Since it is ever only
used for cm_cell.vlServerp lists, the parameter is renamed to
'vlServerspp'.   Second, a separate "cm_serverRef_t ** volServerspp"
variable is allocated for the return value from the cm_GetVolServerList()
operations.

cm_SetServerBusyStatus() and cm_ResetServerBusyStatus() are altered to
accept a pointer to the HEAD of the list instead of a pointer to the first
element.  The cm_serverLock is now held read instead of write because the
list itself is not being altered.  All of the state changes being applied
to the cm_serverRef objects are atomic.

Finally, cm_serverLock is held across all list traversals within
cm_Analyze().  A read lock is obtained if the elements of the list are not
being removed or inserted and a write lock is obtained if they are.

Change-Id: I48464e90a828706dad442c019c75a717b06d690b
Reviewed-on: http://gerrit.openafs.org/9625
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: Replace AFSDbgMsgLog func with macro
pete scott [Wed, 13 Mar 2013 13:54:00 +0000]
Windows: Replace AFSDbgMsgLog func with macro

In order to reduce computation overhead when trace logging is not
active replace the AFSDbgMsgLog function call with a macro,
AFSDbgTrace.

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

7 years agoWindows: Test AFS_DBG_FLAG_BREAK_ON_ENTRY earlier
Jeffrey Altman [Sun, 17 Mar 2013 12:43:39 +0000]
Windows: Test AFS_DBG_FLAG_BREAK_ON_ENTRY earlier

During AFSRedir.sys initialization, check the AFS_DBG_FLAG_BREAK_ON_ENTRY
registry flag before initializing the trace log system.

Change-Id: I928fab78b40dce51d2c0686bce68eb76f941b214
Reviewed-on: http://gerrit.openafs.org/9622
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: Increase AFS DeviceObject StackSize
Jeffrey Altman [Fri, 15 Mar 2013 15:40:29 +0000]
Windows: Increase AFS DeviceObject StackSize

Increase the StackSize parameter of the DeviceObjects allocated
by the AFS Redirector framework.  The StackSize parameter is used
to notify callers how many Irp Stack frames will be consumed.  Now
that the redirector is using IoCompletion routines, an additional
stack frame is required to handle calls to the AFS Redirector library
driver.

Thanks to Peter Scott for identifying the solution.

FIXES 131618

Change-Id: Ib66f884911f0d425e6e07f338a36b3ebedeb8871
Reviewed-on: http://gerrit.openafs.org/9609
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>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

7 years agoWindows: File Attribute Reporting Consistency
Jeffrey Altman [Sat, 16 Mar 2013 05:18:14 +0000]
Windows: File Attribute Reporting Consistency

Do a better job of consistently reporting file attribute information
via directory queries and file information queries.  Avoid computing file
attribute information for file information queries that do not return them
(e.g., Name Information) because computing it is expensive.

Change-Id: I5c8120698261f555edfa98e92230705b593aca36
Reviewed-on: http://gerrit.openafs.org/9613
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: netbios name comparisons are case insensitive
Jeffrey Altman [Sat, 16 Mar 2013 05:15:01 +0000]
Windows: netbios name comparisons are case insensitive

When parsing the symlink target string to categorize it as AFS Symlink
or DFS Link, the comparison with the netbios name string must be case
insensitive.  Otherwise, symlinks are reported to the redirector as
DFS Links.  For the most part they will work since the AFS redirector
requesting MUP to Reparse the \\AFS path will call back into the AFS
redirector.  However, the attributes on symlinks to files will be wrong
as DFS Links can only be links to directories.

Change-Id: Ia9652991549b0783f7a534b071ff99ceabdd3382
Reviewed-on: http://gerrit.openafs.org/9612
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 RDR_ExtAttributes
Jeffrey Altman [Sat, 16 Mar 2013 05:13:01 +0000]
Windows: add RDR_ExtAttributes

Add RDR_ExtAttributes to compute the file attributes for redirector
queries.   The attributes reported via the RDR interface need to be
different from the SMB interface because the SMB interface does not
support reparse points nor does it support DFSLinks.

Change-Id: I5d5172f5afc1d50e2622e2068e20447cd1098fbb
Reviewed-on: http://gerrit.openafs.org/9611
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: drive mapping enumeration infinite loop
Jeffrey Altman [Fri, 15 Mar 2013 17:07:21 +0000]
Windows: drive mapping enumeration infinite loop

If WNetEnumResource returns an error as opposed to success, such as
ERROR_UNEXP_NET_ERR, the enumeration loop would retry forever passing
zero for 'cEntries' which in turn results in a successful response
containing zero entries.

Change the while conditional to test for continued success instead
of ERROR_NO_MORE_ENTRIES.

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