openafs.git
12 years agorx: Turn the rxevent_Cancel macro into a function
Simon Wilkinson [Sat, 22 Oct 2011 15:37:04 +0000]
rx: Turn the rxevent_Cancel macro into a function

Turn rxevent_Cancel into a function rather than a macro which modifies
its argument as a side effect. rxevent_Cancel now checks whether the
event being cancelled is already NULL, as well as NULLifying the event
when it is actually cancelled.

Update all of the callers to reflect this new API, and so they no
longer do unecessary work.

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

12 years agorx: New signature for rx event functions
Simon Wilkinson [Sat, 22 Oct 2011 15:22:36 +0000]
rx: New signature for rx event functions

For a while now, we've had both new and old-style rx event callback
functions. Modify all of our event handlers, and the functions that
install them, to use only new style functions, and get rid of the
old-style function prototypes.

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

12 years agoopr: Add a red/black tree implementation
Simon Wilkinson [Sat, 22 Oct 2011 10:22:51 +0000]
opr: Add a red/black tree implementation

Add an implementation of red/black trees to our runtime library.

This is originally derived from the FreeBSD macro-based rbtree
implementation, but is heavily reworked to not use macros, to improve
legibility, and to favour speed over structure compactness.

A test suite is provided in tests/opr/

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

12 years agorx: Add a helper function for delayed acks
Simon Wilkinson [Sat, 22 Oct 2011 10:10:53 +0000]
rx: Add a helper function for delayed acks

The code to schedule a new delayed ack event is distributed throughout
the RX code. Consolidate this into a single helper function.

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

12 years agoopr: Add opr_containerof
Simon Wilkinson [Sat, 22 Oct 2011 08:45:10 +0000]
opr: Add opr_containerof

Add the opr_containerof macro, which can be used to find the base
address of a structure which contains a member whose location is known.

This formulation is heavily used throughout OpenAFS to determine the
base address of structures containing queue pointers - this provides
a central definition, rather than coding it from scratch each time.

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

12 years agoWindows: Add Vista/Win7 Firewall Configuration
Jeffrey Altman [Sat, 5 Nov 2011 08:10:42 +0000]
Windows: Add Vista/Win7 Firewall Configuration

Make use of the INetFwPolicy2 COM interface to configure
the Vista/Win7 firewall for all network profile types.

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

12 years agoWindows: Enforce Share Access
Jeffrey Altman [Wed, 5 Oct 2011 07:36:48 +0000]
Windows: Enforce Share Access

Use file server locks to enforce file share access modes
via the afs redirector interface.  The approach taken
integrates share mode enforcement with the file server
lock tracking code in the service.  The share mode
enforcement mimics that of the SMB Server interface.

This patchset includes two functional changes to
the previous locking and share mode processing:

 1. The cm_scache_t fsLockCount field is used to
    determine if the desired lock can be granted
    by the file server.  If not, the RXAFS_SetLock()
    request is skipped and the request is failed
    locally.

 2. cm_CheckNTOpen() now accepts the desired and
    and share access modes.  The share access mode
    is used to determine if a test lock should be
    obtained at all.  If the share mode is FILE_SHARE_WRITE
    then no lock is requested.  This change permits
    Microsoft Office applications to offer the user
    the ability to open the file in read-only mode
    and notify the user when the document can be
    opened in read-write mode.

Developed with Peter Scott <pscott@kerneldrivers.com>

FIXES 130239

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

12 years agoSOLARIS: Do not build x86 kernel module on 5.11
Andrew Deason [Thu, 10 Nov 2011 21:18:41 +0000]
SOLARIS: Do not build x86 kernel module on 5.11

Oracle Solaris 11 no longer supports x86 (amd64 is required). If we
try to build the x86 module, /usr/include/sys/kobj.h complains that
the ISA is unsupported, and refuses to go on. So, just remove
MODLOAD32 from the libafs directories to build on sunx86_511.

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

12 years agonamei: Remove extraneous rmdir
Andrew Deason [Thu, 10 Nov 2011 17:58:12 +0000]
namei: Remove extraneous rmdir

We just unlinked the file, so we know we won't be able to rmdir() the
same thing. Give a path one level higher to
namei_RemoveDataDirectories, so we start rmdir()ing at the parent dir.

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

12 years agovol: Remove O_EXCL|O_TRUNC combinations
Andrew Deason [Thu, 10 Nov 2011 17:05:28 +0000]
vol: Remove O_EXCL|O_TRUNC combinations

A few places were specifying both O_EXCL and O_TRUNC to open().
O_TRUNC does not make any sense with O_EXCL, and doesn't do anything,
so remove O_TRUNC from these instances to make the code more clear.

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

12 years agoWindows: FSCTL_SET_REPARSE_POINT not yet implemented
Jeffrey Altman [Thu, 10 Nov 2011 03:52:37 +0000]
Windows: FSCTL_SET_REPARSE_POINT not yet implemented

Since FSCTL_SET_REPARSE_POINT is not yet implemented
return STATUS_INVALID_PARAMETER to all requests that
do not fail validity tests.

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

12 years agoWindows: FSCTL_SET_REPARSE_POINT error
Jeffrey Altman [Thu, 10 Nov 2011 03:47:55 +0000]
Windows: FSCTL_SET_REPARSE_POINT error

According to MS_FSCC 2.3.54 if the input buffer length is less than the size
of a REPARSE_DATA_BUFFER structure, or the input buffer length is greater
than 16,384, or a REPARSE_DATA_BUFFER structure has been specified for a
third party reparse tag, or the GUID specified for a third party reparse tag
does not match the GUID known by the operating system for this reparse
point, or the reparse tag is 0 or 1, then the return status shall be
STATUS_IO_REPARSE_DATA_INVALID.

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

12 years agoWindows: FSCTL_IS_PATHNAME_VALID return success
Jeffrey Altman [Thu, 10 Nov 2011 03:45:07 +0000]
Windows: FSCTL_IS_PATHNAME_VALID return success

Windows NT, Windows 2000, Windows XP, Windows Server 2003, Windows Vista,
Windows Server 2008, Windows 7, and Windows Server 2008 R2 support the
FSCTL_IS_PATHNAME_VALID Request (section 2.3.21) and return STATUS_SUCCESS
whenever this request is invoked.  We will do the same.

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

12 years agoWindows: these fsctl cmds are not implemented
Jeffrey Altman [Thu, 10 Nov 2011 03:42:54 +0000]
Windows: these fsctl cmds are not implemented

Return STATUS_NOT_IMPLEMENTED since the following
FSCTL_ operations are not:

FSCTL_LOCK_VOLUME
FSCTL_UNLOCK_VOLUME
FSCTL_DISMOUNT_VOLUME
FSCTL_MARK_VOLUME_DIRTY
FSCTL_IS_VOLUME_DIRTY
FSCTL_IS_VOLUME_MOUNTED

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

12 years agoWindows: Additional trace logging
Jeffrey Altman [Thu, 10 Nov 2011 03:33:11 +0000]
Windows: Additional trace logging

Add additional trace logging to the redirector to assist
with debugging reparse point processing.

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

12 years agoWindows: service must set reparse point attribute
Jeffrey Altman [Thu, 10 Nov 2011 01:05:05 +0000]
Windows: service must set reparse point attribute

When populating the directory entry information for the
redirector the service must set the reparse point attribute.

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

12 years agoWindows: Correctly increment PIOCtl DE
Peter Scott [Thu, 10 Nov 2011 20:34:53 +0000]
Windows: Correctly increment PIOCtl DE

When performing a directory enumeraiton, correctly increment ref count on
the PIOCtl DE structures

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

12 years agoWindows: FileNetworkPhysicalNameInfo implementation
Peter Scott [Thu, 10 Nov 2011 16:06:53 +0000]
Windows: FileNetworkPhysicalNameInfo implementation

Handle this File information query

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

12 years agoWindows: improve store data parallelism
Jeffrey Altman [Mon, 31 Oct 2011 03:52:00 +0000]
Windows: improve store data parallelism

The file server will set the rx call status bit (0x1)
when the rpc is in process and all of the locks are held.
At this point it is not possible for another store data rpc
to begin on the vnode prior to the completion of the current
rpc.  Once this status bit is detected as set, the exclusive
store data synchronization on the cm_scache_t can be dropped.

This permits the next store data rpc to perform its biod
construction.

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

12 years agovolser: Preserve needsSalvaged during restore
Andrew Deason [Wed, 9 Nov 2011 23:04:09 +0000]
volser: Preserve needsSalvaged during restore

Some of the routines during a volume restore may set needsSalvaged, if
an inconsistency is detected while writing the given volume data.
However, after the data is read, we set the volume header information
to what was found in the dump stream, ignoring any needsSalvaged that
may have been set.

To ensure that inconsistent volumes in this situation actually get
demand-salvaged (for DAFS) or offlined (non-DAFS), keep the value of
needsSalvaged in the header, if it was set.

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

12 years agoviced: avoid bogus handle in rename
Derrick Brashear [Wed, 9 Nov 2011 15:34:10 +0000]
viced: avoid bogus handle in rename

because fileptr's handle can be reset during CopyOnWrite
we need to SetDirHandle after that call

FIXES 130215

Change-Id: I8578d30da42bdd9be2c552cdac4d2c526c22ee45
Reviewed-on: http://gerrit.openafs.org/5818
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoregen: Fail on failures
Andrew Deason [Tue, 8 Nov 2011 18:52:50 +0000]
regen: Fail on failures

If something fails, don't ignore the error.

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

12 years agoAdd "pretty" build option
Andrew Deason [Wed, 13 Apr 2011 18:15:57 +0000]
Add "pretty" build option

Add the capability to do a "pretty" build, where we output something
like "  CC  /path/to/foo.o" to build foo.o, instead of the entire
compiler invocation, similarly to how the Linux kernel build appears.
Add the "pretty" building for CC and LD rules.

This also prints out some helpful information when a command fails,
which can sometimes otherwise be annoying to figure out post-mortem.

To enable the pretty building, make with V=0. To output everything
that is actually run with V=0, make with 'V=0 Q=' .

Note that this does not work with all makes, since not all makes will
propagate command-line-specified variables to sub-makes without -e.
Non-working makes include /usr/ccs/bin/make on HP-UX and Solaris.
However, GNU make will work, as will /usr/xpg4/bin/make on Solaris.

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

12 years agoSpecify pattern rules in addition to suffix rules
Andrew Deason [Tue, 8 Nov 2011 18:29:39 +0000]
Specify pattern rules in addition to suffix rules

A few makefiles specify an old-style suffix rule, such as:

  .c.o:
          $(AFS_CCRULE) $<

Not all makes seem to interpret these rules correctly (such as Solaris
/usr/xpg4/bin/make). Since it is easy to do so, specify pattern-based
rules along with these, like so:

  %.o: %.c
          $(AFS_CCRULE) $<

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

12 years agoAdd setenv/unsetenv to roken
Andrew Deason [Thu, 3 Nov 2011 18:40:37 +0000]
Add setenv/unsetenv to roken

Add the replacement setenv and unsetenv functions to roken, for use on
(at least) HP-UX and older Solaris.

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

12 years agodafs: avoid null deref getting volume header
Derrick Brashear [Sun, 6 Nov 2011 21:28:27 +0000]
dafs: avoid null deref getting volume header

we don't assign hd before dereferencing. stop dereferencing
and just use the queue cursor.

Change-Id: I023fd959c5d49575dbdf89fd4dab77341c5c52d0
Reviewed-on: http://gerrit.openafs.org/5814
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agosalvager: Implement AskDAFS via SYNC flags
Andrew Deason [Thu, 3 Nov 2011 18:17:33 +0000]
salvager: Implement AskDAFS via SYNC flags

Instead of probing the DAFS-ness of the fileserver by probing which
FSSYNC opcodes it supports, detect DAFS-ness by looking at the SYNC
response header flags, which explicitly state whether or not the
endpoint is DAFS. This avoids unnecessary "protocol mismatch" log
messages when the endpoint is not DAFS.

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

12 years agoredhat: make rpms build on pre-f15 again
Derrick Brashear [Sat, 5 Nov 2011 15:24:43 +0000]
redhat: make rpms build on pre-f15 again

we don't have systemd everywhere. don't assume it

Change-Id: I4038bc1e1aff804e685d1987e368f2be1af35b05
Reviewed-on: http://gerrit.openafs.org/5813
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoukernel: handle pioctl errors properly in ktc
Derrick Brashear [Fri, 4 Nov 2011 15:43:01 +0000]
ukernel: handle pioctl errors properly in ktc

the straight return from call_syscall isn't what we want. munge so
e.g. EDOM handling for ktc_GetToken does the right thing.

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

12 years agolibafsauthent: Remove obsolete HP-UX workaround
Andrew Deason [Fri, 4 Nov 2011 21:12:03 +0000]
libafsauthent: Remove obsolete HP-UX workaround

This workaround is no longer relevant. It is also error-prone and
there are far better ways to achieve a similar result, so get rid of
it.

Change-Id: If77f0cd95c8c608913d0c8717729a05c1ad67df9
Reviewed-on: http://gerrit.openafs.org/5811
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agovolser: Remove debugging log messages
Andrew Deason [Fri, 4 Nov 2011 22:19:28 +0000]
volser: Remove debugging log messages

While the -log option to volserver is supposed to print additional log
information, it shouldn't spam the log with useless data. Remove some
of the log lines that are really more "debug" information, so we log
the same amount of information as in the 1.4 series.

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

12 years agoUnix CM: Fix dir buffer leak in afs_readdir
Simon Wilkinson [Thu, 3 Nov 2011 10:10:23 +0000]
Unix CM: Fix dir buffer leak in afs_readdir

Resolve a buffer leak in afs_readdir that was visible on all non-Linux
platforms (Linux has an independent readdir implementation)

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

12 years agoDAFS: Deal with exclusive-state volume headers
Andrew Deason [Fri, 4 Nov 2011 17:42:33 +0000]
DAFS: Deal with exclusive-state volume headers

GetVolumeHeader assumes that headers on the LRU are not associated
with a volume in an exclusive state. This is known to not be true for
some cases when salvage requests are received over FSSYNC, and may be
true in other scenarios. It's easy to just skip such headers, so skip
them.

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

12 years agoWindows: NPCancelConnection set correct length
Jeffrey Altman [Fri, 4 Nov 2011 13:34:53 +0000]
Windows: NPCancelConnection set correct length

The RemoteNameLength passed in the IOCTL_AFS_CANCEL_CONNECTION call
must not include the trailing NUL.  NPGetConnection() returns the
size of the buffer used which does include the trailing NUL.

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

12 years agoWindows: do not leak resource in AFSQueryDirectory
Jeffrey Altman [Fri, 4 Nov 2011 12:40:03 +0000]
Windows: do not leak resource in AFSQueryDirectory

Track whether or not the pFcb->NPFcb->Resource is held so
it can be released in all error paths.

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

12 years agoWindows: KFW_AFS should use API: ccache
Jeffrey Altman [Thu, 3 Nov 2011 20:39:18 +0000]
Windows: KFW_AFS should use API: ccache

During the Heimdal transition that default ccache type
was changed to FILE.  Restore the use of API: ccaches.

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

12 years agoWindows: Simplify KFW_AFS_klog
Jeffrey Altman [Thu, 3 Nov 2011 18:14:52 +0000]
Windows: Simplify KFW_AFS_klog

Reduce the complexity of KFW_AFS_klog.  Introduce
KFW_AFS_continue_aklog_processing_after_krb5_error() and
combine the input realm and realm_of_cell cases making
use of the RealmName variable.

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

12 years agoWindows: Failed to release correct lock
Peter Scott [Fri, 4 Nov 2011 13:31:57 +0000]
Windows: Failed to release correct lock

For cross-directory renames, the correct parent lock was not being tracked

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

12 years agodoc: limitations of addsite on different partitions
Ken Dreyer [Mon, 31 Oct 2011 14:27:16 +0000]
doc: limitations of addsite on different partitions

A user on the openafs-info mailing list noted that the Admin Guide is
unclear about creating read-only replicas on different partitions on
the same fileserver. Clarify the rules here.

Change-Id: I8229b4fba36c128772bb8198e6b8310a51206c03
Reviewed-on: http://gerrit.openafs.org/5745
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoImport of code from heimdal
Heimdal Developers [Thu, 3 Nov 2011 17:37:36 +0000]
Import of code from heimdal

This commit updates the code imported from heimdal to
ee7340860a22f81fb869cc431efc1fd4e5c77d34 (switch-from-svn-to-git-2542-gee73408)

Upstream changes are:

Jeffrey Altman (2):
      Windows: fallback to PROV_RNG if no PROV_RSA_FULL
      roken: posix errnos for windows

Love Hornquist Astrand (3):
      drop __restrict to please old compilers
      add krb5_is_enctype_weak
      Don't export tests from library, reported in bug from Tom Payeire

New files are:
roken/setenv.c
roken/unsetenv.c

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

12 years agoSolaris: Specify ARCHFLAGS in CFLAGS
Andrew Deason [Wed, 2 Nov 2011 16:35:42 +0000]
Solaris: Specify ARCHFLAGS in CFLAGS

Various autoconf tests which use the C compiler may yield different
results depending on whether or not we are compiling for x86 or amd64
on Solaris (different libraries are available, structures may be
different, et al). So, set CFLAGS depending on which arch we are
targeting, so the autoconf results are more consistent with the actual
compilation during the build.

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

12 years agoDo OPENAFS_OSCONF before compiler autoconf tests
Andrew Deason [Wed, 2 Nov 2011 16:32:56 +0000]
Do OPENAFS_OSCONF before compiler autoconf tests

OPENAFS_OSCONF can set the C compiler we use, as well as changing
various compiler flags. These changes can alter autoconf tests, so
allow OPENAFS_OSCONF to change these before various autoconf tests are
performed which require the C compiler.

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

12 years agoRemove -settime/RXAFS_GetTime client support
Andrew Deason [Wed, 2 Nov 2011 15:43:54 +0000]
Remove -settime/RXAFS_GetTime client support

Remove the -settime option from afsd, and any code for making
RXAFS_GetTime calls in libafs. Server probes have been replaced by
calls to RXAFS_GetCapabilities, and the actual functionality of
synchronizing the system clock has been superseded by other systems
like NTP. Issue a warning for all code paths that try to enable
-settime support.

Historical note: the code that this commit is removing contains bugs.
Do not simply revert this commit to turn on -settime support again.

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

12 years agoopr: queue swap
Michael Meffie [Thu, 18 Aug 2011 21:04:14 +0000]
opr: queue swap

Add inline function to pivot two queues.
Implementation by Simon Wilkinson.

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

12 years agoexternal: trigger git commit-msg hooks on import
Andrew Deason [Thu, 3 Nov 2011 17:33:55 +0000]
external: trigger git commit-msg hooks on import

When we import commits, the new commit does not have a Change-Id in
the commit message. Usually a git commit-msg hook will be installed to
automatically insert a Change-Id into the commit message if one does
not already exist, so trigger the hook by performing a no-op 'git
commit --amend'.

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

12 years agoexternal: commit imports with --no-verify
Andrew Deason [Thu, 3 Nov 2011 17:27:22 +0000]
external: commit imports with --no-verify

Currently, importing external commits with import-external-git.pl may
fail if the current repository checks for whitespace errors, and the
external commits contain whitespace errors. So run the commit with
--no-verify, so we can make the commit before fixing up the whitespace
errors immediately afterwards.

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

12 years agoImport setenv.c and unsetenv.c from roken
Andrew Deason [Thu, 3 Nov 2011 17:17:07 +0000]
Import setenv.c and unsetenv.c from roken

Import the roken implementation of setenv and unsetenv, which are
required on HP-UX.

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

12 years agoWindows: fix deadlock in symlink Attrib retrieval
Peter Scott [Wed, 2 Nov 2011 23:29:00 +0000]
Windows: fix deadlock in symlink Attrib retrieval

Commit df22620f66f5ce92776177d4d800fc7f4ae4ae99 introduced a
deadlock when retrieving file attributes for symlink objects.
To correct the deadlock, do not hold the Fcb locks during the
AFSRetrieveFileAttributes() call.

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

12 years agoWindows: always set reparse point attrib for symlink
Jeffrey Altman [Wed, 2 Nov 2011 23:27:42 +0000]
Windows: always set reparse point attrib for symlink

Make sure that we always set the reparse point attribute
for symlinks in directory enumerations and attribute queries.

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

12 years agoWindows: remember when a reparse point is opened
Peter Scott [Wed, 2 Nov 2011 23:25:36 +0000]
Windows: remember when a reparse point is opened

If the mount point or symlink is opened as a reparse point
we must remember that in the Ccb so that later reparse point
processing can be implemented properly.  For now remember
with the CCB_FLAG_MASK_OPENED_REPARSE_POINT flag.

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

12 years agoWindows: Mount points are always directories
Jeffrey Altman [Wed, 2 Nov 2011 14:35:14 +0000]
Windows: Mount points are always directories

Set the directory file attribute for all mount points
since a mount point target is always represented as
a directory.

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

12 years agoWindows: Retrieve file attributes on symlinks
Peter Scott [Wed, 2 Nov 2011 14:23:48 +0000]
Windows: Retrieve file attributes on symlinks

When a component is a symlink, correctly retrieve file
attributes during a query file information request.

FIXES 130283

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

12 years agoWindows: add AFSRetrieveParentPath()
Peter Scott [Wed, 2 Nov 2011 14:18:09 +0000]
Windows: add AFSRetrieveParentPath()

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

12 years agokdump-build: don't install when it hasn't been built for *bsd*
Jonathan A. Kollasch [Tue, 11 Oct 2011 17:56:08 +0000]
kdump-build: don't install when it hasn't been built for *bsd*

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

12 years agoklog.krb5: enforce DES for rxkad
Jeffrey Altman [Fri, 14 Oct 2011 13:10:19 +0000]
klog.krb5: enforce DES for rxkad

0. Always request a TGT regardless of the state of
   writeTicketFile.

1. request des-cbc-crc when requesting a ticket for an
   rxkad service principal

2. check the returned key length to ensure that it matches
   the permitted length of an rxkad key.  If not, generate
   an error instead of overwriting memory and continuing.

FIXES 130278

Change-Id: Ib7d27acc60c1b38dab4e2a56f83643477afb9721
Reviewed-on: http://gerrit.openafs.org/5619
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

12 years agoWindows: DE Reference count added during create
Peter Scott [Tue, 1 Nov 2011 14:55:37 +0000]
Windows: DE Reference count added during create

A reference count is added under lock to a newly created DE to
ensure it is not removed through deletion while in flight.

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

12 years agoWindows: change AFSProcessUserFsRequest default
Peter Scott [Mon, 31 Oct 2011 22:10:07 +0000]
Windows: change AFSProcessUserFsRequest default

Default the return code for AFSProcessUserFsRequest() to
STATUS_INVALID_DEVICE_REQUEST instead of STATUS_INVALID_PARAMETER.

Change-Id: Ie7fb260a19617635c11c92e2daf5947cef73c9be
Reviewed-on: http://gerrit.openafs.org/5774
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: correct ordering of reparse point tests
Peter Scott [Mon, 31 Oct 2011 22:07:23 +0000]
Windows: correct ordering of reparse point tests

Test for whether an object is a reparse point before testing
whether the provided buffer is large enough to hold the result
if it is.

FSCTL_GET_REPARSE_POINT
FSCTL_SET_REPARSE_POINT
FSCTL_DELETE_REPARSE_POINT

Change-Id: If6c1b9b6e5853d7759f169943310321d408190e0
Reviewed-on: http://gerrit.openafs.org/5748
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: log FSCTL_CSC_INTERNAL requests
Peter Scott [Mon, 31 Oct 2011 22:05:31 +0000]
Windows: log FSCTL_CSC_INTERNAL requests

FSCTL_CSC_INTERNAL requests are not supported and will
return STATUS_INVALID_DEVICE_REQUEST.  However, log them
for easier debugging.

FSCTL_CSC_INTERNAL is defined in ntifs.h only for
Vista and above.  Since afsredir is built for XP
and above its value must be conditionally defined
by us.

Change-Id: I39cf1f9d068d28ab6c9267c302d49feece6af700
Reviewed-on: http://gerrit.openafs.org/5773
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: add braces to case statements
Peter Scott [Mon, 31 Oct 2011 21:59:51 +0000]
Windows: add braces to case statements

A number of case statements did not have braces protecting
the block.  Add them.

Change-Id: I313462ca0c7490931e7c994ec45e39be071e782b
Reviewed-on: http://gerrit.openafs.org/5772
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: Directory Entry Processing
Peter Scott [Sat, 29 Oct 2011 17:55:46 +0000]
Windows: Directory Entry Processing

Memory corruption was detected due to improper handling
of directory entries and the short name b-tree during
directory revalidation and tear down.  The problem
resulted in a BSOD most frequently when roaming profiles
were written back to the file server or when multiple
clients were actively modifying the contents of a directory
simultaneously.

This patchset makes a number of changes:

 . rename processing no longer handles collisions locally.
   the file server replaces a target atomicly when there
   is a collision.

 . directory validation is no longer delayed until
   a handle is closed

 . data version numbers are checked for implied
   invalidation

Change-Id: Ib4b281bfb5da4b5a5ce735e85d85c50e15fbcde1
Reviewed-on: http://gerrit.openafs.org/5736
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: additional trace logging for afsredirlib
Peter Scott [Sat, 29 Oct 2011 17:29:55 +0000]
Windows: additional trace logging for afsredirlib

A large number of addition trace log entries were added
to assist in diagnosing problems in the dir entry processing.

Change-Id: I85cab4d66680eb5b9c00843c49c33a81acb18bc2
Reviewed-on: http://gerrit.openafs.org/5739
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: Reimplement AFSGenerateCRC()
Peter Scott [Sat, 29 Oct 2011 15:34:07 +0000]
Windows: Reimplement AFSGenerateCRC()

Replace the home grown CRC generation with a call to
RtlHashUnicodeString() which is present on Windows XP
and above.

Change-Id: Id98a1223e0aad54b3c43a16653ab888ac883639f
Reviewed-on: http://gerrit.openafs.org/5738
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoLinux: 3.1: update RCU path walking detection in permission i_op
Marc Dionne [Sat, 29 Oct 2011 23:23:07 +0000]
Linux: 3.1: update RCU path walking detection in permission i_op

The permission() inode operation changed again with kernel 3.1,
back to the form it had before 2.6.38.  This compiles fine,
but is missing the new way of detecting when we get called in
RCU path walking mode, resulting in system hangs.

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

12 years agorx: Remove the ADAPT_WINDOW code
Simon Wilkinson [Tue, 21 Jun 2011 17:32:02 +0000]
rx: Remove the ADAPT_WINDOW code

RX still has the remnants of an old mechanism for doing RTT and
congestion window detection. This code is #ifdef'd out using
the ADAPT_WINDOW define, but is pretty much unservicable these days,
as it collides with the TCP style implementation (with ADAPT_WINDOW
enabled, both will attempt to manipulate a connections RTT and
window size)

As the current TCP-style RTT and window calculation seem to work
much better in deployment, and there isn't much hope for us being
able to maintain two different congestion mechanisms, just remove
ADAPT_WINDOW. It is in git, if we ever want it back (not that I
think we ever would).

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

12 years agoWindows: cm_Rename break in 9cf7a628c2ff178b2fa236d2c0a41ca9be315036
Jeffrey Altman [Fri, 28 Oct 2011 21:43:24 +0000]
Windows: cm_Rename break in 9cf7a628c2ff178b2fa236d2c0a41ca9be315036

9cf7a628c2ff178b2fa236d2c0a41ca9be315036 broke renaming of
a file to a name that does not exist.  Put back the code that
makes that possible with a comment.

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

12 years agoWindows: out of date version not in current chunk
Jeffrey Altman [Fri, 28 Oct 2011 15:36:10 +0000]
Windows: out of date version not in current chunk

In buf_GetNewLocked(), the comparision to decide whether a
cm_buf_t is a member of the current chunk must take the data
version into account.  If the data version is out of date, it
is not part of the current chunk and is an object that can be
safely recycled.

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

12 years agolinux: Update Packaging to build OpenAFS services for Fedora's systemd
Edward Z. Yang [Tue, 18 Oct 2011 03:16:15 +0000]
linux: Update Packaging to build OpenAFS services for Fedora's systemd

Fedora 15 now uses systemd (see http://fedoraproject.org/wiki/Systemd)
for the OS init system. While it currently has backwards
compatibility with older SysV-style init scripts, future versions of
Fedora may no longer support it, and OS startup tends to be faster
with the systemd service units. Also, systemd runs all the service's
processes within a linux kernel cgroup.
(see http://www.kernel.org/doc/Documentation/cgroups/cgroups.txt)

This change includes an openafs-client.service and
openafs-server.service unit files for the client and server packages
respectively.

Client
- Loading the openafs module was moved into
/etc/sysconfig/modules/openafs-client.modules. This causes the OS to
load the module on boot. This is the preferred way for modules to be
loaded with Fedora. (See
http://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/sec-Persistent_Module_Loading.html
for more details)
- The CellServDB file is generated with sed rather than cat.
This change was made because Systemd doesn't execute as a shell
script, but rather executes processes directly. Rather than invoking
a shell to concatenate the CellServDB.* files, they're written to the
CellServDB file using a sed oneliner.
- Do all of the proper kernel module loading and unloading.

Server
- Since systemd uses cgroups, when the service is shut down, all
processes in the openafs-server.service cgroup will be terminated.

The other changes are standard as per:
    http://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd

Original version by Jonathan Billings <jsbillin@umich.edu>.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>

Change-Id: Ifb41790ffe107b319097b9750273aecfe82c3349
Reviewed-on: http://gerrit.openafs.org/5637
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Alex Chernyakhovsky <achernya@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

12 years agoWindows: only flush buffers on shutdown if running
Jeffrey Altman [Thu, 27 Oct 2011 21:57:25 +0000]
Windows: only flush buffers on shutdown if running

If a service shutdown message is received prior to the
service entering the running state, do not attempt to
buf_CleanAndReset() because the required data structures
and locks are not initialized.

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

12 years agoWindows: Do not EEXIST exact match during rename
Jeffrey Altman [Tue, 25 Oct 2011 19:32:11 +0000]
Windows: Do not EEXIST exact match during rename

AFS Rename operations on the file server will delete a
target file if it exists.  Do not prevent renames because
an exact match of the target name exists in the target
directory.

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

12 years agoopr: build on Windows after queue.h move
Jeffrey Altman [Tue, 25 Oct 2011 19:42:44 +0000]
opr: build on Windows after queue.h move

55efff93fe2762b58dc70cdd20aaf97e39825929 broke Windows.
update the NTMakefile in src/util and src/opr to correspond
to the move of queue.h.

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

12 years agoWindows: Look for 8.3 name when doing a rename
Rod Widdowson [Sat, 22 Oct 2011 15:46:26 +0000]
Windows: Look for 8.3 name when doing a rename

If we are doing a destructive rename we need to find whether the
target file exists.  This is done in the usual way (case sensitive
case insensitive), but the short name is not looked for.

This means that the rename of a file to a short name will not
supersede correctly; rather the service refuses the rename since
the target existed already.

This patch looks the target name up in the shortname tree if the
target name is short and all else has failed.

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

12 years agoWindows: New Trace for DirEntry tracking problem
Peter Scott [Thu, 20 Oct 2011 18:39:31 +0000]
Windows: New Trace for DirEntry tracking problem

Incuded in this patch is additional trace for logging how
directory entries are added, modified and deleted throughout
the redirector

Change-Id: I7ea80331ca24d543579603986f4eb6bcdd0bf072
Reviewed-on: http://gerrit.openafs.org/5640
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: Free work item memory with tag value
Jeffrey Altman [Mon, 17 Oct 2011 13:29:37 +0000]
Windows: Free work item memory with tag value

For consistency throughout the source module, free all work
item memory allocations with ExFreePoolWithTag.

Change-Id: I4e9b275bb8b92a81884d36ce4c8ed754d281bbf8
Reviewed-on: http://gerrit.openafs.org/5627
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: free pointer after last reference
Jeffrey Altman [Mon, 17 Oct 2011 13:28:11 +0000]
Windows: free pointer after last reference

This is a superficial change but is being done for readability.
If given the choice of freeing memory and then testing the pointer
value or vice-versa, test the pointer value first.

Change-Id: I189851c265a257d433df111622837db1d706c054
Reviewed-on: http://gerrit.openafs.org/5626
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: AFSInitPIOCtlDirectoryCB free in try_exit
Jeffrey Altman [Mon, 17 Oct 2011 13:26:13 +0000]
Windows: AFSInitPIOCtlDirectoryCB free in try_exit

Process all conditional release of allocated memory on
failure within the try_exit on failure.

Change-Id: I4a29f6e9d2506c00713558849c49c377a74d607a
Reviewed-on: http://gerrit.openafs.org/5625
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: close leak in AFSPrimaryVolumeWorkerThread
Jeffrey Altman [Tue, 25 Oct 2011 17:30:19 +0000]
Windows: close leak in AFSPrimaryVolumeWorkerThread

Prevent a leak of the non-paged pool and a Resource by freeing all
allocations within the Specific.Directory.PIOCtlDirectoryCB object.

Use AFSExFreePool() instead of ExFreePool() because the objects
are allocated from the AFSRedir.sys driver allocator.

FIXES 130280

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

12 years agoWindows: afsredir only wants shortName if not 8.3
Jeffrey Altman [Tue, 25 Oct 2011 01:14:59 +0000]
Windows: afsredir only wants shortName if not 8.3

When performing a directory enumeration for the afs redirector
only specify a shortname if the name is not valid 8.3.

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

12 years agoWindows: Use SetFlag macro when setting flag
Jeffrey Altman [Thu, 20 Oct 2011 18:06:47 +0000]
Windows: Use SetFlag macro when setting flag

Change-Id: Ibda7ac5e30a623dc26f031831e75380fdf700a88
Reviewed-on: http://gerrit.openafs.org/5642
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: minor type in trace output
Jeffrey Altman [Thu, 20 Oct 2011 18:05:59 +0000]
Windows: minor type in trace output

Change-Id: I72b348dea83547260575c0bd2aca327ea4f72532
Reviewed-on: http://gerrit.openafs.org/5641
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: AFSRemoveCaseInsensitiveDirEntry corrections
Peter Scott [Tue, 18 Oct 2011 14:04:48 +0000]
Windows: AFSRemoveCaseInsensitiveDirEntry corrections

If there is a fLink but no parentLink for the DirEntry being
removed, return the fLink as the new value for *RootNode.

This patch set also includes two changes that improve readability
but do not alter the behavior.

Change-Id: I112265798df9d46c83ffacddc7d97ad0f6fce5bf
Reviewed-on: http://gerrit.openafs.org/5638
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott.kd@gmail.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: AFSEvaluateTargetByName free buffer if no return
Jeffrey Altman [Mon, 17 Oct 2011 13:22:53 +0000]
Windows: AFSEvaluateTargetByName free buffer if no return

For consistency with other functions in AFSCommSupport
modify AFSEvaluateTargetByName to free the DirEntry on
completion if the caller has not provided an out parameter
to accept it.

Change-Id: Ic5b6cc655fd47b95493e6aadb7b23481d0187d5c
Reviewed-on: http://gerrit.openafs.org/5624
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: remove unused code block
Jeffrey Altman [Mon, 17 Oct 2011 13:19:33 +0000]
Windows: remove unused code block

A small bit of dead code in the redirector.

Change-Id: Ieeea58e7681e8b0bd043794f1aa51c112c212497
Reviewed-on: http://gerrit.openafs.org/5623
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: re-indent afsredir log message params
Jeffrey Altman [Mon, 17 Oct 2011 13:10:17 +0000]
Windows: re-indent afsredir log message params

convert tabs to spaces for consistent indentation

make use of braces be consistent

Change-Id: I76e2c6427c02cb50f1eb4e6ab57e484a4bfa3c65
Reviewed-on: http://gerrit.openafs.org/5621
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

12 years agoWindows: Defer deref of a directoryEntry
Rod Widdowson [Sat, 22 Oct 2011 14:00:03 +0000]
Windows:  Defer deref of a directoryEntry

During the handling of SL_OPEN_TARGET opens (usually associated
with a rename) a directory entry was deferenced prior to its
contents being used (to set up a seconding inforation field).

This change just holds on to the reference until after that processing.

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

12 years agoWindows: Set new file index correctly during rename
Rod Widdowson [Fri, 21 Oct 2011 15:57:02 +0000]
Windows: Set new file index correctly during rename

Directory entries are required to have a file index which is used during
directory enumeration.  When inserting into a new directory we have to
update this from the target directory.

This code fixes a bug whereby it was being set from the source FCB, rather
than the target one.  On failure we now also reset the value to its old value.

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

12 years agoallow cloning of any volume to any volume with same parent ID
Jacob Thebault-Spieker [Tue, 19 Jul 2011 22:01:26 +0000]
allow cloning of any volume to any volume with same parent ID

remove checks to disallow cloning of ro volumes to rw volumes,
which allows cloning of any volume within the same parent ID
grouping, including allowing destruction of newer version of the
volumes.

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

12 years agoremove check for disallowing clones of backup or ro volumes
Jacob Thebault-Spieker [Tue, 19 Jul 2011 16:02:49 +0000]
remove check for disallowing clones of backup or ro volumes

removes the if-statement ensuring that the volume being cloned is
not a backup volume, nor a read-only volume. This allows clones
from any type of volume to a given volume. Parent volume meta-data
is maintained, only the cloneId value changes.

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

12 years agobozo: build notifier sample program
Michael Meffie [Thu, 6 Oct 2011 12:33:37 +0000]
bozo: build notifier sample program

Build the smail-notifier sample program.

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

12 years agobozo: test program update
Michael Meffie [Thu, 6 Oct 2011 11:55:21 +0000]
bozo: test program update

Add -file option to test program to simulate program crashes.

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

12 years agoDAFS: Remove VOL_SALVAGE_INVALIDATE_HEADER
Andrew Deason [Mon, 29 Aug 2011 22:41:31 +0000]
DAFS: Remove VOL_SALVAGE_INVALIDATE_HEADER

Currently VRequestSalvage_r takes a flag,
VOL_SALVAGE_INVALIDATE_HEADER, which causes the header for the
specified volume to be freed (via FreeVolumeHeader). This is almost
never safe to do, since there may be other users of the specified
volume that can be accessing the volume header at the same time.

There is also no reason to invalidate the header at the time of the
VRequestSalvage_r call, since the header must be invalidated when we
detach the volume (other utilities may change header information). So,
if there are any problems in the future because we do not invalidate
the header at the time of VRequestSalvage_r, it is the fault of the
detachment/offlining logic.

So, remove VOL_SALVAGE_INVALIDATE_HEADER and all of its users. Take
this opportunity to correctly document the VRequestSalvage_r headers
in the VRequestSalvage_r comment, as it was previously missing the
VOL_SALVAGE_NO_OFFLINE flag.

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

12 years agoDAFS: fssync online requires a partition name argument
Michael Meffie [Thu, 13 Oct 2011 16:23:35 +0000]
DAFS: fssync online requires a partition name argument

fssync-debug online silently fails when run without a partition name.
Check for the required partition name on the server side and the client
side.  Report errors back to the client when the server side fails to
pre-attach the volume.

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

12 years agovolser: Remove ExtractVolId
Andrew Deason [Tue, 11 Oct 2011 15:51:14 +0000]
volser: Remove ExtractVolId

volser was using its own function to extract a volume ID from a
filename string, and was using atol to do so. The ato* family of
functions can have problems with larger volume IDs, not to mention a
lack of error checking, so don't use it. Since we already have the
function VolumeNumber in the vol package to do the very same thing,
just use that instead.

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

12 years agoviced: Check for HOSTDELETED in stillborn check
Andrew Deason [Mon, 3 Oct 2011 18:10:44 +0000]
viced: Check for HOSTDELETED in stillborn check

h_FindClient_r checks the connection rock for a client object twice.
First it sees if we already have a client object, and if we don't, we
effectively create one (or find a suitable one). Then we check again,
to see if someone else set the rock while we were creating a client
structure.

Currently, the first check checks if client->host->hostFlags has
HOSTDELETED set, but the second check does not. So, if the host
associated with the client has been deleted by someone else, currently
we will unnecessarily log a "stillborn client" message, and we will
continue to use the deleted host. If the host continues to be held by
someone, we will run into the same situation repeatedly on future
requests until all of the host references go away.

To fix this, also ignore HOSTDELETED clients when performing the
stillborn race check.

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

12 years agovlserver: Log to VLLog by default, not PtLog
Andrew Deason [Thu, 13 Oct 2011 16:45:58 +0000]
vlserver: Log to VLLog by default, not PtLog

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

12 years agovos offline: Bring volume back online for -busy
Andrew Deason [Fri, 14 Oct 2011 16:32:34 +0000]
vos offline: Bring volume back online for -busy

vos offline is supposed to bring a volume back online from "busy"
status before exiting, as volumes should not be in "busy" status for
extended periods of time. This was being enforced by required that
-sleep be specified; however, -sleep only results in the volume being
brought back online if a non-zero sleep time was specified. So, make
sure the volume is brought back online if -busy was specified.

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

12 years agocache bypass: don't define iovecp for UKERNEL
Marc Dionne [Sat, 22 Oct 2011 13:32:33 +0000]
cache bypass: don't define iovecp for UKERNEL

iovecp is defined but not used for UKERNEL.  Define it conditionally
to avoid gcc warnings and --enable-checking failure.

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

12 years agoWindows: Remove unused cleanup flag
Rod Widdowson [Sat, 22 Oct 2011 13:27:41 +0000]
Windows: Remove unused cleanup flag

In AFSOpenTargetDirectory the flag bRemoveShare was initialized
FALSE and never set TRUE.  In teardown after failure some code
did listen to the flag, but the operation (IoRemoveShareAccess)
was not protected by the FCB mainlock which it should have been.

Rather than get the locking correct, just remove the flag entirely.

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

12 years agobypasscache: allow arbitrary sized iovecs
Derrick Brashear [Sun, 23 Oct 2011 23:15:16 +0000]
bypasscache: allow arbitrary sized iovecs

instead of binding outselves to PAGE_SIZE, just fill any size

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

12 years agobypasscache: do errors correctly
Derrick Brashear [Thu, 6 Oct 2011 08:04:36 +0000]
bypasscache: do errors correctly

do set errors when we bomb out early
do not unlock and return early when we happen to do a correct zero
length read
do set errors the kernel can deal with if we're feeding a page routine

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