openafs.git
13 years agoDemand-Attach: Remove dangerous trailing else
Simon Wilkinson [Sun, 25 Apr 2010 19:14:02 +0000]
Demand-Attach: Remove dangerous trailing else

Change 9aa09f5e634db8a8b2dedf3a749f2a90ef206e2f introduced a
dangerous trailing else into the VScheduleSalvage_r function:

 #ifdef A
    if (foo) {
      ...
    } else
 #endif
 #ifdef B
    if (bar) {
      ...
    }
 #endif
    something_else()

In a situation where we have A && !B, then something_else() ends up
only being run when foo is false. Given that something_else() is
VOL_LOCK, this will not end well.

In the real world, we hit this problen when we build the volume
package with SALVSYNC_BUILD_CLIENT and !FSYNC_BUILD_CLIENT - in
other words, whilst building the fileserver.

Change-Id: I97e07a6e730df8ac480d295b4cf30b0695ace511
Reviewed-on: http://gerrit.openafs.org/1832
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoEnable PutVCache for FBSD80 and higher
Ben Kaduk [Mon, 17 May 2010 04:22:32 +0000]
Enable PutVCache for FBSD80 and higher

Matt's patches in a123bd8ccd brought in support for FBSD 7.0, but
also disabled several calls to afs_PutVCache() for FBSD80 and
higher.  Matt says that that patch was focused on 7.0, so the
8.0-related bits may not be relevant.
I have run with the PutVCache calls enabled, and if anything,
my system seems more stable with them.

Change-Id: I8d906848e977d4974e4dcdc151964bb2ac3116b6
Reviewed-on: http://gerrit.openafs.org/1969
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoKill FBSD4X with fire
Ben Kaduk [Sun, 16 May 2010 04:43:35 +0000]
Kill FBSD4X with fire

We haven't even pretended to work on the 4.X series for quite some
time, and keeping this code around just makes things (slightly)
harder to read.
AFS_FBSD_ENV is now equivalent to AFS_FBSD50_ENV (though the
latter should not be used).
Leave the fbsd_4 sysnames in afs_sysnames.h for archival purposes.

Change-Id: Ibebda92967ca26c3dd4bf0b2cc6a66ae3a94d0ff
Reviewed-on: http://gerrit.openafs.org/1968
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoAutoconf: Use AC_CHECK_MEMBERS
Simon Wilkinson [Sun, 16 May 2010 22:14:11 +0000]
Autoconf: Use AC_CHECK_MEMBERS

AC_CHECK_MEMBERS has been available since autoconf 2.50,
which was released in 2001. Use this, rather than rolling our
own mechanism to check for structure membership.

Change-Id: Ic63bfdd6c448ce3cf2ed13d8f1f36d02e18bd223
Reviewed-on: http://gerrit.openafs.org/1973
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoAutoconf: Use a standard test for socklen_t
Simon Wilkinson [Sun, 16 May 2010 21:56:13 +0000]
Autoconf: Use a standard test for socklen_t

Use the standard AC_CHECK_TYPES mechanism to check for the existence
of socklen_t, and to typedef it as an int if it's not found, rather
than growing our own.

Change-Id: Ib5aeb600750558167f63833dd4a7480dbe312b8a
Reviewed-on: http://gerrit.openafs.org/1972
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoDo not try to increase the refcount of a NULL vnode
Ben Kaduk [Sat, 15 May 2010 21:11:15 +0000]
Do not try to increase the refcount of a NULL vnode

osi_lookup is not guaranteed to give us a valid vnode, so
check before calling VN_HOLD().

Change-Id: I3d2a4d441f6991c08beccb6b10a428f5746db146
Reviewed-on: http://gerrit.openafs.org/1967
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoSolaris: do not call VFS_RELE with GLOCK
Andrew Deason [Sun, 16 May 2010 04:12:33 +0000]
Solaris: do not call VFS_RELE with GLOCK

VFS_RELE can call afs_freevfs, which grabs GLOCK. Thus, don't call
VFS_RELE with GLOCK held or we can try to recursively acquire GLOCK
and panic.  This is currently unlikely to occur (sans vfs refcount
unbalances) without support for forced unmounts, since the last vfs
ref will usually come from the caller of afs_unmount(). But it still
may be possible.

Change-Id: I152bd13abc2e90f258f98194833c50c3a2846904
Reviewed-on: http://gerrit.openafs.org/1966
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoDon't use afs_linux_storeProc with memory cache, it only works with disk cache.
Hartmut Reuter [Fri, 14 May 2010 11:25:44 +0000]
Don't use afs_linux_storeProc with memory cache, it only works with disk cache.

Change-Id: I54585c61c66af7160d0ddbcbc1251fa42fbf44d8
Reviewed-on: http://gerrit.openafs.org/1958
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoSolaris: stop NetIfPoller on shutdown
Andrew Deason [Wed, 12 May 2010 18:59:06 +0000]
Solaris: stop NetIfPoller on shutdown

The NetIfPoller code that is enabled on AFS_SUN510_ENV never gets
shutdown properly. The current code looks as if it was intended for
NetIfPoller to recognize the appropriate termState and just return,
but we never wait for it, and so we can complete the shutdown sequence
without NetIfPoller ever knowing that we are shutting down. This can
cause the machine to panic, as we keep attempting to run NetIfPoller
even after libafs has been unloaded.

Since NetIfPoller is fired by default every 30 seconds, we probably do
not want to wait for it to fire during shutdown. Instead, just destroy
the necessary timeout and task queue, which will wait for NetIfPoller
to complete if running, and will just prevent it from running in the
future otherwise.

Change-Id: I25f9536d2713baf524a2450400c428ac506525f1
Reviewed-on: http://gerrit.openafs.org/1957
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: move afsconfig.h / param.h to afscred.h
Jeffrey Altman [Wed, 12 May 2010 15:27:17 +0000]
Windows: move afsconfig.h / param.h to afscred.h

move the inclusion of afsconfig.h and param.h to
afscred.h so that they are included everywhere
and so that the conditional use of _USE_32BIT_TIME_T
is applied consistently by afscred.h.

LICENSE MIT

Change-Id: Id8c595509ec381ff6df6186e4d1c809413782a59
Reviewed-on: http://gerrit.openafs.org/1956
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: netidmgr_plugin must include afsconfig.h
Jeffrey Altman [Wed, 12 May 2010 14:25:01 +0000]
Windows: netidmgr_plugin must include afsconfig.h

In order to properly use afs headers afsconfig.h must
be included first in afsfuncs.c.  Update the makefile
to specify the correct include paths.

Since this results in the afs assert.h being used,
we must include the lib file that includes the
AssertionFailed function.

LICENSE MIT

Change-Id: I46f76410ea16eeffeb8406ef4e89120a3255366a
Reviewed-on: http://gerrit.openafs.org/1954
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoFix missing semicolon in non-AFS_NAMEI_ENV builds vol/nuke.c
Jeffrey Altman [Wed, 12 May 2010 14:24:03 +0000]
Fix missing semicolon in non-AFS_NAMEI_ENV builds vol/nuke.c

Change-Id: Ibfd37180199aecf6f79fbc84e2f035678e826d17
Reviewed-on: http://gerrit.openafs.org/1953
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: fix consistency of afsconfig-windows.h
Jeffrey Altman [Wed, 12 May 2010 14:22:07 +0000]
Windows: fix consistency of afsconfig-windows.h

Windows is a AFS_NAMEI_ENV platform

Windows (as of WDK 6) defines socklen_t as signed int

Change-Id: I0aa549309d19c745e4df50d510c19f3174b1f2eb
Reviewed-on: http://gerrit.openafs.org/1952
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoinlinebulk analyze errors
Derrick Brashear [Fri, 7 May 2010 14:32:09 +0000]
inlinebulk analyze errors

afs_Analyze was not being called on inlinebulk errors if the error
potentially required a retry. do so.

Change-Id: I60fc0a7553f9ce592c40c7aecb60346e138468f0
Reviewed-on: http://gerrit.openafs.org/1926
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoRx: prevent rx_rpc_stats mutex from being a global bottleneck
Jeffrey Altman [Sun, 9 May 2010 01:38:05 +0000]
Rx: prevent rx_rpc_stats mutex from being a global bottleneck

Prior to this patchset, the 'rx_rpc_stats' mutex was superior
to both the 'peer->peer_lock' and the 'rx_peerHashTable_lock'.
That meant that the 'rx_rpc_stats' was being held across many
operations that walk the peer hash table.  For example,
rxi_ReapConnections, rx_disablePeerRPCStats, and rx_shutdown.
Since every RPC issues a call to rx_IncrementTimeAndCount, the
reap connections event would effectively bring all RPC processing
to a halt.

This patchset moves 'rx_rpc_stats' later in the hierarchy and
restructures rxi_ReapConnections, rx_disablePeerRPCStats, and
rx_shutdown so that not only doesn't the 'rx_rpc_stats' mutex
need to be held across the entire function but the
'rx_peerHashTable_lock' does not need to be held while complex
operations on the peer object are taking place.

rxi_ReceiveDebugPacket is also fixed to hold the rx_peerHashTable_lock
and peer_lock at appropriate times while completing its function.

Change-Id: I1a11798f1bb2a8f03316c6c455954bd6b8d1459b
Reviewed-on: http://gerrit.openafs.org/1928
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Dan Hyde <drh@umich.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: Add support for NetWkstaGetInfo levels 101 and 102
Jeffrey Altman [Wed, 12 May 2010 04:58:30 +0000]
Windows: Add support for NetWkstaGetInfo levels 101 and 102

On Windows 7, NetWkstaGetInfo levels 101 and 102 are queried.
Add support to the WKSSVC RPC Pipe service.

LICENSE MIT

Change-Id: Ia780ee69834c01c2d0c2965ae2c65f80d504a923
Reviewed-on: http://gerrit.openafs.org/1950
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: Prevent overflow during percent used calc in Explorer Shell Ext
Jeffrey Altman [Mon, 10 May 2010 13:07:50 +0000]
Windows: Prevent overflow during percent used calc in Explorer Shell Ext

In the Volume Info and Partition Info dialog boxes, percent used
was overflowing the variable due to using too small a variable
and multiplying before dividing.

FIXES 126846

Change-Id: I9a8a9275d22675cfb53c9e520758f2c4d6606954
Reviewed-on: http://gerrit.openafs.org/1939
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: Freelance vs ACLs
Jeffrey Altman [Sun, 9 May 2010 14:50:07 +0000]
Windows: Freelance vs ACLs

If the user attempts to list acls or set acls on the freelance
root.afs volume, generate a meaningful error.

Change-Id: I6e5b147bf0cdd98ec0224a723098f5bbcb37b1e1
Reviewed-on: http://gerrit.openafs.org/1931
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: use system CreateUuid instead of afs variant
Jeffrey Altman [Mon, 10 May 2010 00:49:05 +0000]
Windows: use system CreateUuid instead of afs variant

The afs_create_uuid function on Windows results in
duplicate uuids being produced.  Windows provides its own
CreateUuid function.  Use it when afs_create_uuid is called.

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

13 years agoMake afsio be useful on Windows and fix bugs
Jeffrey Altman [Sun, 9 May 2010 14:15:30 +0000]
Make afsio be useful on Windows and fix bugs

On Windows, the stdin and stdout handles default to text
mode which corrupts data piped through them.  At the start
of readFile and writeFile, the mode is now set to binary.

The ProbeUuid callback is supposed to determine if this
client is the same as the one being requested.  Since we
are advertising a new uuid in TellMeAboutYourself and
WhoAmI, we should perform the uuid check and return a
valid answer in order to avoid confusing the file server.

Add support for TellMeAboutYourself.  On Windows, return
valid interface information.

Always print verbose output to stderr.

Display MB/sec to three decimal places.

In readFile, always perform a AFSFetchStatus operation
otherwise we have no idea what the file size is.

On Windows, the path separator is backslash.

Change-Id: I174eda991383301d01fe5d6431d459b6ea01a0be
Reviewed-on: http://gerrit.openafs.org/1930
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Hartmut Reuter <reuter@rzg.mpg.de>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: RXAFS_InlineBulkStat errors must be processed via cm_Analyze
Jeffrey Altman [Thu, 6 May 2010 21:12:48 +0000]
Windows: RXAFS_InlineBulkStat errors must be processed via cm_Analyze

RXAFS_InlineBulkStatus does not return errors such as EACCES,
VNOVOL, VNOVNODE, VOFFLINE, VBUSY, VIO, VMOVED, etc. as an RPC return
code.  Instead they are returned in the status info errorCode field
for each file.

Traditionally, the error associated with the first FID in the query
list has been returned to the caller of cm_TryBulkStatRPC().
However, the error has never been processed through cm_Analyze()
which means that the per-vnode processing for VNOVNODE and the volume
global processing for VMOVED, VNOVOL, etc. has never been performed.
As a result, failover to other .readonly volume instances cannot occur,
volume moves will not be handled, and files that have been deleted
are not detected.

This patchset makes the following changes:

1. If an inline bulk operation has been performed and the inline
   errorCode is a volume global error, then that error replaces
   the RPC return code within the cm_Analyze() processing for
   the RPC.  This will affect whether or not a retry operation
   is performed.

2. The variable 'inlinebulk' is reset to 0 at the top of the
   cm_Analyze() loop in case failover from an inlinebulk capable
   file to an inlinebulk incapable file server takes place.

3. The FID that is passed into cm_Analyze() is not a real fid.
   Instead it consists of the cell and volume but vnode = 0.
   This ensures that the error (if any) is not applied to the
   directory object.

4. If an inline bulk operation was performed, prior to performing
   the cm_MergeStatus() operation a vnode a check is made to
   determine if an error was returned for that vnode.  If so,
   cm_Analyze() is called with no connection, a fake cm_req_t,
   the fid, and the error.  This permits cm_Analyze() processing
   to be performed on the file.

LICENSE MIT

Change-Id: I91b10faae085b52ba753b3942215951e2122b937
Reviewed-on: http://gerrit.openafs.org/1918
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoLinux: missing configure test
Michael Meffie [Tue, 11 May 2010 19:54:53 +0000]
Linux: missing configure test

Add the kmem_cache_create test for dtor to the configure to
build again on older versions of linux. Fixes,
osi_vfsops.c:264: error: too few arguments to function
‘kmem_cache_create’

Change-Id: I1c1aa63e8dbe2df6c9b889edaa66708d7db01847
Reviewed-on: http://gerrit.openafs.org/1948
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoRemove intptr.m4
Simon Wilkinson [Thu, 6 May 2010 21:22:50 +0000]
Remove intptr.m4

We now require an autoconf version of at least 2.60. This version
supplies AC_TYPE_INTPTR_T and AC_TYPE_UINTPTR_T, so we no longer
need to have our own.

Change-Id: I362324d1cfb39efb01c3f6f2d95eb7f4ed041998
Reviewed-on: http://gerrit.openafs.org/1919
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agovnode alloc bitnumber returns bitnumber
Derrick Brashear [Tue, 11 May 2010 15:40:09 +0000]
vnode alloc bitnumber returns bitnumber

fix function return types to match a bitnumber (int)
and comment the function appropriately

Change-Id: I9542c02b1aa7aacdd0596675992bb1e8a1708572
Reviewed-on: http://gerrit.openafs.org/1941
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agovlserver: prevent duplicate IPs via ChangeAddr
Andrew Deason [Wed, 5 May 2010 18:51:23 +0000]
vlserver: prevent duplicate IPs via ChangeAddr

Add a safety check in VL_ChangeAddr/ChangeIPAddr to check if we are
adding a duplicate server IP in the database. Return VL_MULTIPADDR
when we try to do that.

Change-Id: Iaff2792b90f4152dac5a1ab4c1072ef56fef518b
Reviewed-on: http://gerrit.openafs.org/1927
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: define HAVE_SSIZE_T
Jeffrey Altman [Mon, 10 May 2010 00:46:11 +0000]
Windows: define HAVE_SSIZE_T

The windows param.*.h files define the ssize_t type.
Therefore, we must define HAVE_SSIZE_T in order to avoid
a collision with the ssize_t typedef in afs/stds.h.

Change-Id: Ie34cb565f09acfffe985476d24dbca917b05c5db
Reviewed-on: http://gerrit.openafs.org/1936
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoAdd a list of files to import from Heimdal
Simon Wilkinson [Sun, 9 May 2010 18:40:58 +0000]
Add a list of files to import from Heimdal

Add an initial list of files to import into OpenAFS from Heimdal.
Currently this is just the list that are required to support
our new configuration file parser.

Change-Id: I785bacc603121f587378fcfbe93e585290c8ab7f
Reviewed-on: http://gerrit.openafs.org/1933
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoAdd a tool to import external repositories
Simon Wilkinson [Sun, 9 May 2010 18:37:52 +0000]
Add a tool to import external repositories

This commit adds a tool to aid with the importing of external git
repositories. import-external-git.pl allows a developer to easily
update the src/external portion of the tree to the latest release
of externally developed software. It's currently intended to support
our use of Heimdal functions, but could be extended to support any
project whose code we wish to use in the kernel, and which has a
git repo.

Change-Id: I6d91474c5de67e57fb73ff4d59c5afe9bb14c240
Reviewed-on: http://gerrit.openafs.org/1932
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: fs.c requires size_t len not int len
Jeffrey Altman [Sun, 9 May 2010 02:41:39 +0000]
Windows: fs.c requires size_t len not int len

Missed one case of an 'int len' being passed into StringCbLength.

Also, remove one instance of 'int len' that was not used at all.

LICENSE MIT

Change-Id: I457d4ae98adf9d4ca0c1b7dcb74470d9bbc85a54
Reviewed-on: http://gerrit.openafs.org/1929
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoInclude common param file for Linux alpha builds
Russ Allbery [Thu, 6 May 2010 19:30:23 +0000]
Include common param file for Linux alpha builds

The sysname for Linux Alpha is alpha_linux_26 (or 24 or 22) with an
extra underscore before the version, unlike all the other Linux sysnames.
Allow for that case when deciding whether to include the common Linux
param header.

Change-Id: Icab3a9214d0bd020b846734cce27da6c1bdeab56
Reviewed-on: http://gerrit.openafs.org/1915
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoDefine osi_procname for FBSD
Ben Kaduk [Fri, 7 May 2010 04:47:53 +0000]
Define osi_procname for FBSD

The kernel linker doesn't like to load modules with unresolved
(implicitly-defined) symbols (understandably).  Make it happy.

Change-Id: I23fdbb9c9e07a0c583580f5c5eee577a04fae278
Reviewed-on: http://gerrit.openafs.org/1925
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: sanket <sanket@sanketagarwal.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

13 years agoActually fix build for FBSD80 after vcache refactoring
Ben Kaduk [Fri, 7 May 2010 03:31:26 +0000]
Actually fix build for FBSD80 after vcache refactoring

One more s/tvc/avc/

Change-Id: Ie99310bb08da5bf7aaee022e9c0ca43d1a33c3db
Reviewed-on: http://gerrit.openafs.org/1923
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoAdd entries for FBSD 8.1 and 9.0
Ben Kaduk [Sun, 4 Apr 2010 23:34:24 +0000]
Add entries for FBSD 8.1 and 9.0

Though neither have been released, yet, RELENG_8 and HEAD are
starting to get changes that we need to conditionalize on.

Change-Id: Ia3af3c38abe4d0d01e0cef974771b45a97d3d9aa
Reviewed-on: http://gerrit.openafs.org/1691
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoModernise use of AC_CHECK_TYPE
Simon Wilkinson [Thu, 6 May 2010 14:00:00 +0000]
Modernise use of AC_CHECK_TYPE

Prior to autoconf 2.13, AC_CHECK_TYPE took two arguments, the type
to check and the a default type to use if that type wasn't defined.
This usage has been deprecated since 2.13, and the AC_CHECK_TYPE
macro itself now behaves differently. Whilst there is a compatibility
mode, the autoconf documentation discourages its use.

We also have an occurence of a slightly more modern AC_CHECK_TYPE,
where we explicitly #define a default value if one isn't provided.
The autoconf manual also discourages this form, however, in favour
of using AC_CHECK_TYPES, and placing suitable typedefs in an
external header file.

Modify our code so we do things in the recommended way.

Change-Id: Ie28067f2c90e9a3aa25cfde45ef081da2d380ee1
Reviewed-on: http://gerrit.openafs.org/1914
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoAlways include afsconfig.h in autogenerated files
Simon Wilkinson [Thu, 6 May 2010 13:58:52 +0000]
Always include afsconfig.h in autogenerated files

Modify rxgen and compile_et so that the files they output always
contain afsconfig.h before afs/param.h. This avoids problems where
afs/param.h, or headers included from it, rely on having the results
of configure tests available.

Change-Id: I0198500a17abd31ee1057d6780cbe5a5e1bc8c59
Reviewed-on: http://gerrit.openafs.org/1913
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Use osi_obsd_Free() for all releases of OBSD
Antoine Verheijen [Thu, 6 May 2010 15:10:38 +0000]
OpenBSD: Use osi_obsd_Free() for all releases of OBSD

Use osi_obsd_Free() in afs_osi_Free() for all releases of OpenBSD,
not just releases from 4.4 onward. Otherwise, afs_osi_Free() will
use AFS_KFREE, which does not exist, since OBSD/osi_machdep.h is
not included, resulting in unresolved symbols when trying to load
the kernel module.

Change-Id: Ic9632c9df347cc17e122b6302ef14e63fa5b68b4
Reviewed-on: http://gerrit.openafs.org/1910
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Use FREE instead of KFREE
Antoine Verheijen [Thu, 6 May 2010 15:09:19 +0000]
OpenBSD: Use FREE instead of KFREE

In OpenBSD releases prior to 4.2, use the system (kernel-specific)
FREE macro to release space in the kernel module, not KFREE. The
latter does not exist and results in unresolved symbols when trying
to load the kernel module. (This was undoubtedly a typo.)

Change-Id: Id66704ab4d0928e2ce1234de16bb74fe22f4f9c7
Reviewed-on: http://gerrit.openafs.org/1909
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoAlways include afsconfig.h
Simon Wilkinson [Thu, 6 May 2010 13:55:59 +0000]
Always include afsconfig.h

Our coding standards say that OpenAFS source files should always have
 #include <afsconfig.h>
 #include <afs/param.h>
at the start of the file. Including just param.h, or having these
includes in a different order can produce unexpected effects, because
param.h includes sysnames.h, which in turn includes stds.h, which may
rely upon having the results of configure tests available.

Fix the obvious places in the Unix build which get this wrong.

Change-Id: I081f04dab30a6bbb49fe71d3ac2d7c11e231e2f5
Reviewed-on: http://gerrit.openafs.org/1912
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoFix typo: LockType -> lockType
Marc Dionne [Wed, 5 May 2010 22:15:05 +0000]
Fix typo: LockType -> lockType

Fix simple typo that causes a build error.

Change-Id: I85f2899850383746094b7e9bab81dea13c2caeab
Reviewed-on: http://gerrit.openafs.org/1908
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agofcntl write lock on readonly file error fix
Derrick Brashear [Sun, 2 May 2010 23:06:43 +0000]
fcntl write lock on readonly file error fix

apparently we return EROFS where we should return EBADF. Fix the
error the client gets; the RPC is unchanged (and indeed shouldn't
be changed)

Change-Id: I738f1ee36f39d03bf018c0f91c7de9c8ed8cc9a9
Reviewed-on: http://gerrit.openafs.org/1895
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoafsdump scan kill warnings
Derrick Brashear [Wed, 5 May 2010 19:50:07 +0000]
afsdump scan kill warnings

make prototypes for all initialize error table functions appear

Change-Id: Icc72f5218a2f6e0444a325c7fc9a0c1c34843344
Reviewed-on: http://gerrit.openafs.org/1907
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agofreebsd vcache splitting fallout
Derrick Brashear [Tue, 4 May 2010 15:39:19 +0000]
freebsd vcache splitting fallout

fix the vcache splitting to work again

Change-Id: I8833fc6655dcb79329835664d38f5330645b45f8
Reviewed-on: http://gerrit.openafs.org/1904
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: Secure C String usage in src\WINNT\afsd\fs.c
tharidufernando [Sat, 10 Apr 2010 03:31:16 +0000]
Windows: Secure C String usage in src\WINNT\afsd\fs.c

The use of strlen, strcat, strcpy, strncpy and sprintf in
src\WINNT\afsd\fs.c does not effectively protect against buffer
overruns and string truncation errors.  This patchset replaces
their use with StringCbLen, StringCbCat, StringCbCopy,
StringCbCopyN, StringCbCopyEx and StringCbPrintf respectively from
strsafe.h.

The functions sscanf, fscanf and scanf do not check for the size of
the parameters so it is prone to buffer overruns. These functions
can be replaced by sscanf_s, fscanf_s, scanf_s when the Visual Studio
compiler version is 1400 or greater.  Also memcpy will be replaced
by memcpy_s which will check for the size of the destination buffer.

In all cases, failure conditions are handled.

Patchset development was mentored by Asanka Herath and Jeffrey Altman.

Change-Id: I01e9dfc616641c220b57d2871e3e140406df3653
Reviewed-on: http://gerrit.openafs.org/1736
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Tharidu Fernando <tharidufernando@gmail.com>
Tested-by: Tharidu Fernando <tharidufernando@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoNetBSD 5.0 support.
Jonathan A. Kollasch [Sat, 10 Apr 2010 15:55:17 +0000]
NetBSD 5.0 support.

Change-Id: I5b9c5b8204ef729d9719f195ddbaf83c5f9cb4b5
Reviewed-on: http://gerrit.openafs.org/1738
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoSolaris: shutdown in freevfs, not unmount
Andrew Deason [Mon, 3 May 2010 19:57:28 +0000]
Solaris: shutdown in freevfs, not unmount

Call the afs shutdown sequence (afs_shutdown()) in the VFS_FREEVFS
handler, instead of in the VFS_UNMOUNT handler. This way we shutdown
when the last reference to our vfs goes away, instead of when we are
unmounted. That doesn't make much of a difference right now, but doing
so will be required for supporting forced unmounts.

Change-Id: I4158865b139d05e2955e4809b93628df27b83922
Reviewed-on: http://gerrit.openafs.org/1899
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoSolaris: prevent AFS umount while busy
Andrew Deason [Thu, 29 Apr 2010 22:47:15 +0000]
Solaris: prevent AFS umount while busy

Return EBUSY from unmount if someone still references stuff in AFS.
This prevents kernel panics that can occur on shutdown if we umount
while there is a file in AFS open. Normally a process can hold a file
in AFS open, AFS is unmounted, and the file is closed, triggering our
code which explodes if called after we're unmounted.

This adds VFS_HOLD/VFS_RELE calls whenever we 'create' a vcache, or
retire an old one, to keep track if anyone has an open reference to
us.

Change-Id: I95d8cf7e7e4d32a05bee97e06832a530b40af217
Reviewed-on: http://gerrit.openafs.org/1880
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoSolaris: return ENOTSUP for force-unmounts
Andrew Deason [Thu, 29 Apr 2010 21:00:26 +0000]
Solaris: return ENOTSUP for force-unmounts

We don't support forced unmounts yet, so indicate as such.

Change-Id: I3a130a4a8d31eeffd012352f656c2b4e42b46f27
Reviewed-on: http://gerrit.openafs.org/1879
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoRefactor afs_NewVCache
Simon Wilkinson [Sat, 7 Nov 2009 00:16:28 +0000]
Refactor afs_NewVCache

afs_NewVCache was a twisty turny maze of #ifdefs and duplicated code.
This makes a number of sweeping changes to simplify this code, and to
move platform specific elements out into their own directories.

*) ShakeLooseVCaches is refactored so that the same code can be used
   both for platforms that support dynamic vcaches, and those which
   don't.
*) afs_NewVCache, ShakeLooseVCaches, and afs_AllocVCache are all
   modified to remove platform specific code, and to call platform
   specific functions.
*) A new platform file 'osi_vcache.c' is created to hold a number of
   platform specific vcache operations:
   *) osi_TryEvictVCache handles the decision of whether a vcache can
      be evicted or not, and does so if required
   *) osi_NewVnode allocates a new vnode
   *) osi_PrePopulateVCache does the necessary population of the
      vcache, before it's threaded onto the VLRUQ and associated hash
      tables.
   *) osi_AttachVnode handles attaching an OS vnode to our vcache,
      where that is necessary
   *) osi_PostPopulateVCache handles the vcache population that must
      occur after we're on the VLRUQ and have a vnode attached.

Change-Id: I368e5fb500d012b44141aa8f8cf0516e63e58f57
Reviewed-on: http://gerrit.openafs.org/1881
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agopts mem -expandgroups and -supergroups examples
Michael Meffie [Mon, 3 May 2010 19:51:40 +0000]
pts mem -expandgroups and -supergroups examples

Examples of the pts mem -expandgroups and -supergroups
options for the man page.

Change-Id: Idea0509797212397eff87aa5975eaf5364c8414c
Reviewed-on: http://gerrit.openafs.org/1896
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoOpenBSD: Fix bug in setpag() when group list is empty
Antoine Verheijen [Mon, 3 May 2010 21:04:20 +0000]
OpenBSD: Fix bug in setpag() when group list is empty

In OpenBSD, the PAG uses the 2nd and 3rd group slots in the task's
group list. If an application sets en empty group list (such as Samba
does), any existing PAG is lost and any new one is NOT set because
the existing code will set the new group count to 2 instead of 3, and
it leaves the first group entry as garbage (whatever random value the
memory contained), thereby totally messing up the task's group list.
This patch fixes it so that it behaves as expected.

Change-Id: Ia718d55cbaad8ed372fba926dbfcb5db52ea684a
Reviewed-on: http://gerrit.openafs.org/1898
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoFix pattern to detect i386-based OpenBSD system type
Antoine Verheijen [Mon, 3 May 2010 20:32:13 +0000]
Fix pattern to detect i386-based OpenBSD system type

When the pattern to detect OpenBSD system types (via MKAFS_OSTYPE) was split
into two separate ones for amd64 and i386 architectures, the pattern for
i386-based systems was not set quite right. As a result, i386-based OpenBSD
systems are no longer detected properly at this stage, resulting in an error
of "cannot find input file: src/libafs/MakefileProto..in" during configure.
This patch corrects the pattern.

Change-Id: I67079af74117fa3cdc765f19944e23223709ae6b
Reviewed-on: http://gerrit.openafs.org/1897
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: Show configuration pages for all types of MSI installations
Asanka Herath [Tue, 20 Apr 2010 19:06:41 +0000]
Windows: Show configuration pages for all types of MSI installations

The OpenAFS MSI installer wizard used to not show any configuration
pages for "Typical" and "Complete" installations.  Setting the
workstation cell and logon options during installation required
selecting the "Custom" option.  Many users choose the "Typical" option
during installation, and thus would never see the configuration pages.
Therefore, for these users, the workstation cell was being set to the
default.

This patch makes the workstation cell and logon option configuration
pages visible to all types of installations (except silent
installations which show no UI).

Change-Id: Ie3bc040607a8d6b636c884bfcb919d0fc69b0e06
Reviewed-on: http://gerrit.openafs.org/1797
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoProvide a queue_NodeInit() interface
Tom Keiser [Thu, 11 Mar 2010 16:38:31 +0000]
Provide a queue_NodeInit() interface

Provide a queue_NodeInit() interface for the rx queue package.

Change-Id: I85f6caf3605b9a88113ff4d904012ed2aa12a679
Reviewed-on: http://gerrit.openafs.org/1860
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoWindows: Restructure cm_LookupInternal addition of Freelance entries
Jeffrey Altman [Sun, 2 May 2010 19:30:27 +0000]
Windows: Restructure cm_LookupInternal addition of Freelance entries

cm_LookupInternal creates Freelance mount points and symlinks
when queries cannot be found in the Freelance root.afs directory.
If the search name is a full cell name for which vldb information
can be obtained, then a mount point is added.  If the search name
is a left-most substring or the full cell name with a dot appended
to it, then a symlink was created.  This approach created a very
poluted Freelance name space.

This patchset makes the following changes:

 1. Do not create symlinks with a dot appended to the cellname

 2. Do not create symlinks where the left-most substring is not
    a full dot separated component of the cellname.

 3. Permit lookups to succeed when we would have created a
    symlink in the past without creating the symlink.

LICENSE MIT

Change-Id: I4573a2f13d4843878c3f5efc546df29a5023accc
Reviewed-on: http://gerrit.openafs.org/1894
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: Permit BPlus tree lookups within cm_ApplyDir
Jeffrey Altman [Sun, 2 May 2010 19:26:39 +0000]
Windows: Permit BPlus tree lookups within cm_ApplyDir

BPlus tree lookups are much faster than searching through
the native directory format on Windows because the case sensitive
hash tables cannot be used successfully.  Permit BPlus trees
to be used except when called with cm_BPlusDirFoo as the action
function because cm_BPlusDirFoo is used to build the BPlus trees
from the native directory format.

LICENSE MIT

Change-Id: I3f6f5ba7113e206c76fafd1ec83822adc7f42f9e
Reviewed-on: http://gerrit.openafs.org/1893
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: Prevent cm_FreelanceAddSymlink from creating a symlink ending in a dot
Jeffrey Altman [Sun, 2 May 2010 19:05:40 +0000]
Windows: Prevent cm_FreelanceAddSymlink from creating a symlink ending in a dot

Symlinks are ending up in the Freelance root.afs directory that
end with a dot.  Make sure it cannot happen.

LICENSE MIT

Change-Id: I8a19c0cf6c2a68c22839e15641206f7e9db8b15b
Reviewed-on: http://gerrit.openafs.org/1892
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: normalize error codes from cm_FreelanceAddSymlink
Jeffrey Altman [Sun, 2 May 2010 19:03:52 +0000]
Windows: normalize error codes from cm_FreelanceAddSymlink

Return all error codes from the end of the function.

LICENSE MIT

Change-Id: I7703c90884820ed7eb1f43183d80c7df038cfb8b
Reviewed-on: http://gerrit.openafs.org/1891
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: Force rebuilding Freelance directory in AddMount and AddSymlink
Jeffrey Altman [Sun, 2 May 2010 18:48:00 +0000]
Windows: Force rebuilding Freelance directory in AddMount and AddSymlink

cm_FreelanceAddMount and cm_FreelanceAddSymlink is supposed to
return the allocated FID of the entry that was added.  However,
cm_NameI is called to perform the lookup without forcing an update
of the Freelance fake directory.  As a result the entry may not be
found.

Force an update prior to calling cm_NameI() by using
cm_clearLocalMountPointChange() and cm_reInitLocalMountPoints()
if required.

LICENSE MIT

Change-Id: I08147b2ec61c810fdc718964362315af67d485b8
Reviewed-on: http://gerrit.openafs.org/1890
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: normalize return codes from cm_FreelanceAddMount
Jeffrey Altman [Sun, 2 May 2010 18:17:43 +0000]
Windows: normalize return codes from cm_FreelanceAddMount

Instead of returning an undefined CM error code, -1, which might
end up being confused with an Rx error, return legal CM_ERROR_xxx
values.

LICENSE MIT

Change-Id: Ie78e4e9cf00fa938806c8b355f54169a5691ff04
Reviewed-on: http://gerrit.openafs.org/1889
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: use cm_noteLocalMountPointChange whenever fakeDirVersion is changed
Jeffrey Altman [Sun, 2 May 2010 18:03:23 +0000]
Windows: use cm_noteLocalMountPointChange whenever fakeDirVersion is changed

cm_noteLocalMountPointChange() is meant to be used when fakeDirVersion
is changed.  It previously wasn't used because cm_noteLocalMountPointChange()
would obtain the cm_Freelance_Lock.  Now that cm_noteLocalMountPointChange()
can be called while holding the lock, use it everywhere.

LICENSE MIT

Change-Id: I737f4572773a93a656ca0f58e07a55d250c368a1
Reviewed-on: http://gerrit.openafs.org/1888
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: add locked parameter to cm_noteLocalMountPointChange
Jeffrey Altman [Sun, 2 May 2010 17:56:24 +0000]
Windows: add locked parameter to cm_noteLocalMountPointChange

If cm_Freelance_Lock is held set the 'locked' parameter to TRUE.
This avoids a requirement to drop the lock only to have it be
obtained when cm_noteLocalMountPointChange.

LICENSE MIT

Change-Id: Ic1e8a008639b33769a088c3b24ef7a7e7b09fb12
Reviewed-on: http://gerrit.openafs.org/1887
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: remove unused code from cm_FollowMountPoint
Jeffrey Altman [Sun, 2 May 2010 17:21:12 +0000]
Windows: remove unused code from cm_FollowMountPoint

The variable 'tlen' is set to the length of the mount point
target string but is never used.  Remove it.

LICENSE MIT

Change-Id: I1e53831eff90962c93720831a210faa019e38d67
Reviewed-on: http://gerrit.openafs.org/1886
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: initialize to zero Freelance fake root directory
Jeffrey Altman [Sun, 2 May 2010 17:11:14 +0000]
Windows: initialize to zero Freelance fake root directory

The Freelance fake root directory buffers were not zero-filled.
This results in random behavior that can cause the service to
terminate unexpectedly.

LICENSE MIT

Change-Id: If4e42f74bf07a7296319f3a73f8c7628de4e1fd8
Reviewed-on: http://gerrit.openafs.org/1885
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: make cm_BPlusDirFoo public
Jeffrey Altman [Sun, 2 May 2010 17:04:42 +0000]
Windows: make cm_BPlusDirFoo public

Make cm_BPlusDirFoo so that the function pointer can
be referenced from cm_ApplyDir.

LICENSE MIT

Change-Id: Ic58ce47dbcd9d6348666b1767941d861cd860df5
Reviewed-on: http://gerrit.openafs.org/1884
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: correct "fs quota" pioctl validation check
Jeffrey Altman [Sun, 2 May 2010 13:21:48 +0000]
Windows: correct "fs quota" pioctl validation check

The validation check for the response from the GetVolumeStatus
pioctl is incorrect.  The response is not simply a VolumeStatus
structure but also several C strings appended to it.

LICENSE MIT

Change-Id: Ieb0c0cd166f85e073431890f51f735958776eb74
Reviewed-on: http://gerrit.openafs.org/1883
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: getAFSServer wrong variable used in uncompiled code
Jeffrey Altman [Sun, 2 May 2010 13:16:29 +0000]
Windows: getAFSServer wrong variable used in uncompiled code

In the uncompiled implementation of getAFSServer, the unmodified
'cellname' is used in the send_DNS_AFSDB_Query call instead of
the properly constructed 'query' variable.

LICENSE MIT

Change-Id: I9de506a2986872ab88aeea158aa43133efc75d50
Reviewed-on: http://gerrit.openafs.org/1882
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: FlushFile ioctl should call cm_FSync, not buf_CleanVnode
Jeffrey Altman [Wed, 28 Apr 2010 16:33:03 +0000]
Windows: FlushFile ioctl should call cm_FSync, not buf_CleanVnode

When flushing a file, we need to commit the file length changes
as well as the dirty buffers.  Call cm_FSync instead of buf_CleanVnode
which is called by cm_FSync.

LICENSE MIT

Change-Id: Id21e49e0559d20fce3e1d65cb73496a8b6cb1fa1
Reviewed-on: http://gerrit.openafs.org/1875
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWindows: add 'locked' flag to cm_FSync and call when dropping write locks
Jeffrey Altman [Wed, 28 Apr 2010 16:21:00 +0000]
Windows: add 'locked' flag to cm_FSync and call when dropping write locks

cm_FSync should be called when releasing file server write locks.
This ensures that all dirty buffers are stored before the lock
can be acquired by another client.

Since cm_Unlock holds the cm_scache_t->rw exclusively when calling
cm_FSync, add a 'locked' parameter to cm_FSync to avoid an unnecessary
release and reacquire of the rwlock.

LICENSE MIT

Change-Id: I70bbeffc24ec4238461281bab4006b3a57b275e2
Reviewed-on: http://gerrit.openafs.org/1876
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Asanka Herath <asanka@secure-endpoints.com>
Reviewed-by: Asanka Herath <asanka@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

13 years agoWarning fix: cpp hates apostrophes
Marc Dionne [Wed, 28 Apr 2010 23:07:32 +0000]
Warning fix: cpp hates apostrophes

The compiler complains when the text in a #warning contains a
single apostrophe:
   error: missing terminating ' character

Change the text to avoid it.

Change-Id: Ibf1f4d2cb922b313545ed228a2a8d4eb6b134178
Reviewed-on: http://gerrit.openafs.org/1877
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agonetbsd: rebase cm at NetBSD 4.0
Matt Benjmain [Wed, 28 Apr 2010 10:19:16 +0000]
netbsd: rebase cm at NetBSD 4.0

Rebases the NetBSD client port at OpenBSD, which was originally
based on an original NetBSD client port by John Kohl.  The
platforms remain closely connected.

At latest milestone, the port builds as a NetBSD LKM, which was
loadable and can mount /afs (but much work remains past this
point).

Change-Id: I1381a60078794da03a82e7bf6e78127da82d61ee
Change-Id: I8e07e82796f6981c99d22ff50dd5b284aad88a9f
Reviewed-on: http://gerrit.openafs.org/1874
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoupstream dumpscan changes
Derrick Brashear [Wed, 28 Apr 2010 06:02:05 +0000]
upstream dumpscan changes

pull in code changes from upstream for dumpscan

Change-Id: Ib1bcba7a420d19c1bf27b2a5405aaee786e6cbd6
Reviewed-on: http://gerrit.openafs.org/1873
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Register number sysctls only when desperate
Simon Wilkinson [Wed, 28 Apr 2010 00:13:30 +0000]
Linux: Register number sysctls only when desperate

The AFS sysctl interface was trying to register numeric system
calls whenever the kernel would let it. This is anti-social, as
we've never had sysctl numbers allocated to us. In kernels newer
than 2.6.24, this misbehaviour is detected and punished. In recent
kernels, the binary interface has gone away entirely.

Since 2.6.19, the kernel has supported allocated unnumbered system
calls. These are only available via /proc/sys (and not the using
the legacy, binary, API), but they're really the only interface
available to us.

Change the sysctl registration code to use unnumbered calls whenever
they are available. Unnumbered calls aren't available in 2.4.x, so
completely remove that code there.

Change-Id: I882117ca2250894f479292026fed84ff0b5e7972
Reviewed-on: http://gerrit.openafs.org/1871
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: specify void argument for afs_try_to_freeze inlines
Marc Dionne [Wed, 28 Apr 2010 00:00:23 +0000]
Linux: specify void argument for afs_try_to_freeze inlines

The new freeze inlines take no arguments, but need to be declared
as taking (void) to prevent warnings that it is not a proper prototype.

Change-Id: Ife675e69f566fabaee4bc41f2cc4fa9a20e816db
Reviewed-on: http://gerrit.openafs.org/1870
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux autoconf: fix name for struct cred test
Marc Dionne [Tue, 27 Apr 2010 22:36:46 +0000]
Linux autoconf: fix name for struct cred test

The new macro scheme changes the name of the tested define.
Update the code to match.

Change-Id: I0e9f04692d8fbb6e9452a9b169c191ce7148349b
Reviewed-on: http://gerrit.openafs.org/1868
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux autoconf typo
Marc Dionne [Tue, 27 Apr 2010 22:25:15 +0000]
Linux autoconf typo

The test for the new export ops has a typo which
makes the test fail where it should succeed: eops -> _eops

Change-Id: I97dd0707b911c51f6394ada426a98e06a83ad35e
Reviewed-on: http://gerrit.openafs.org/1867
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoAdd some directory package doxygen comments
Tom Keiser [Thu, 25 Mar 2010 17:08:51 +0000]
Add some directory package doxygen comments

Change-Id: I75c358f08c71b2de722de03bb65fb8696657d57f
Reviewed-on: http://gerrit.openafs.org/1861
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: autoconf fallout
Simon Wilkinson [Tue, 27 Apr 2010 21:16:24 +0000]
Linux: autoconf fallout

grap != grab - fix spelling of grab_cache_page_write_begin

Change-Id: I4032bff80b6d1d7568af8f9de59a56c0bd6a661a
Reviewed-on: http://gerrit.openafs.org/1859
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agonetbsd: remove old (non-original) NBSD port
Matt Benjmain [Tue, 27 Apr 2010 16:06:48 +0000]
netbsd: remove old (non-original) NBSD port

Prepare for rebase of NBSD port at the current OBSD port,
which is descended directly from the original NBSD port and
more closely resembles it.

Change-Id: I9ff67ebea04534ac5ddc11c0aa1d65028067806a
Reviewed-on: http://gerrit.openafs.org/1858
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Remove unnecessary crhold on incomplete kernel credentials
Marc Dionne [Sun, 25 Apr 2010 02:12:27 +0000]
Linux: Remove unnecessary crhold on incomplete kernel credentials

When credentials debugging is active in the kernel, sanity checks
in various credentials functions such as get_cred or put_cred
require that they are called with full fledged kernel credentials.
This can be a problem with recent kernels in osi_Init where we
build our own credentials and try to "crhold" them.
Getting a reference doesn't make much sense anyway since we're
using a statically allocated structure that we never try to free
or modify.

As a minimal fix, just don't call crhold when we're using
the kernel credentials structure.

Change-Id: If4f843ad33526c6a42f1cf67c57763593ffa50ac
Reviewed-on: http://gerrit.openafs.org/1828
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

13 years agoflush changes on LOCK_EX unlock
Derrick Brashear [Mon, 26 Apr 2010 21:43:16 +0000]
flush changes on LOCK_EX unlock

right now, flock with LOCK_EX, on unlock, triggers an async store.
make it sync, but also, make sure to ask to have any in-memory
data sent to us (e.g. VM_StoreAllSegments); unlike Solaris
VMSYNC_INVAL, we don't want to invalidate the pages, just get copies
written back.

LOCK_SH did not, does not and AFAICT should not trigger writes.

Change-Id: Id4a72f73b685b5566bb31f6f610f22d806899280
Reviewed-on: http://gerrit.openafs.org/1846
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoallow file length to be updated unless we're writing
Derrick Brashear [Mon, 26 Apr 2010 20:41:29 +0000]
allow file length to be updated unless we're writing

right now, merely having the file open O_RDWR, or mapped,
precludes a length update from being reflected.

Change-Id: I7f732b053c392aa6cc1c8ad6de8e0f4bd6468728
Reviewed-on: http://gerrit.openafs.org/1841
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Reorder the tests
Simon Wilkinson [Tue, 27 Apr 2010 18:31:55 +0000]
Linux: Reorder the tests

As a final change to the Linux autoconf stuff, reorder the list of
tests so that it's more easy to see what's being checked for, and to
prevent multiple copies of the same thing being added.

Change-Id: I84ca132e178b45ac25ebd48e71193bdd84965770
Reviewed-on: http://gerrit.openafs.org/1857
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Don't preprocess osi_vfs.h
Simon Wilkinson [Tue, 27 Apr 2010 17:57:30 +0000]
Linux: Don't preprocess osi_vfs.h

Before we did inodes properly, we needed to pre-process osi_vfs.h,
in order to merge our inode structure with the Linux one. Ever since
we moved to native inodes, that preprocessing has been disabled, and
we've just copied osi_vfs.hin to osf_vfs.h Skip this pointless step,
permanently rename osi_vfs.hin to osi_vfs.h, and remove the unused
support scripts.

Change-Id: I5e21eccf2242080cd8b994bd1654260bfb531420
Reviewed-on: http://gerrit.openafs.org/1856
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Don't waste autoconf checks on cpp defines
Simon Wilkinson [Tue, 27 Apr 2010 16:49:19 +0000]
Linux: Don't waste autoconf checks on cpp defines

If something is a #define, then there's no point in doing a test
compile to check for its presence. Instead, just do #if defined(X)

Remove the tests for for_each_process and prev_task.

Change-Id: Id8a9fddf2571cccd5d61982d4662bce2009c8f43
Reviewed-on: http://gerrit.openafs.org/1855
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Add general autoconf macro for Linux kernel
Simon Wilkinson [Tue, 27 Apr 2010 16:41:22 +0000]
Linux: Add general autoconf macro for Linux kernel

Add AC_CHECK_LINUX_BUILD() to do a standardised Linux build, which
takes a "checking" message, the autoconf variable to use to cache
the results, headers and code to run, preprocessor variable to
define, and a description of that variable.

Reimplement all of our existing check macros in terms of this one,
resolving many typos along the way.

Change-Id: I41988c83fcdbfbf8152f6dd0e7c4bd16c7a04240
Reviewed-on: http://gerrit.openafs.org/1854
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Add autoconf macro for structure checks
Simon Wilkinson [Tue, 27 Apr 2010 12:02:20 +0000]
Linux: Add autoconf macro for structure checks

Add a new autoconf macro for doing structure element checks, and
modify all simple structure checks to use it. This introduces a
standard name form - STRUCT_structure_HAS_element, so there are
some changes in the code to make use of this standard form.

Change-Id: Ife967322503ae6f428e76845000de04f26929e65
Reviewed-on: http://gerrit.openafs.org/1853
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Macroise kernel function autoconf tests
Simon Wilkinson [Mon, 26 Apr 2010 22:54:05 +0000]
Linux: Macroise kernel function autoconf tests

We spend a lot of time in autoconf checking to see if kernel
functions are available. Rather than copying and pasting the same
code everytime we do so, create a macro to do function tests, and
use that macro. This results in standardised naming, so change all
of the places that use autoconf results to use the same standardised
names.

Change-Id: I36212e6c28c4b8455f859da1bbf3e456a2aabc07
Reviewed-on: http://gerrit.openafs.org/1849
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Tidy up freezer code
Simon Wilkinson [Mon, 26 Apr 2010 21:13:39 +0000]
Linux: Tidy up freezer code

Linux now provides try_to_freeze(), which can be used to replace
all of our refrigerator code. This has been in the tree for a long
time, and actually predates many of the changes we've been modifying
our code to work with. So, use try_to_freeze wherever we can, and keep
a simpler compatibility function for kernels which are too old to have
it.

Change-Id: Iec50f83382f46d2b17b43da815a75755ea916bc6
Reviewed-on: http://gerrit.openafs.org/1845
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Simplify header file checks
Simon Wilkinson [Mon, 26 Apr 2010 20:34:17 +0000]
Linux: Simplify header file checks

Provide an autoconf macro to perform tests for the existence of
Linux kernel header files. Use this to standardise the naming of
header file presence #defines, and to simplify the linux tests.

Change-Id: I49629679db56c5f9a39487bd78fc2e59d5da0269
Reviewed-on: http://gerrit.openafs.org/1844
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoRename afs_nbsd_* functions in OBSD
Matt Benjamin [Tue, 27 Apr 2010 17:03:36 +0000]
Rename afs_nbsd_* functions in OBSD

The OBSD cm port prefixes function names with afs_nbsd_, an
artifact of its origin in the original NBSD cm port.  Make the
prefix afs_obsd_.

Change-Id: Id412fe0f752a147e2a9afda904db220ea6efd736
Reviewed-on: http://gerrit.openafs.org/1850
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoOverzealous .gitignore under rxkad
Simon Wilkinson [Mon, 26 Apr 2010 22:36:38 +0000]
Overzealous .gitignore under rxkad

The .gitignore in rxkad ignores sboxes.h and fcrypt.h,
since they used to get copied there from the domestic subdir.
Now that they actually live under rxkad, they souldn't be
ignored.

(with thanks to Marc for the commit message)

Change-Id: I1dd6766e75c15ca7f5604601bbe5b4e67f4fffa6
Reviewed-on: http://gerrit.openafs.org/1848
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoOverzealous clean target under rxkad
Marc Dionne [Mon, 26 Apr 2010 22:15:16 +0000]
Overzealous clean target under rxkad

The clean target under rxkad removes sboxes.h and fcrypt.h,
since they used to get copied there from the domestic subdir.
Now that they actually live under rxkad, they souldn't be
removed.

Change-Id: I867496dd0d3dd997d402ebfbfc6272447b1af98e
Reviewed-on: http://gerrit.openafs.org/1847
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agodcache dirty pages flag is solaris only
Derrick Brashear [Mon, 26 Apr 2010 19:55:57 +0000]
dcache dirty pages flag is solaris only

note that IFDirtyPages is Solaris-only, so there's no confusion. may be
worth visiting to see if and how the code should be minimized or adapted
for elsewhere

Change-Id: I7dfe4760eb4038d23a920c2e23f33d93e604bbca
Reviewed-on: http://gerrit.openafs.org/1840
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Don't hide memory management
Simon Wilkinson [Fri, 23 Apr 2010 16:07:40 +0000]
Linux: Don't hide memory management

Given that we now only switch from user space into kernel space in
one place, don't hide the mechanism we use to do so behind macros.
This makes it much easier to visually confirm the correctness of the
code.

Change-Id: Ie52e071c81a9178c792be1eaa7e36d8453ebb319
Reviewed-on: http://gerrit.openafs.org/1820
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Dan Hyde <drh@umich.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: The kernel module always runs in the kernel
Simon Wilkinson [Fri, 23 Apr 2010 16:10:15 +0000]
Linux: The kernel module always runs in the kernel

There's no situation where we'd be including osi_machdep.h and not
be building for the kernel, so just remove the case that disables all of
the locks if __KERNEL__ isn't defined.

Change-Id: I1141c37cf0cd517191dee7ca2404e109d4053c29
Reviewed-on: http://gerrit.openafs.org/1821
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agofix other oldtvix typo
Derrick Brashear [Mon, 26 Apr 2010 04:21:30 +0000]
fix other oldtvix typo

i failed to push this to commit 0dac8f93af5262472bc5bdf94dbb605a24da59d0,
and so, well, here's the real fix. sorry.

Change-Id: I6799ecb207f246ac3e4c48b1de55268d2fba4d23
Reviewed-on: http://gerrit.openafs.org/1837
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoInitialize oldvtix
Marc Dionne [Thu, 22 Apr 2010 21:22:37 +0000]
Initialize oldvtix

Initialize the variable to avoid compiler complaints that it
could be used uninitialized.  Use a sentinel value and issue
a warning if we try to use the variable and we haven't set
it to a useful value.

Change-Id: I037be2ad8e0b55d06b50aafdeca5012764640f16
Reviewed-on: http://gerrit.openafs.org/1810
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Use kernel network helper functions
Simon Wilkinson [Fri, 23 Apr 2010 17:03:49 +0000]
Linux: Use kernel network helper functions

Linux has various network helper functions available, which are
guaranteed to do the right thing in terms of setting address space
limits, not dereferencing NULL pointers, and the like. Use these, where
they're available, rather than rolling our own.

kernel_sendmsg and kernel_recvmsg appeared in 2.6.8.

Change-Id: I1cd91afd2182ad936756bbc4cf692262499c16e4
Reviewed-on: http://gerrit.openafs.org/1822
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Remove old code from RX kernel implementation
Simon Wilkinson [Fri, 23 Apr 2010 17:38:02 +0000]
Linux: Remove old code from RX kernel implementation

The RX implementation was split into LINUX and LINUX24 along with
the kernel, but the old 2.4 and 2.2 only code was never removed from
the LINUX/ directory. Do so now.

Change-Id: I80300a1390e297298f4af3c06086e25d0acf8c1a
Reviewed-on: http://gerrit.openafs.org/1819
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Derrick Brashear <shadow@dementia.org>

13 years agoLinux: Don't pass f_pos down to the filesystem
Simon Wilkinson [Fri, 23 Apr 2010 15:54:39 +0000]
Linux: Don't pass f_pos down to the filesystem

In 2.6.8, Linux shifted from passing f_pos directly to the read
and write routines, and started passing a copy. This helps reduce,
but does not remove, the race issues with f_pos itself. Make this
change for us.

Take the opportunity to remove the uneccessary macros, and tidy up
some casting.

Change-Id: I3b4cdf1e6e8127cbe0055829605268953c4397a6
Reviewed-on: http://gerrit.openafs.org/1818
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>