openafs.git
10 years agoWindows: cm_GetCell_gen Fixup cm_server cellp on race
Jeffrey Altman [Thu, 23 Jan 2014 03:17:56 +0000]
Windows: cm_GetCell_gen Fixup cm_server cellp on race

If a race occurs during the instantiation of a new cm_cell_t object,
the created servers will point at the wrong cm_cell_t object after
the race is detected.  Before cm_GetCell_gen completes the cm_server_t
objects must be fixed to point to the correct cm_cell_t.

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

10 years agoWindows: Support arbitrary callback ports
Jeffrey Altman [Fri, 31 Jan 2014 05:56:49 +0000]
Windows: Support arbitrary callback ports

Reconfigure the advanced firewall to support callback ports
other than port 7001.

This changes the semantics of the afsicf api.  AFS_PORTSET_SERVER is now
zero.  Any other value is treated as a callback port.

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

10 years agoWindows: cm_AddCellProc always call cm_NewServer
Jeffrey Altman [Fri, 31 Jan 2014 05:49:44 +0000]
Windows: cm_AddCellProc always call cm_NewServer

The current implementation of cm_NewServer handles races and
collisions.  There is no need to perform a cm_FindServer() check
first.  Just call cm_NewServer() for all server entries.

Move the logging of server creation and cell assignment to
cm_NewServer().

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

10 years agobos: Remove last of MRAFS references
Chas Williams (CONTRACTOR) [Thu, 6 Feb 2014 17:47:16 +0000]
bos: Remove last of MRAFS references

A few MRAFS tidbits were left behind during the cleanup in commit
a9301cd2dc1a875337f04751e38bba6f1da7ed32.

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

10 years agolibacl: use initialized memory
Arne Wiebalck [Fri, 7 Feb 2014 11:37:57 +0000]
libacl: use initialized memory

Replace malloc with calloc to use zeroed memory when converting access
lists.

Change-Id: I17558d1737fee020772919e423c9fba37180beca
Reviewed-on: http://gerrit.openafs.org/10815
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoafs: Throttle byte-range locks warnings per-file
Andrew Deason [Fri, 31 Jan 2014 22:46:12 +0000]
afs: Throttle byte-range locks warnings per-file

Currently, the warning messages about byte-range locks are throttled
only according to what the last PID of the locking process was. So, if
that same process performs a bunch of byte-range locks a bunch of
times, we log this warning message at most once every 2 minutes.

However, if we have even just one other process also performing
byte-range locks, the throttling can become pretty useless as
lastWarnPid ping-pongs back and forth between the two different PIDs.
This can happen if multiple unrelated byte-range-lock-using pieces of
software just happen to be running on the same machine, or if a piece
of software uses byte-range locks after forking into separate
processes.

To avoid flooding the log in situations like this, keep track of the
last warn time in the relevant vcache, so we don't get frequent
warnings for byte-range lock requests on the same file.

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

10 years agonamei: Ignore misplaced files
Andrew Deason [Fri, 30 Aug 2013 19:21:16 +0000]
namei: Ignore misplaced files

The namei salvaging/ListViceInodes code currently ignores files where
we cannot derive an inode number from a given filename. However, if a
file is a valid inode filename, but is in the wrong directory, we
still record it. This can cause the salvager to abort, since it
assumes inode e.g. 12345 is present, but when it tries to open 12345,
namei translates the inode to a nonexistant path, and we bail out.

It is unknown how a namei directory structure can reach this state,
but try to handle it. To be on the safe side, just ignore the files,
and log a message about them. That way, if the files are required for
reconstructing the volume or contain important data, they are still
available if needed. And if they contain incorrect or old data, we
don't screw up the volume by trying to use them.

Thanks to Sabah S. Salih for reporting a related issue.

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

10 years agosalvager: Handle multiple/inconsistent linktables
Andrew Deason [Thu, 3 Oct 2013 17:51:41 +0000]
salvager: Handle multiple/inconsistent linktables

The ListAFSSubDirs code in namei_ops.c currently detects
incorrectly-named linktable files, and whines about them and says the
salvager will handle them. However, the salvager doesn't really handle
them, since we just use the first linktable we find (FindLinkHandle)
without checking any of the information about it.

So, check for these. Fix FindLinkHandle to only consider a linktable
the "real" linktable to use if it actually matches the volume group id
we're salvaging. Also delete any inconsistent linktables via the new
function CheckDupLinktable later on.

Note that inconsistently-named linktables have been known to have been
created in the past due to a bug in the salvager (fixed by ae227049),
and possibly due to other unknown issues.

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

10 years agovos: move convertROtoRW core logic to vsprocs
Mark Vitale [Fri, 15 Feb 2013 21:58:16 +0000]
vos: move convertROtoRW core logic to vsprocs

Create new vsprocs routine UV_ConvertRO in preparation for adding
new function to vos convertROtoRW.

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

10 years agoRedHat: don't package manpages for binaries not included
Stephan Wiesand [Fri, 31 Jan 2014 16:01:06 +0000]
RedHat: don't package manpages for binaries not included

We don't package copyauth, aklog_dynamic_auth and rmtsysd.
Omit their manpages too.

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

10 years agoafs: Include FID in DoLockWarning
Andrew Deason [Fri, 31 Jan 2014 22:40:35 +0000]
afs: Include FID in DoLockWarning

Provide the FID that is being locked when we warn about byte-range
locks, so the user can find what file the process is trying to lock.

Change-Id: I56a185c200ac73045ee29b79410e27222c2637f2
Reviewed-on: http://gerrit.openafs.org/10795
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

10 years agoafs: Refactor DoLockWarning
Andrew Deason [Fri, 31 Jan 2014 22:36:44 +0000]
afs: Refactor DoLockWarning

Change DoLockWarning around a little bit, so subsequent changes are
easier to follow. Move lastWarnTime/lastWarnPid so they are only
usable within this function.

This commit should incur no functional change.

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

10 years agoLinux: When revalidating, don't drop in-use dentries
Marc Dionne [Thu, 30 Jan 2014 18:50:37 +0000]
Linux: When revalidating, don't drop in-use dentries

The Linux client can get into a state where the current working
directory is seen as "deleted" by some tools, while it is still
there and accessible to "ls" and other tools.  This has been
reported by several users and sites.

One scenario that has been observed while debugging:
- A process does a chdir() into a directory
- This stores a pointer to the dir's dentry in the task structure
- The server hosting the volume goes offline temporarily
- The dentry for the directory is passed to afs_linux_dentry_revalidate
- afs_linux_dentry_revalidate calls afs_lookup which returns an
error (110 - ETIMEDOUT)
- It then considers the dentry not valid, and calls d_drop()
- d_drop unhashes the dentry unconditionally
- Server comes back up, but dentry is still unhashed
- getcwd() fetches the task structure pointer to the current dir
dentry.  If unhashed, it returns ENOENT, and the vfs layer is
not involved at all.

At that point, many things won't work and there is no obvious way
for the user to get the directory rehashed.

Instead of calling d_drop directly, call d_invalidate instead, as
it will only drop (unhash) the dentry if we're the only one holding
a reference.  Since d_invalidate will also call shrink_dcache_parent,
also remove that call from our code so it doesn't get called twice.

Change-Id: I03e9872f6f9aebd28cdf6b833e14955edaa2527c
Reviewed-on: http://gerrit.openafs.org/10774
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoLog shutdown progress
Arne Wiebalck [Fri, 10 Jan 2014 16:29:11 +0000]
Log shutdown progress

Shutting down fileservers with thousands of volumes can take a while and
it is helpful for operations to actually see that there is progress when
detaching volumes. This patch adds a log message to the fileserver log
every time 100 volumes have been detached.

Change-Id: I1685aa62335b223cf7cd3286188781318084c22f
Reviewed-on: http://gerrit.openafs.org/10797
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoafs: Pay attention to fetchOps->destroy error code
Andrew Deason [Thu, 30 Jan 2014 20:43:57 +0000]
afs: Pay attention to fetchOps->destroy error code

The ->destroy function in our fetchops could change our error code, or
even raise a new error. Don't ignore it. This currently doesn't do
much, since fetchDestroy currently won't change the error code if it's
given an error, but this can change in the future.

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

10 years agoWindows: Add caching to cm_GetAddrsU
Jeffrey Altman [Mon, 27 Jan 2014 05:33:18 +0000]
Windows: Add caching to cm_GetAddrsU

Cache the results of VL_GetAddrsU queries and reuse the results
for subsequent calls when possible.

Change-Id: I7e2b086ec311208a46439588bc820a1929d2b2b9
Reviewed-on: http://gerrit.openafs.org/10764
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: cm_GetAddrsU wrapper for VL_GetAddrsU
Jeffrey Altman [Mon, 27 Jan 2014 05:30:20 +0000]
Windows: cm_GetAddrsU wrapper for VL_GetAddrsU

cm_GetAddrsU() is a wrapper for the VL_GetAddrsU() RPC.  The initial
version is a bare bones replacement for the VL_GetAddrsU() call from
cm_UpdateVolumeLocation().  Future changes will add caching.

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

10 years agoWindows: replace cm_allServersp list with osi_queue
Jeffrey Altman [Mon, 27 Jan 2014 05:14:36 +0000]
Windows: replace cm_allServersp list with osi_queue

Replace the cm_allServersp list with an osi_queue.  This simplifies
the Add/Remove functionality which will be required in case of VLDB
server uniquifier changes.

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

10 years agoafs: Translate VNOSERVICE to ETIMEDOUT
Andrew Deason [Tue, 28 Jan 2014 00:03:59 +0000]
afs: Translate VNOSERVICE to ETIMEDOUT

Some fileservers will kill calls that are taking too long with the
VNOSERVICE abort code. Our logic for retrying calls is already aware
of this usage, but if we cannot retry the call, we still just return
VNOSERVICE as an error code to our caller.

Don't return this raw, since has the same value as ENOBUFS, which can
cause a confusing error message from logs or applications ("No buffer
space available"). Return ETIMEDOUT instead.

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

10 years agoafs: Fix afs_CheckCode identifier collision
Andrew Deason [Thu, 26 Dec 2013 22:17:44 +0000]
afs: Fix afs_CheckCode identifier collision

The last argument to afs_CheckCode should be unique so the call site
can be identified if fstrace is turned on. BStore and BPartialStore
were both using 43, so change BPartialStore to 430 to avoid the
collision.

Change-Id: I81a43ee41623fad10d0e70a7d9c8e6029aba30eb
Reviewed-on: http://gerrit.openafs.org/10635
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

10 years agoafs: Treat vc_error as a CheckCode-translated code
Andrew Deason [Thu, 26 Dec 2013 21:42:46 +0000]
afs: Treat vc_error as a CheckCode-translated code

The vcache field vc_error is generally treated as an error code that
has been translated through afs_CheckCode, but this is inconsistent in
a few places. Fix this in a few ways:

 - Adjust afs_nfsrdwr so we do not call afs_CheckCode on vc_error,
   translating the error code twice.

 - Change afs_close to store vc_error in code_checkcode, and have the
   logging code check for specific values in code_checkcode as well.
   Log unknown values of code and code_checkcode, so we can
   distinguish between e.g. a 'code' value of VBUSY, and a
   'code_checkcode' value of ETIMEDOUT.

Change-Id: Iab4928efd183fb6c5b0b0f30375b9952ba13b45a
Reviewed-on: http://gerrit.openafs.org/10634
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>

10 years agolibadmin: add header file deps
Michael Meffie [Sun, 19 Jan 2014 03:40:12 +0000]
libadmin: add header file deps

Add the missing header file dependencies to the library targets.
This is needed for parallel make.

Change-Id: I60d60e68ef808a62b4063a6106672f5178c1b605
Reviewed-on: http://gerrit.openafs.org/10726
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agolibadmin: use INSTALL_DATA to export headers
Michael Meffie [Fri, 22 Nov 2013 18:36:54 +0000]
libadmin: use INSTALL_DATA to export headers

Use the INSTALL_DATA macro instead of cp to export
header files.

Change-Id: Ia460d8227f2fb2f594793a01c27f64ff7ce45273
Reviewed-on: http://gerrit.openafs.org/10515
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agolibadmin: makefile rule for afs_AdminError.h
Michael Meffie [Sun, 19 Jan 2014 03:01:59 +0000]
libadmin: makefile rule for afs_AdminError.h

Add a makefile rule to export the libadmin afs_AdminErrors.h header
file, instead of exporting afs_AdminErrors.h as a side effect of
generating the afs_AdminBosErrors error table.

Add the missing afs_AdminErrors.h dependency to the afs_utilAdmin.o
dependency list.

Change-Id: Ib8c7d22d705061615fb20a6a521dc20f0f1d6da0
Reviewed-on: http://gerrit.openafs.org/10369
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agolibadmin: remove duplicate dependency
Michael Meffie [Sun, 19 Jan 2014 02:56:36 +0000]
libadmin: remove duplicate dependency

afs_AdminPtsErrors.h was listed twice in the dependency
afs_utilAdmin.o dependency list.

Change-Id: I4bf37d0502e26e05f912a136045814e32de73c4a
Reviewed-on: http://gerrit.openafs.org/10725
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agotvolser: fix makefile clean target
Michael Meffie [Sun, 19 Jan 2014 19:15:13 +0000]
tvolser: fix makefile clean target

Remove generated source files with the clean makefile target.

Change-Id: I1e7d06c217f63fb9ee749e23bca1531d22babdda
Reviewed-on: http://gerrit.openafs.org/10724
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoconfig: use the standard INSTALL_DATA makefile macro
Michael Meffie [Sun, 19 Jan 2014 19:02:28 +0000]
config: use the standard INSTALL_DATA makefile macro

Replace the custom INST makefile macro with the standard
INSTALL_DATA macro for installing and exporting files.

Change-Id: I5d8c41d1c6d2c3ee021e0d6a5fbca8ef9178e74d
Reviewed-on: http://gerrit.openafs.org/10723
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoconfig: parallel-safe param.h makefile rule
Michael Meffie [Fri, 22 Nov 2013 17:23:17 +0000]
config: parallel-safe param.h makefile rule

Generate the param.h.new temporary file in a parallel-safe
way.  The rule to generate the three copies of param.h can
run at the the same time under a parallel make, clobbering
the param.h.new temporary file. Instead of creating this file
inline, create a common rule to generate the temporary file
once.

Change-Id: I823b6a55f3168e991b64660bfe51303d43f693a9
Reviewed-on: http://gerrit.openafs.org/10516
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agolibafscp: makefile install rule update
Michael Meffie [Fri, 22 Nov 2013 16:50:11 +0000]
libafscp: makefile install rule update

Change the makefile install rules to install the header
file from the libafscp directory, and not the top level
include directory to make the install rules consistent
with the rest of the tree.

Change-Id: Ia06c29e72f7005569f2d11d3d0f6691413e0eeec
Reviewed-on: http://gerrit.openafs.org/10514
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agocomerr: compile_et -emit option for parallel make
Michael Meffie [Wed, 1 Aug 2012 21:26:33 +0000]
comerr: compile_et -emit option for parallel make

Add the -emit option to the compile_et command to support parallel make.

The -emit option allows make to generate the header and the source files
independently, instead of building two files at the some time.  This
avoids the issue where one command creates two separate files, which is
difficult to handle correctly for parallel makes.

Change-Id: Ib44a8e358643cf19b4834b3bd4d5b88db6cd0ccf
Reviewed-on: http://gerrit.openafs.org/7921
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agodoc: afs_compile_et -h option
Michael Meffie [Mon, 20 Jan 2014 19:37:52 +0000]
doc: afs_compile_et -h option

Document the afs_compile_et -h option.

Change-Id: I4972bcc1948e8dd7ae73dfcabfbaf822cfbfe64b
Reviewed-on: http://gerrit.openafs.org/10722
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoRedHat: Use systemd unit files on RHEL >= 7
Stephan Wiesand [Thu, 23 Jan 2014 13:43:32 +0000]
RedHat: Use systemd unit files on RHEL >= 7

Handle rhel >= 7 like fedora >= 15 when deciding whether
to package systemd unit files or sysvinit scripts in the
rpm spec file.

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

10 years agocomerr: long and short form of the -prefix option.
Michael Meffie [Tue, 21 Jan 2014 14:26:11 +0000]
comerr: long and short form of the -prefix option.

The man page documented the prefix option as -prefix; compile_et
supported only the short form -p.

Document and support both the long and short forms for the prefix
option; -p and -prefix.

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

10 years agocomerr: avoid comma operator
Michael Meffie [Fri, 22 Nov 2013 20:26:34 +0000]
comerr: avoid comma operator

Avoid unnecessary use of the comma operator in compile_et's
command-line argument processing.

Change-Id: If9308d211676be471f3534e144c7d90214994699
Reviewed-on: http://gerrit.openafs.org/10491
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agodoc: afs_compile_et -lang short form
Michael Meffie [Tue, 21 Jan 2014 14:39:56 +0000]
doc: afs_compile_et -lang short form

Document the -lang short form for -language.

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

10 years agodoc: afs_compile_et formatting fixes
Michael Meffie [Tue, 21 Jan 2014 14:36:37 +0000]
doc: afs_compile_et formatting fixes

Fix two pod formatting errors and remove one trailing
whitespace characters.

Change-Id: I2ba4fd56afb8c26591d2770301c3edfdd1a898fb
Reviewed-on: http://gerrit.openafs.org/10719
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoFBSD: catch up to 1997 and include if_var.h with if.h
Benjamin Kaduk [Fri, 24 Jan 2014 17:00:20 +0000]
FBSD: catch up to 1997 and include if_var.h with if.h

The commit message for upstream's r257244 change includes:
 - Make the prophecy from 1997 happen and remove if_var.h inclusion
   from if.h.
Despite the clear public posting, we were caught unawares.  We made
it down to the cellar despite the missing stairs, but "Beware of
the Leopard" caused us to turn back, apparently.

Since if.h is included in many places and if_var.h is not present
on all OSes, pull the if.h inclusion into the common kernel headers
for afs/ and rx/ , and add in if_var.h (as well as the sys/socket.h
prerequisite).

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

10 years agoafs: Return raw code from background daemons
Andrew Deason [Fri, 20 Dec 2013 18:16:37 +0000]
afs: Return raw code from background daemons

Currently, a background daemon processing a 'store' request will
return any error code in the 'code' field in the brequest structure,
for processing by anyone that's waiting for the response. Since any
waiter will not have access to the treq for the request, they won't be
able to call afs_CheckCode on that return code, so the background
daemon calls afs_CheckCode before returning its error code.

Currently, afs_close uses the 'code' value from the background daemon
as if it were not passed through afs_CheckCode. That is, if all
background daemons are busy, we get our 'code' directly from
afs_StoreOnLastReference, and if we use a background daemon, our
'code' is tb->code. But these values are two different things: the
return value from afs_StoreOnLastReference is a raw error code, and
the code from the background daemon (tb->code) has been translated
through afs_CheckCode.

This can be confusing, in particular for the scenario where a
StoreData fails because of network errors or because of a VBUSY error.
If we get a network error when the request went through a background
daemon, afs_CheckCode will translate this to ETIMEDOUT, which is
commonly value 110, the same as VBUSY. So, an ETIMEDOUT error from the
background daemon is difficult to distinguish from a VBUSY error from
a direct afs_StoreOnLastReference call. Either case can result in a
message to the kernel like the following:

  afs: failed to store file (110)

To resolve this, have the background daemon store both the 'raw' error
code, and the error code that has been translated through
afs_CheckCode. afs_close can then use the raw error code when
reporting messages like normal, but can still use the translated error
code to return to the caller, if it has a translated error. With this
change, now afs_close will always log "network problems" for a network
error, regardless of if the error came in via a background daemon or a
direct afs_StoreOnLastReference call.

In Irix's afs_delmap, we just remove the old usage of tb->code, since
the result was not used for anything.

Change-Id: I3e2bf7e36c1f098df16a1fdb0dc88b45ea87dfa9
Reviewed-on: http://gerrit.openafs.org/10633
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

10 years agodoc: fix typo in fs setacl
Michael Meffie [Thu, 23 Jan 2014 01:23:29 +0000]
doc: fix typo in fs setacl

Fix typo in the dropbox section where 'l' was referred
to as 'read', not 'lookup'.

Change-Id: I6429c125f0561a1b5d4e7816930988ac1b347be7
Reviewed-on: http://gerrit.openafs.org/10750
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>

10 years agoRemove some explicit sbrk() usage
Benjamin Kaduk [Fri, 10 Jan 2014 04:34:30 +0000]
Remove some explicit sbrk() usage

Mac OS X 10.9 now considers this function deprecated and warns on
its use, causing the buildslave configuration to error out.

Use the library routine to get a process's size instead of inlining
the call to sbrk (which is unlikely to have worked as intended for
quite some time -- most malloc implementations in use do not use
sbrk to get their storage).

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

10 years agoRevert "viced: Enable NAT ping on hosts"
Andrew Deason [Wed, 15 Jan 2014 15:48:48 +0000]
Revert "viced: Enable NAT ping on hosts"

This reverts commit aafdc08cfc49da4c23ecd91f9e690fd70e95df55.

The fileserver-side "NAT ping" behavior has yet to be proven to be
helpful in situations with NATs. If the behavior is not helpful, this
generates potentially a significant amount of extra useless traffic.
So until it can be shown to what degree this is helpful, keep this
behavior out of the fileserver.

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

10 years agoUse an explicit symbol for uninitialized vnode types
Benjamin Kaduk [Fri, 10 Jan 2014 05:00:52 +0000]
Use an explicit symbol for uninitialized vnode types

Avoid trying to get clever with stuffing -1 into an unsigned bitfield,
which causes the value to change and generates a warning from clang.
Just use vNull, which is intended to be used for uninitialized/empty
vnodes.

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

10 years agoAdd braces to avoid a 'dangling else' warning
Benjamin Kaduk [Fri, 10 Jan 2014 04:57:37 +0000]
Add braces to avoid a 'dangling else' warning

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

10 years agoDisable deprecated warnings for krb5 routines
Benjamin Kaduk [Fri, 10 Jan 2014 04:54:45 +0000]
Disable deprecated warnings for krb5 routines

In OS X 10.9 Mavericks, Apple has marked all of the krb5 routines
as deprecated (in favor of the GSS framework).  We must disable
these warnings in order to allow the buildslave to have a successful
build.

Luckily, Apple has left in rope for us to programmatically disable
the deprecated attribute with a preprocessor macro.  Defining this
macro should be safe everywhere, so do so unconditionally.

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

10 years agovol/salvaged.c: Remove unused variable
Benjamin Kaduk [Fri, 10 Jan 2014 04:40:09 +0000]
vol/salvaged.c: Remove unused variable

It was incremented from an uninitialized value, which caused a build
error on the OS X 10.9 buildslave.  Since it's unused, just remove
it entirely.

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

10 years agoviced/callback.c: Ignore dump write errors even harder
Benjamin Kaduk [Fri, 10 Jan 2014 04:38:36 +0000]
viced/callback.c: Ignore dump write errors even harder

Not only do we need to check the return value of write(2), but
we also need to do so in a way that does not leave an empty body
in the if statement, in order to appease the clang-500.2.79 found
on OS X 10.9 with Xcode 5.0.2.

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

10 years agoAdd a routine to get the size of the current process
Benjamin Kaduk [Fri, 10 Jan 2014 17:33:18 +0000]
Add a routine to get the size of the current process

Use rusage when available, and fall back to the very old sbrk(0)
hack otherwise.

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

10 years agoafs_fetchstore: avoid use of uninitialized variable
Benjamin Kaduk [Fri, 10 Jan 2014 03:42:26 +0000]
afs_fetchstore: avoid use of uninitialized variable

rxfs_fetchInit() attempts to do a 64-bit RPC first, but falls back
to the 32-bit StartRXAFS_FetchData() if the server appears to not
support the 64-bit RPCs.

We correctly did not read a length from the call if the FetchData
RPC(s) failed, but proceeded to assign from the 'length' local
variable into the 'alength' output variable unconditionally later on.

Instead of blindly continuing on, jump to the error-handling part of
the routine when we cannot read a length from the call.  This has the
side effect of skipping an afs_Trace3() point in the error case.

Change-Id: I4840d5c692c61630c68e97b5e88f9460abade19e
Reviewed-on: http://gerrit.openafs.org/10694
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

10 years agorfc3961: Use enctypes, not keytypes
Benjamin Kaduk [Thu, 9 Jan 2014 22:29:04 +0000]
rfc3961: Use enctypes, not keytypes

We previously defined the enctype symbols to be aliases for keytype
symbols.  The numerical values matched what we wanted (since these
values are specified in an IANA registry), but the C type is not
required to be the same for enctypes and keytypes.

Some of our buildslave configurations notice the type mismatch and
complain, so fix the types by using the enctype enum for enctype symbols
instead of keytypes.

Change-Id: I56ca634d52954ee44baa34e2d8c876271f171288
Reviewed-on: http://gerrit.openafs.org/10693
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

10 years agoopr: Silence rbtree warning
Andrew Deason [Thu, 9 Jan 2014 18:44:44 +0000]
opr: Silence rbtree warning

On OS X, gcc can complain that 'child' is uninitialized whenever this
'else if' condition is false. We already handled the case where both
node->right and node->left are non-NULL earlier in this function, so
this should never occur. So, to get rid of the warning, just always
take the path in the 'else if', and assert that the right child is
NULL.

Change-Id: I3575de84ea172d3c7e0e022809fdcd0e3b4dcc27
Reviewed-on: http://gerrit.openafs.org/10687
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoDe-duplicate a couple afs_CheckCode uniquifiers
Benjamin Kaduk [Mon, 13 Jan 2014 21:08:14 +0000]
De-duplicate a couple afs_CheckCode uniquifiers

These uniquifiers are supposed to be globally unique, to identify the
call site within the tree.  For whatever reason, a couple of them
were duplicated at different call sites; provide new (unique) values
to disambiguate between them.

There remain a couple of uniquifiers which are used in multiple
places, but those are in different architectures' implementations
of afs/ARCH/foo.c, and thus will be globally unique for any particular
build.

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

10 years agoxstat: fix a malformed debug message
Michael Meffie [Mon, 13 Jan 2014 20:38:44 +0000]
xstat: fix a malformed debug message

a munged format specifier obscured the missing rn arg.

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

10 years agoxstat: use ephemeral ports for xstat_fs_test and scout
Michael Meffie [Mon, 13 Jan 2014 20:28:17 +0000]
xstat: use ephemeral ports for xstat_fs_test and scout

Instead of trying to bind to port 7101, and then retrying if
the port is in already in use, let the os find an available
port for scout and xstat_fs_test.

This fixes a bug where scout and xstat_fs_test do not call
rx_Finalize() before retrying rx_Init() with a different port
number, causing the program to crash later when more than
one copy of xstat_fs_test and/or scout are running at the same
time.

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

10 years agoLinux 3.13: Check return value from bdi_init
Marc Dionne [Tue, 3 Dec 2013 19:10:00 +0000]
Linux 3.13: Check return value from bdi_init

The use of the bdi_init function now gets a warning because the
return value is unused and the function is now defined with
the warn_unused_result attribute.

Assign and check the return value.

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

10 years agoviced: Avoid issuing redundant TMAY requests
Andrew Deason [Thu, 4 Apr 2013 22:35:01 +0000]
viced: Avoid issuing redundant TMAY requests

Currently, if a new Rx connection comes in from a host we already have
a host struct for, we make a TellMeAboutYourself (TMAY) call to the
given host, to verify the UUID (and caps, interface info, etc) is what
we expect it to be. That is, if it's still the "same" host that we
know about. This is necessary because we otherwise have no way of
telling if the Rx connection is from the same host, or from a new host
that just happens to have the same IP address (e.g. in the case that
hosts are moving around and changing IPs). We do this while the host
is locked, so we only issue these TMAY calls one at a time.

If a large number of Rx connections come in from the same host at
around the same time, this can result in a lot of TMAY requests being
issued against the host, even for hosts that never change IPs and
never do anything strange. In these situations, issuing so many TMAYs
is useless. If we have several calls waiting to lock the host to issue
a TMAY, some of the extra TMAY calls are provably useless. So instead
of calling TMAY repeatedly, remember what the last successful TMAY
result was, and reuse it for the "provably useless" calls.

Note that this 'cache' stores the actual raw results of
TellMeAboutYourself. We could save some memory by storing just how we
interpret that data later on in h_GetHost_r, but this way results in
way simpler h_GetHost_r logic. Since, we can use the same code paths
as for a "real" TMAY call.

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

10 years agoDARWIN: Convert crfree back into a macro
Andrew Deason [Thu, 19 Dec 2013 20:04:56 +0000]
DARWIN: Convert crfree back into a macro

Commit 1d8937b860509fcaabb041bc14faf7aa3023f3c9 turned crfree on
DARWIN into an inline function to work around an error flagged by
clang. A side effect of this is that the address passed to
kauth_cred_unref will not be the actual address of the value given to
crfree; we are instead giving kauth_cred_unref the address of our
function argument in order to adhere to the semantics of a function
call.

kauth_cred_unref seems to just take a pointer to the cred pointer in
order to set the value to effectively NULL afterwards, so this is not
a huge deal. However, this does mean that our current implementation
undoes any of the safeguards intended by making kauth_cred_unref work
this way in the first place.

So, revert 1d8937b860509fcaabb041bc14faf7aa3023f3c9 and put the crfree
definition back to the way it was. Fix the caller in
afs_StoreOnLastReference to not cause an error by just assigning the
cred pointer to a temporary value. While it's not ideal that some
callers may need to do this, this is the only place where this is
necessary and it's more of an artifact of the weirdness of storing a
cred pointer in linkData, which probably should be changed anyway.

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

10 years agoSOLARIS: Support VSW_STATS
Andrew Deason [Wed, 8 Jan 2014 00:24:54 +0000]
SOLARIS: Support VSW_STATS

Specify the VSW_STATS flag to the vfsdef_t structure we give to
Solaris. This turns on statistics that can be retrieved via fsstat(1M)
and allows the fsinfo::: DTrace provider to work with AFS files.

We don't need to actually maintain these statistics; Solaris does that
for us. This flag just signifies that our vfs_t structure is capable
of storing the information. Since we get our vfs_t from Solaris (via
domount(), it gives us a vfs_t when it calls our afs_mount function)
and do not allocate a vfs_t ourselves, we are safe and this is fine to
do.

Change-Id: I356df91ea409245f0c5b1e4ef693ac28ad8f11b2
Reviewed-on: http://gerrit.openafs.org/10679
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agovol: reset nextVnodeUnique when uniquifier rolls over
Michael Meffie [Mon, 23 Dec 2013 17:10:36 +0000]
vol: reset nextVnodeUnique when uniquifier rolls over

The on disk uniquifier counter is set to 200 more than the current
nextVnodeUnique counter when the volume information is updated to disk. When
the nextVnodeUnique is near UINT32_MAX, then the uniquifier counter rolls
over.  This can happen during a volume header update due to
VBumpVolumeUsage_r().

With this change, the nextVnodeUnique customer is reset to 2 and the
uniquifier is reset to 202 when a roll over occurs. (uniquifier of 1 is
reserved for the root vnode.)

With this change, the number of possible uniquifier numbers is limited to
200 less than UINT32_MAX.

The following shows a series of vnode creation/deletions to illustrate
the uniquifier rollover before this commit:

fid = 536870918.4.4294967114, nextVnodeUnique = 4294967115, uniquifier = 4294967295
fid = 536870918.4.4294967115, nextVnodeUnique = 4294967116, uniquifier = 4294967295
fid = 536870918.4.4294967116, nextVnodeUnique = 4294967117, uniquifier = 21
fid = 536870918.4.4294967117, nextVnodeUnique = 4294967118, uniquifier = 22

and after this commit:

fid = 536870918.4.4294967115, nextVnodeUnique = 4294967116, uniquifier = 4294967295
fid = 536870918.4.4294967116, nextVnodeUnique = 2, uniquifier = 202
fid = 536870918.4.2, nextVnodeUnique = 3, uniquifier = 202
fid = 536870918.4.3, nextVnodeUnique = 4, uniquifier = 202

Change-Id: I93c8a7cf47e39b8701265d6507cfc4f8c1352ddc
Reviewed-on: http://gerrit.openafs.org/10617
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agovol: fix nextVnodeUnique roll over
Michael Meffie [Mon, 23 Dec 2013 16:42:19 +0000]
vol: fix nextVnodeUnique roll over

Fixes for the per volume nextVnodeUnique counter roll over. Uniquifier number 1
is reserved for the root vnode, so reset the unique count to 2 when the
nextVnodeUnique counter rolls over.

Update the disk backed V_uniquifier count when the in-memory nextVnodeUnique
counter rolls over during the creation of a new vnode. If the nextVnodeUnique
rolls over when V_uniquifier is UINT32_MAX, then the V_uniquifier is not updated
and remains at UINT32_MAX until the next VUpdateVolume_r() call for the volume.

This bug is usually masked by the VBumpVolumeUsage(), which on every 128 volume
accesses, bumps the V_uniquifier to be 200 more than the current
nextVnodeUnique counter.  This causes the V_uniquifier to roll over before
reaching UINT32_MAX.  (The number of access before updating the headers is set
in the usage_threshold volume package option, which is currently set to 128 by
default.)

The following shows the unique counters for a series of vnode
creation/deletions before this commit.  The nextVnodeUnique rolls over to 1,
and the uniquifier is not reset.  The `usage_threshold' was set to a value
greater than 200 to avoid the VBumpVolumeUsage() calls during this test run.

fid = 536870918.4.4294967294, nextVnodeUnique = 4294967295, uniquifier = 4294967295
fid = 536870918.4.4294967295, nextVnodeUnique = 0, uniquifier = 4294967295
fid = 536870918.4.1, nextVnodeUnique = 2, uniquifier = 4294967295
fid = 536870918.4.2, nextVnodeUnique = 3, uniquifier = 4294967295

The following shows the unique counters after this commit:

fid = 536870918.4.4294967294, nextVnodeUnique = 4294967295, uniquifier = 4294967295
fid = 536870918.4.4294967295, nextVnodeUnique = 0, uniquifier = 4294967295
fid = 536870918.4.2, nextVnodeUnique = 3, uniquifier = 203
fid = 536870918.4.3, nextVnodeUnique = 4, uniquifier = 203

Change-Id: I438670200bf97baeac1486eda7df4cf243aabfc4
Reviewed-on: http://gerrit.openafs.org/10616
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoFix vcache/vnode mismatch in lookup for DARWIN
Benjamin Kaduk [Fri, 10 Jan 2014 21:27:44 +0000]
Fix vcache/vnode mismatch in lookup for DARWIN

We have a vcache and need a vnode, so AFSTOV() is the right macro,
not VTOAFS().

It's kind of unfortunate that --enable-checking doesn't catch this.

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

10 years agoafs: Don't clear afs_CacheTooFull prematurely
Andrew Deason [Thu, 14 Nov 2013 18:53:40 +0000]
afs: Don't clear afs_CacheTooFull prematurely

Currently, we can clear afs_CacheTooFull here, even if
afs_CacheIsTooFull() doesn't agree that the cache is no longer 'too
full'. This could theoretically result in afs_CacheTooFull being
cleared, even though the cache is indeed 'too full', according to
afs_CacheIsTooFull(). Just break here, and let afs_CacheIsTooFull()
decide.

This reverts a small part of 488c7c97854a4bd0ec67bcfe17df93b3fd025f88.
This part doesn't seem important to the functionality in that commit,
though; the rest of that commit is still here, and avoids the extra
work if we have calculated no needed space to free.

Change-Id: If0adce7fa2e88a970ddb202de02c8ff048d2ad15
Reviewed-on: http://gerrit.openafs.org/10460
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoafs: Fix some dcache-related comments
Andrew Deason [Thu, 14 Nov 2013 18:06:56 +0000]
afs: Fix some dcache-related comments

 - The comments preceding the afs_CacheIsTooFull macro, describing the
   cache-related high and low water marks, are a little out of date.
   We start freeing on 90% space, not 95%, and we also can take into
   account how many free/used chunks we have.

 - afs_WakeCacheWaitersIfDrained looks at the number of non-used (free
   or discarded) blocks, not just free blocks.

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

10 years agorx: Clarify error checks for busy channel check
Andrew Deason [Tue, 11 Dec 2012 19:19:02 +0000]
rx: Clarify error checks for busy channel check

Commit a84c6b0ece1fdee4f462c6ce27fa78c2e0d419f4 changed this so we
don't just discard an incoming request if the call already had an
error. But if the call already has an error, rxi_WaitforTQBusy is a
no-op, so checking if the error has "changed" is unnecessary and can
be confusing. Just bypass this whole block if the call already has an
error.

Discussed during the 5 Dec 2012 release-team meeting.

Change-Id: Id57d65736f3228d4e7595f56800f42c52e83ef39
Reviewed-on: http://gerrit.openafs.org/8748
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoviced: Move host quota calculation
Andrew Deason [Tue, 14 Aug 2012 22:25:44 +0000]
viced: Move host quota calculation

Calculate this during initialization, not every time we want to use
it.

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

10 years agoRedHat: Fix specfile changelog
Andrew Deason [Mon, 23 Dec 2013 21:10:45 +0000]
RedHat: Fix specfile changelog

Oct 29 2007 was a Monday, not a Tuesday. rpmbuild does actually yell
at us about this, so fix this so it will shut up.

Change-Id: I5e13f227ed62c4bbb7ac72f2c844136648c935c7
Reviewed-on: http://gerrit.openafs.org/10621
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>

10 years agoFedora: Handle new kernel variant paths
Andrew Deason [Thu, 26 Dec 2013 17:56:37 +0000]
Fedora: Handle new kernel variant paths

With Fedora 20, Fedora now separates the variant from the rest of the
kernel version with a plus (+) instead of a period (.) . This results
in directories called e.g. 3.12.5-302.fc20.i686+PAE, where right now
we look for 3.12.5-302.fc20.i686.PAE.

Use this new directory scheme for Fedora 20 builds, so we can build
against non-default kernel variants on Fedora 20 and beyond.

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

10 years agoRedHat: Munge future kernel versions
Andrew Deason [Mon, 23 Dec 2013 18:32:28 +0000]
RedHat: Munge future kernel versions

We currently look for "fc1?" (that is, fc10 through fc19) when trying
to munge the kernel version in some ways. This broke on Fedora 20,
since 20 obviously does not match "fc1?". Similarly, we look
specifically for "el6" for RHEL6 versioning quirks, but these will
break on RHEL7 and beyond.

Change the version checks so that this will work all the way through
Fedora 99 and RHEL 9. That won't work forever, but it will keep us
working for a few versions if the versioning quirks do not change.

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

10 years agoktc: fix up initializer for local_tokens
Benjamin Kaduk [Thu, 9 Jan 2014 17:13:27 +0000]
ktc: fix up initializer for local_tokens

The old initializer was incomplete (initializing only one of the four
fields in the struct), which prompted warnings from clang
(-Wmissing-field-initializers):
../../../openafs/src/auth/ktc.c:149:2: warning: missing field 'server'
      initializer [-Wmissing-field-initializers]

Since the variable is at file scope, it will be initialized to all
zeros anyway, and there is no need for an explicit initializer.

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

10 years agoWindows: AFSCommonWrite STATUS_PENDING is Success
Jeffrey Altman [Thu, 9 Jan 2014 14:58:56 +0000]
Windows: AFSCommonWrite STATUS_PENDING is Success

AFSCommonWrite() can return STATUS_PENDING if the write has been
deferred.  In that case, the function exit must not:

 * Update the Valid Data Length

 * Purge the cache

 * or do anything else related to the request

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

10 years agoWindows: Mark Irp Pending before Deferring
Jeffrey Altman [Thu, 9 Jan 2014 14:57:33 +0000]
Windows: Mark Irp Pending before Deferring

After CcDeferWrite() is called we no longer have access to the
current Irp.  If we mark it deferred after calling CcDeferWrite()
we might mark the wrong thing.

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

10 years agoWindows: cm_ConnByServer fix search for replication
Jeffrey Altman [Tue, 7 Jan 2014 15:57:01 +0000]
Windows: cm_ConnByServer fix search for replication

Separate connection objects are maintained for use when accessing
replicated and single source volumes.   If the matching connection
type cannot be found while holding the cm_connLock shared a second
search is performed after the lock is upgraded to an exclusive lock.
This second connection search was not enforcing the replication criteria.

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

10 years agoWindows: cm_connLock not required for cm_GetUCell
Jeffrey Altman [Tue, 7 Jan 2014 15:53:37 +0000]
Windows: cm_connLock not required for cm_GetUCell

In cm_ConnByServer() there is no need to hold the cm_connLock across
the cm_GetUCell() call.  Obtain the cm_ucell_t object before the
cm_connLock is obtained.

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

10 years agoWindows: Rewrite LargeSearchTime conversions
Jeffrey Altman [Wed, 27 Nov 2013 19:41:18 +0000]
Windows: Rewrite LargeSearchTime conversions

Use LARGE_INTEGER to avoid the need for shifting and DWORD casts.
Take into account the size of time_t.

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

10 years agoWindows: RDR_EvaluateNodeByName out of order param
Jeffrey Altman [Fri, 27 Dec 2013 03:02:50 +0000]
Windows: RDR_EvaluateNodeByName out of order param

The bHoldFid parameter is after the bNoFollow parameter.  The
two values were swapped resulting in unnecessary VLDB lookups.

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

10 years agoWindows: cm_SetupStoreBIOD compute correct scanEnd
Jeffrey Altman [Wed, 18 Dec 2013 13:48:44 +0000]
Windows: cm_SetupStoreBIOD compute correct scanEnd

The algorithm used to ensure "chunk size" operations attempts to
enforce aligned chunks.  There are two problems:

 1. an aligned chunk range may extend beyond the end of the file.

 2. an aligned chunk might end before the requested length of the
    active write.

Protect against scanning beyond the end of the file and do not truncate
writes.

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

10 years agoWindows: BUF_HASH use opr_jhash_int2
Jeffrey Altman [Wed, 18 Dec 2013 05:07:55 +0000]
Windows: BUF_HASH use opr_jhash_int2

BUF_HASH takes to 4-byte integers not three and therefore cannot use
the basic opr_jhash which assumes a minimum of three 4-byte integers.

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

10 years agocellconfig: Do not use 'long' for dbserver IPs
Andrew Deason [Tue, 10 Dec 2013 23:02:34 +0000]
cellconfig: Do not use 'long' for dbserver IPs

A few places in this file assume that our dbserver IP addresses are
"long"s. A long int can be 8 bytes on some platforms, but we know
these IP addresses are all 4-byte integers. In the rare instances
where we have the maximum number of dbservers, this can overwrite a
bit of extra memory. This can also result in a misaligned access on
platforms such as SPARC v9, since the elements of he->h_addr_list are
not guaranteed to be 8-byte aligned.

So instead, treat these as 4-byte integers. For copying out of
he->h_addr_list, also use a memcpy anyway to be safe, since we are not
guaranteed alignment.

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

10 years agoviced: remove dead code CheckHost()
Mark Vitale [Wed, 11 Dec 2013 22:56:47 +0000]
viced: remove dead code CheckHost()

Remove CheckHost().

Change-Id: I618066d28ef64fdfe94d5ab08ef89adb08a99fd6
Reviewed-on: http://gerrit.openafs.org/10580
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agomake openafs uninstallable even if /afs is missing
Arne Wiebalck [Fri, 13 Dec 2013 10:46:04 +0000]
make openafs uninstallable even if /afs is missing

The preuninstall scriptlet of the openafs RPM removes /afs. If, for
whatever reason, that directory does not exist, the scriptlet will
fail and hence break the deinstallation of the openafs package. The
proposed patch makes the scriptlet evaluate to true even if the /afs
has been removed by some other means and allows the package to be
uninstalled.

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

10 years agodoc: fix a nit in fs_newalias.pod
Stephan Wiesand [Wed, 18 Dec 2013 09:11:48 +0000]
doc: fix a nit in fs_newalias.pod

The CAUTIONS section is about fs newalias, not fs newcell.

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

10 years agoLINUX: Use sock_create_kern where available
Andrew Deason [Tue, 17 Dec 2013 23:30:26 +0000]
LINUX: Use sock_create_kern where available

Currently, we use sock_create to create our Rx socket. This means that
accesses to that socket (sendmsg, recvmsg) are subject to SELinux
restrictions. For all recvmsg accesses and some sendmsg accesses, this
doesn't matter, since the access will be performed by one of our
kernel threads (running as kernel_t or something similar, which is
unrestricted). Such as: the rx listener, a background daemon, the rx
event thread, etc.

However, sometimes we do run in the context of a normal user process.
For some RPCs like FetchStatus, we tend to run the RPC in the
accessing user thread, which can result in us sendmsg()ing the data
packets with the initial arguments in the user thread. We can also
send delayed ACKs via rx_EndCall, and possibly a variety of other
scenarios.

In any of these situations when we are sendmsg()ing from a user
thread, SELinux can prevent us from sending to the socket, if the
calling user thread context is not able to write to an afs_t
udp_socket. This will result in packets not being sent immediately,
but the packets will be resent later, so access will work, but appear
very slow. This can easily happen for processes that are specifically
constrained by SELinux; for example, webservers are often constrained,
even if most of the rest of the system is not. This can be noticed by
seeing the 'resends' and 'sendFailed' counters rising in 'rxdebug
-rxstat', as well as noticing SELinux access failures if 'dontaudit'
rules are ignored.

To avoid this, use sock_create_kern to create the Rx socket, to
indicate that this is a socket for use by kernel code, and not
accessible by a user. This should cause us to bypass any LSM
restrictions (SELinux, AppArmor, etc). Add a configure check for this,
since this function has not always existed, according to
<https://lists.openafs.org/pipermail/openafs-devel/2004-June/010651.html>

Change-Id: I77e7f87e93be4d750d398e01dc1634efd80657bc
Reviewed-on: http://gerrit.openafs.org/10594
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agorx: Remove obsolete comment
Andrew Deason [Tue, 17 Dec 2013 23:27:53 +0000]
rx: Remove obsolete comment

This comment refers to the fact that we used to be just checking for
SELinux to see if we should pass that extra argument. Ever since
commit cb1b41b159b98881f66319d7f65d941ba9fab911, we do have a better
test for this.

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

10 years agoSort the rfc3961 library's export symbol list
Ben Kaduk [Sat, 14 Dec 2013 00:07:13 +0000]
Sort the rfc3961 library's export symbol list

It was originally committed in an unsorted state.

Change-Id: Ife43b60cd625eae5062865942fc5c8956d6b6aab
Reviewed-on: http://gerrit.openafs.org/10583
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoLinux: stop trying to use getname/putname
Jeff Layton [Fri, 6 Dec 2013 18:34:04 +0000]
Linux: stop trying to use getname/putname

The current code has afs_putname defined as

    kmem_cache_free (names_cachep, (void *) name);

This is wrong and will cause a double -free when syscall auditing is
enabled. Fix it to call putname properly.

Instead of that, just create a new afs_getname function that doesn't
bother with struct filename at all, and use that unconditionally.

Signed-off-by:Jeff Layton <jlayton@redhat.com>

Change-Id: I1cd58a7e528abfeb7473cf47ae4cff5b8c8f419c
Reviewed-on: http://gerrit.openafs.org/10547
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeff Layton <jlayton@poochiereds.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoRemove extra whitespace from macro invocations
Ken Hornstein [Thu, 5 Dec 2013 18:57:36 +0000]
Remove extra whitespace from macro invocations

On MacOS X 10.9, the compiler has switched to LLVM and as a consequence
generates an error if there is a space between a macro invocation and
the starting left parenthesis.

Based on code originally done by Matt Haught <dmhaught@ncsu.edu>.

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

10 years agoPackaging support for MacOS X 10.9 "Mavericks".
Ken Hornstein [Thu, 5 Dec 2013 18:53:56 +0000]
Packaging support for MacOS X 10.9 "Mavericks".

Based on work originally done by Matt Haught <dmhaught@ncsu.edu>.

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

10 years agoAdd support for configuration of MacOS 10.9 "Mavericks".
Ken Hornstein [Thu, 5 Dec 2013 18:46:18 +0000]
Add support for configuration of MacOS 10.9 "Mavericks".

Based on work originally done by Matt Haught <dmhaught@ncsu.edu>

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

10 years agoWindows: RXAFS_GetVolumeStatus no PRSFS_READ check
Jeffrey Altman [Thu, 5 Dec 2013 05:41:10 +0000]
Windows: RXAFS_GetVolumeStatus no PRSFS_READ check

Since d2d591caf2c9b4cf2ebae708cc9b4c8b78ca5a5a the file server no
longer performs a PRSFS_READ access check for the GetVolumeStatus RPC.
The cache manager should no longer test for PRSFS_READ as a means of
avoiding RPCs that are known to fail.

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

10 years agolwp: rw now depends on libopr
Chas Williams (CONTRACTOR) [Mon, 25 Nov 2013 12:13:32 +0000]
lwp: rw now depends on libopr

rw (a test program for lwp) needs libopr to build

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

10 years agoLinux: fix whitespace issue
Christof Hanke [Thu, 5 Dec 2013 09:00:42 +0000]
Linux: fix whitespace issue

introduced in Change I1e84969b. It does not
follow the overall style.

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

10 years agoWindows: RDR capture Cc/Mm exceptions do not break
Jeffrey Altman [Wed, 27 Nov 2013 17:26:44 +0000]
Windows: RDR capture Cc/Mm exceptions do not break

All of the Cc and Mm functions are wrapped in try/except blocks.
The purpose is to ensure that Cc and Mm do not return an error as
an exception which could result in the afs redirector failing to
release a resource.   Instead of calling the AFS exception handler
just handle the exception with EXCEPTION_EXECUTE_HANDLER.  This permits
the __except block to capture the exception code.

The AFS exception handler will throw its own exception if the
AFSDebugFlags AFS_DBG_BUGCHECK_EXCEPTION bit is set.  This is helpful when
debugging exceptions thrown by errors in the afs redirector code.  It is
not helpful when a Cc function throws an exception.  For example,
CcReadCopy() will throw STATUS_DELETE_FILE as an exception if an attempt
to read from a deleted file is initiated.   This should simply fail the
read operation not BSOD the system.

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

10 years agoWindows: AFSRDFSProvider NPOpenEnum vs no redirector
Jeffrey Altman [Tue, 26 Nov 2013 01:27:10 +0000]
Windows: AFSRDFSProvider NPOpenEnum vs no redirector

If there is no redirector device present, return WN_NO_NETWORK
to indicate that this network provider is not ready for browsing.

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

10 years agoRemove klogin
Ben Kaduk [Wed, 27 Nov 2013 15:26:33 +0000]
Remove klogin

It has not been connected to the build since at least the 1.2 days
and should be considered dead code.

FIXES 131777

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

10 years agoWindows: Rationalize Freelance vs "fs flush*"
Jeffrey Altman [Tue, 26 Nov 2013 15:52:45 +0000]
Windows: Rationalize Freelance vs "fs flush*"

Background:

cm_scache_t objects representing Freelance volume (cell=-1, volume=-1)
are special because they are populated from the Freelance mountpoint
and symlink tables.  These tables are in turn generated from the
registry.  The tables are regenerated on-demand after the execution of
cm_noteLocalMountPointChange() which increments cm_data.fakeDirVersion
which becomes the new data version value for the (-1.-1.1.1) directory
object.

The next time that cm_GetSCache() is called for a Freelance object
the fake root directory is rebuilt by cm_InitFakeRootDir().  Since the
vnode values are not persistent with regards to directory entry names the
FileId unique is used to distinguish the various versions.
cm_data.fakeUnique is incremented with each call to cm_InitFakeRootDir().

Each time cm_noteLocalMountPointChange() is executed the afs redirector is
notified of the data version change which will force the redirector to
rebuild its view of the directory the next time a path evaluation requires
evaluation of the root (\afs).  In other words, on the next request.

If cm_noteLocalMountPointChange() is executed multiple times there is the
possibility of a race between the redirector and the service.  When the
race is lost the redirector receives an invalidation event for -1.-1.1.1
as it is in the process of rebuilding the directory contents.  The
redirector ends up believing it has the most recent data version when it
doesn't but the service no longer has Freelance mountpoint and symlink
tables representing the requested data version.  Hence, the mountpoints
and symlinks end up as CM_SCACHETYPE_INVALID.

fs flushfile and fs flushvolume both had explicit checks to prevent
flushing Freelance objects because each call to cm_FlushFile() on a
Freelance object would execute cm_noteLocalMountPointChange() triggering
the race.

The Problem:

fs flushall is not executed on a specific object (volume or file).
Therefore there was no explicit check to prevent execution against
Freelance objects.  For each cm_scache_t in the cache cm_FlushFile() is
processed.  If there are N Freelance mountpoints and symlinks, there will
be N+1 calls to cm_noteLocalMountPointChange() in quick succession.  Not
only does this risk losing the race described above but it is extremely
wasteful as the Freelance tables may be repeatedly regenerated.

This Patchset:

This patchset re-organizes the Freelance processing in the flush code
paths.  cm_FlushFile() and cm_FlushVolume() can simply no longer be
successfully executed against a Freelance object.  Both will return
CM_ERROR_NOACCESS.

"fs flush <file>" is not permitted against Freelance objects.

"fs flushvolume <path>" will execute cm_noteLocalMountPointChange() once if
the path is a Freelance object.

"fs flushall" continues to execute cm_FlushFile() on all cm_scache_t
objects.  The calls on Freelance object will fail.  After all cm_scache_t
objects are flushed then cm_noteLocalMountPointChange() will be executed
once to force the Freelance directory to be rebuilt.

This patchset does not address the race but significantly reduces the
likelihood the race will be lost.

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

10 years agoWindows: Reset mp/symlink target during fs flush*
Jeffrey Altman [Tue, 26 Nov 2013 15:31:32 +0000]
Windows: Reset mp/symlink target during fs flush*

When processing a "fs flush*" command, reset the the cm_scache_t
mountPointStringp which contains the known mountpoint or symlink
target information.

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

10 years agoLinux: Fix build for older kernels w/o bool
Stephan Wiesand [Thu, 21 Nov 2013 14:01:29 +0000]
Linux: Fix build for older kernels w/o bool

Commit b7f4f2023b2b3e1aac46715176940fb50cc75265 broke builds against
older kernels which don't have bool defined in linux/types.h . Fix
this by using unsigned char instead of bool for the static inline
functions.

Change-Id: Icbb82446ef66edd2650f33135ed6ccd2b8a920b2
Reviewed-on: http://gerrit.openafs.org/10483
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoSupport for changes to OS X Mavericks VNOP_SYMLINK() function.
Ken Hornstein [Wed, 20 Nov 2013 18:37:52 +0000]
Support for changes to OS X Mavericks VNOP_SYMLINK() function.

Add support for an extra argument to afs_symlink() to return the
newly-created symlink vnode if requested (this is needed on OS X
Mavericks).  On OS X Mavericks return the newly-created symlink vnode in
the symlink vnops functions, on all other platforms ignore it.

It turns out that technically OS X has required the symlink to be
created for a while, but code inside of symlink() would call namei() on
the symlink name if the returned vnode point was NULL.  The difference
is that on Mavericks the Manditory Access Control Framework has been
enabled, and that turns on some extra code which unconditionally calls
vnode_mount() on the returned vnode pointer, which ends up causing a
panic

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

10 years agoWindows: cm_Analyze retries vs CM_REQ_NORETRY
Jeffrey Altman [Mon, 18 Nov 2013 04:03:43 +0000]
Windows: cm_Analyze retries vs CM_REQ_NORETRY

CM_REQ_NORETRY is set by threads that want all errors returned
immediately.  However, there are some errors that should never
be returned:

  RX_MSGSIZE
  RX_CALL_BUSY
  VNOSERVICE
  RX_CALL_IDLE
  RXKADEXPIRED
  VICECONNBAD
  VICETOKENDEAD

For these errors even if the thread has requested no retries a RPC
retry must be performed.

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

10 years agocmd: Correctly initialize cmd_OptionAsString arguments
Chas Williams (CONTRACTOR) [Wed, 20 Nov 2013 18:57:13 +0000]
cmd: Correctly initialize cmd_OptionAsString arguments

These are coming from the stack and as such they might not be NULL.

Change-Id: Ia5c6efd08574b4de05a11dceae47021b0160395b
Reviewed-on: http://gerrit.openafs.org/10475
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

10 years agoLinux: always include <linux/uidgid.h> headerfile
Christof Hanke [Tue, 19 Nov 2013 08:57:22 +0000]
Linux: always include <linux/uidgid.h> headerfile

when it is required. In some linux-kernels (like in SLES11 SP3)
it is not done automatically and the compilation fails.

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