openafs.git
9 years agoBuild tbutc and tvlserver on Darwin
Simon Wilkinson [Mon, 12 Sep 2011 08:42:11 +0000]
Build tbutc and tvlserver on Darwin

At some point, the build lines for tbutc and tvlserver ended up
omitting Darwin platforms. This is incorrect, so re-add Darwin to the
platform list.

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

9 years agocrypto: Fixes for recent Heimdal changes
Chas Williams (CONTRACTOR) [Mon, 12 Sep 2011 19:24:39 +0000]
crypto: Fixes for recent Heimdal changes

ignore KRB5_DEPRECATED_FUNCTIONS for now since it doesnt give any
advice.  Some keytypes (but not all) have been renamed.  So for
now we need to keep both apparently.

Change-Id: I55de284448d255d5107afe03b4df56ccebc90beb
Reviewed-on: http://gerrit.openafs.org/5400
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

9 years agoImport of code from heimdal
Heimdal Developers [Mon, 12 Sep 2011 18:08:57 +0000]
Import of code from heimdal

This commit updates the code imported from heimdal to
b118610a9c56835c4ac5dc49ce8124cae8078346 (switch-from-svn-to-git-2478-gb118610)

Upstream changes are:

Harald Barth (1):
      Move common code to krb5_unsupported_enctype() and make error message contain string instead of error number

Jeffrey Altman (1):
      roken: declare IN_LOOPBACKNET if necessary

Love Hornquist Astrand (5):
      Warning fixes from Christos Zoulas
      Fixes from NetBSD via Thomas Klausner and Roland C. Dowdeswell
      Rename subsystem_DEPRECATED to subsystem_DEPRECATED_FUNCTION(X)
      remove trailing whitespace
      remove warning, remove forward declaration by moving the function up, ident

Love Hörnquist Åstrand (4):
      don't set i = 0, its never read
      sprinkle doxygen and kode more like the rest of the code base
      partly unify enctype/keytype since there is only enctypes
      switch to KRB5_ENCTYPE

Roland C. Dowdeswell (1):
      Fix a couple of bugs in krb5_c_valid_enctype():

chas williams - CONTRACTOR (1):
      hcrypto: var name current conflicts with linux kernel

Change-Id: Id9a7a9ee8258b979b54f4ed2b4175815ab35ea21
Reviewed-on: http://gerrit.openafs.org/5399
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

9 years agoWindows: permit offline volume check to be disabled
Jeffrey Altman [Sun, 4 Sep 2011 18:58:23 +0000]
Windows: permit offline volume check to be disabled

Setting the registry value to 0 can now be used as a
method of disabling the offline volume check.

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

9 years agoviced: Use libcmd for command line options
Simon Wilkinson [Mon, 25 Apr 2011 14:46:33 +0000]
viced: Use libcmd for command line options

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

9 years agoRPM: Fix dkms support on Fedora 15
Todd Lewis [Sun, 11 Sep 2011 11:42:47 +0000]
RPM: Fix dkms support on Fedora 15

Newer dkms no longer uses or supplies a $kernelver_array variable;
instead it uses $kernelver. The attached patch uses both, one of
which will be empty, so the test will do the Right Thing regardless
of your dkms version.

Further, the "mv" command at the end of the MAKE[0]= line needs
lots of back-slashes on each of its parms. We need three to make it
all the way to the final dkms.conf file -- so that's six -- plus one
more to escape the '$'; that's seven in all.

In case there's any question (and with all the back-slashes involved,
there should be) about the intent here, the whole point of this
patch is to make the final dkms.conf MAKE[0]= line look like this
(module line breaks:

MAKE[0]="KMODNAME=openafs.ko; DSTKMOD=\".\"; [ \"\`echo
\"${kernelver_array[0]}${kernelver[0]}\" | sed -e
's/^\([0-9]*\.[0-9]*\)\..*/\1/'\`\" = \"2.4\" ] && KMODNAME=\"libafs-*\"
&& DSTKMOD=openafs.o; ./configure
--with-linux-kernel-headers=${kernel_source_dir}
--with-linux-kernel-packaging; make; mv src/libafs/MODLOAD-*/\\\$KMODNAME
\\\$DSTKMOD"

This is what was required to get "dkms build ..." to work on Fedora 15,
and as near as I can tell it shouldn't break 2.4 or other builds.

FIXES 130211

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

9 years agoUnix CM: Fix afs_event fallout on Mac OS X
Simon Wilkinson [Sun, 11 Sep 2011 11:31:55 +0000]
Unix CM: Fix afs_event fallout on Mac OS X

Commit dc077b83c9b1f107efbc3483743f44117748f23c moved the afs_event
structure definition into afs_osi.h. However, afs_osi.h is included from
lots of places which don't include a complete set of platform headers.
This means that the use of lck_mtx_t in this file breaks the build on
Darwin.

Instead, define the structure in afs.h, along with all of the rest of
the cache manager structures. Also take the opportunity to move the
definition of shutdown_osisleep it afs_prototypes.h, with the rest of
the prototypes.

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

9 years agoDarwin: Actually stop the kernel build
Simon Wilkinson [Sun, 11 Sep 2011 11:35:18 +0000]
Darwin: Actually stop the kernel build

At the moment, all of the kernel build lines end with "; true", which
means that the build will always continue, regardless of whether
creating an individual object file succeeds or not. The 'true' is there
to gobble up the name of the source file which the common build
infrastructure adds to the end of the command line.

Instead of using '; true', use '&& true', so that if one of the C
compiler commands, or the lipo, fails, we get told about it, before
we try to link the missing objects.

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

9 years agoMove string manipulation functions out of util
Simon Wilkinson [Sun, 10 Jul 2011 09:24:26 +0000]
Move string manipulation functions out of util

Some functions in libafsutil depend upon the RX libraries, which means
that pulling in other functions in this library can create a dependency
upon RX. This is less than ideal for low-level libraries such as cmd and
comerr.

So, create a new low-level library (currently named 'opr') which can
contain low-level functions from util, and elsewhere. This library
should have no dependencies other than on system libraries and libroken.

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

9 years agoautoconf: use $XCFLAGS from OPENAFS_OSCONF when making tests
chas williams - CONTRACTOR [Wed, 7 Sep 2011 13:55:47 +0000]
autoconf: use $XCFLAGS from OPENAFS_OSCONF when making tests

Certain platforms (like ppc64_linux26) compiler options might
affect some autoconf tests.  In particular, the ones related to
the size of certain primitive types.

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

9 years agoIRIX: Pull NFS translator hooks
Simon Wilkinson [Wed, 7 Sep 2011 17:20:24 +0000]
IRIX: Pull NFS translator hooks

We've never had working NFS translator for IRIX, and the system call
codes which are required to install the symbols used by the IBM
translator have long been used for other things by OpenAFS.

Simplify this mess by just removing the translator stubs from the kernel
module, and all of the code in afsd which used to handle pulling
addresses out of the kernel module so that we can hook ourselves in.

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

9 years agovolser: Don't initialise all error tables
Simon Wilkinson [Sun, 10 Jul 2011 12:57:36 +0000]
volser: Don't initialise all error tables

Initialising the KA and cmd error tables in vsprocs.c makes the
libvolser library dependent upon rxkad and cmd. As we may want to
use that library in programs which use neither rxkad, nor our command
processor, this is less than ideal. So, just drop the initialisations.

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

9 years agoafsd: Fix res_init warning
Simon Wilkinson [Tue, 6 Sep 2011 13:18:12 +0000]
afsd: Fix res_init warning

afsd requires res_init to be declared - get a definition for this by
including roken.h (which has the necessary magic to figure out which
set of headers are required to get resolver functions)

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

9 years agopam: Fix test_pam on Darwin
Simon Wilkinson [Tue, 6 Sep 2011 13:14:56 +0000]
pam: Fix test_pam on Darwin

Darwin doesn't have a getpassphrase function. Fix the PAM test to
use getpass, in the same way as we do for lots of other platforms.

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

9 years agopam: Don't duplicate .c.o rule
Simon Wilkinson [Tue, 6 Sep 2011 13:03:41 +0000]
pam: Don't duplicate .c.o rule

Our included configuration has a perfectly fine .c.o rule, so don't
override it in this Makefile, as all that does is produce a warning at
build time

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

9 years agoImport new pam-const.m4 from rra-c-util 3.8
Russ Allbery [Thu, 8 Sep 2011 02:25:23 +0000]
Import new pam-const.m4 from rra-c-util 3.8

Fixes detection of whether the PAM library uses const on FreeBSD and
possibly others.  Report and testing from Julien ÉLIE.

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

9 years agoWindows: add clean rule to src/afs/NTMakefile
Jeffrey Altman [Tue, 6 Sep 2011 15:57:18 +0000]
Windows: add clean rule to src/afs/NTMakefile

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

9 years agoWindows: correct comments in cm_BkgStore
Jeffrey Altman [Wed, 7 Sep 2011 17:33:36 +0000]
Windows: correct comments in cm_BkgStore

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

9 years agoppc64_linux26: build binaries as 64-bit by default
chas williams - CONTRACTOR [Mon, 5 Sep 2011 13:26:32 +0000]
ppc64_linux26: build binaries as 64-bit by default

lwp doesnt work since ucontext/setjmp are incomplete when running 32-bit
binaries with the 64-bit kernel.

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

9 years agoFree memory from afs_events
Ben Kaduk [Tue, 26 Jul 2011 03:39:27 +0000]
Free memory from afs_events

DARWIN and LINUX were already doing this, but everybody else had
a memory leak.  Consolidate most of the common code to do so,
including afs_event_t definitions.

Change-Id: I5ec83cf23fd15dbbd5716995c671998e35862843
Reviewed-on: http://gerrit.openafs.org/5314
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

9 years agorx/rxkad: Move rxkad initialisation into rxkad
Simon Wilkinson [Tue, 5 Jul 2011 08:20:15 +0000]
rx/rxkad: Move rxkad initialisation into rxkad

When the RX pthread conversion was done, the initialisation of rxkad
mutexes was incorporated into the rx library itself. This is a layering
violation (it breaks the relatively clean security object abstraction),
and means that you can't actually use RX without the rxkad library.

So, remove all of this initialisation from RX. As security libraries
don't have an explicit initialisation function, we setup our various
mutexes using a pthread_once function called from the NewSecurityObject
functions.

This has the added bonus that it removes the final error in rx.c for
pthread builds, and so another bit of warning suppression can be
removed.

Change-Id: I3cf9b2404a03fb58534c5f41afd77aa5ba5e2256
Reviewed-on: http://gerrit.openafs.org/5361
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

9 years agovolser: Don't declare cstruct twice
Simon Wilkinson [Tue, 5 Jul 2011 08:27:05 +0000]
volser: Don't declare cstruct twice

Both vsprocs.c and vsutils.c declare the global variable 'cstruct'
(which is initialised by vos.c in order to pass a ubik client structure
through to many of the libvolser functions). This double declaration
prevents libvolser from being linked as a shared library on some
platforms. We only need one of these, so just make vsprocs.c declare it,
and vsutils.c refer to it as an extern.

Of course, using a global variable to pass state around is really quite
nasty, but let's fix that in another change.

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

9 years agoWindows: Replace "%T" as format string to strftime
Rod Widdowson [Tue, 6 Sep 2011 14:23:33 +0000]
Windows: Replace "%T" as format string to strftime

Checkin I18ed36cc4dce9aa354ad1398710ab7db83c814a2 made strftime
much more widespread.  However the %T format is not available on
all platforms and causes (at least) Windows servers to fail on
first attempt to log.  %T is just shorthand to %H:%M:%S so this
checkin just replaces the one with the other.

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

9 years agoWindows: Freelance vnode,unique pairs
Jeffrey Altman [Sun, 4 Sep 2011 02:35:43 +0000]
Windows: Freelance vnode,unique pairs

The redirector maintains file object state after the afs
service has shutdown in case it is restarted.  It is critical that
Freelance FIDs not be reused.  Add cm_data.fakeDirVersion into
the mix when generating unique values.

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

9 years agowindows: fix comments, add logging
Jeffrey Altman [Sun, 4 Sep 2011 01:33:00 +0000]
windows: fix comments, add logging

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

9 years agoWindows: remove CM_BUF_CMBKGFETCH flag
Jeffrey Altman [Mon, 14 Dec 2009 18:33:02 +0000]
Windows: remove CM_BUF_CMBKGFETCH flag

The processing of the CM_BUF_CMBKGFETCH flag adds more
overhead than it prevents.  Get rid of it.

LICENSE MIT

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

9 years agoWindows: use lock conversion in cm_EndDirOp
Jeffrey Altman [Mon, 5 Sep 2011 14:11:09 +0000]
Windows: use lock conversion in cm_EndDirOp

Instead of dropping the lock for read and reacquiring for write
use lock_ConvertRToW() which will make the change atomicly if
it is possible or place the thread into the wait list if not.

LICENSE MIT

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

9 years agoaklog: strlen(NULL) doesn't work
Derrick Brashear [Fri, 2 Sep 2011 17:35:24 +0000]
aklog: strlen(NULL) doesn't work

strlen(filepath) when !filepath isnt going to work very well. i believe
this to be the intent of the author of the original patch.

Change-Id: Ib78c5a189b6980223946aff9cf027419127c35bd
Reviewed-on: http://gerrit.openafs.org/5328
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

9 years agoLinux: d_delete now takes a const argument
Marc Dionne [Sat, 3 Sep 2011 18:10:50 +0000]
Linux: d_delete now takes a const argument

The d_delete dentry operation now takes a const argument.  Test for
this and define our function accordingly to avoid warnings.

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

9 years agoWindows: tailor smb_MapNTError output for redirector
Jeffrey Altman [Sun, 4 Sep 2011 00:09:20 +0000]
Windows: tailor smb_MapNTError output for redirector

Separate mappings apply for the afs redirector.  Add a boolean
parameter to the function signature that is set true when the
call requires the redirector mapping.

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

9 years agoWindows: cm_SymLink export created cm_scache_t
Jeffrey Altman [Fri, 2 Sep 2011 17:54:01 +0000]
Windows: cm_SymLink export created cm_scache_t

Permit the caller to request the cm_scache_t that represents
the created symlink or mount point object.

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

9 years agoWindows: correct cm_buf use of Head/Tail queues
Jeffrey Altman [Sun, 4 Sep 2011 01:07:13 +0000]
Windows: correct cm_buf use of Head/Tail queues

The buffer free list least recently used queue has both
head and tail points.  Use the proper versions of the queue
mgmt functions and do not handle edge cases as special cases.

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

9 years agoWindows: remove dead code from cm_scache.c
Jeffrey Altman [Sun, 4 Sep 2011 00:22:19 +0000]
Windows: remove dead code from cm_scache.c

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

9 years agoWindows: add cm_Gen8Dot3VolNameW()
Jeffrey Altman [Sun, 4 Sep 2011 00:16:09 +0000]
Windows: add cm_Gen8Dot3VolNameW()

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

9 years agoWindows: add logging to smb_IoctlRead
Jeffrey Altman [Sun, 4 Sep 2011 00:06:21 +0000]
Windows: add logging to smb_IoctlRead

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

9 years agoWindows: remove potential data loss warning with cast
Jeffrey Altman [Sun, 4 Sep 2011 00:03:28 +0000]
Windows: remove potential data loss warning with cast

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

9 years agowindows: pass cm_req_t through background ops
Jeffrey Altman [Sat, 3 Sep 2011 23:14:11 +0000]
windows: pass cm_req_t through background ops

add cm_req_t object to background daemon operations in order to
permit request source to be propagated to the background daemon.

pass a cm_req_t into buf_SetDirty().

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

9 years agoGenerate stub header files for h/*.h files included in libuafs
Russ Allbery [Tue, 23 Aug 2011 19:50:55 +0000]
Generate stub header files for h/*.h files included in libuafs

Previously, the libuafs build created a symlink from h to
/usr/include/sys so that files included under h/* by kernel source
files could be found in the normal system header location.  However,
this assumption about the system header location is no longer valid.
Debian and Ubuntu systems with multiarch have arch-specific include
paths so that the same host can be used to build 32-bit and 64-bit
binaries with different system headers, and those include paths are
automatically searched by the compiler.  This means some standard
headers are no longer found directly in /usr/include/sys but are
instead found in /usr/include/<arch>/sys.

Using a stripped-down version of similar code for building the kernel
module on Linux, create an h directory containing stub header files
that just include the relevant system <sys/*.h> header file instead.
This allows the compiler to implement its normal internal header
search algorithm.

Also remove all the other symlinks, such as sys, netinet, etc., that
just pointed to the same directories under /usr/include.  We can assume
the normal compiler search algorithm will find these headers without
requiring this assistance.

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

9 years agoihandle: OPEN fdPs are not counted in ihP refcount
Andrew Deason [Mon, 29 Aug 2011 18:07:01 +0000]
ihandle: OPEN fdPs are not counted in ihP refcount

Just add a comment explaining that an OPEN FdHandle_t does not count
against the ref count for its parent IHandle_t. Recently I've seen
some confusion about this when discussing ihandle internals, and this
should make this abundantly clear.

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

9 years agolibafs: Fix directory verification
Simon Wilkinson [Mon, 29 Aug 2011 22:36:41 +0000]
libafs: Fix directory verification

With the earlier directory verification changes, every directory
was seen as corrupt, because the nde pointer was never being initialised

Rework the way that we check for the failure of afs_dir_GetVerifiedBlob
so that we can more robustly detect problems, whilst still allowing
normal directories to be browsed as before

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

9 years agoLinux: make sure backing_dev_info is zeroed
Marc Dionne [Sat, 3 Sep 2011 16:32:33 +0000]
Linux: make sure backing_dev_info is zeroed

The afs backing_dev_info structure is allocated dynamically with
kmalloc, which doesn't zero out the contents.  In particular
there's no guarantee that congested_fn is NULL, causing spurious
oopses when bdi_congested tries to call it.

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

9 years agoLinux: 3.1: adapt to fsync changes
Marc Dionne [Fri, 2 Sep 2011 21:56:58 +0000]
Linux: 3.1: adapt to fsync changes

The fsync file operation gets new arguments to specify a range.
Add a configure test to check for the API change.

The inode lock is also pushed down into the operation, so we need
to take it ourselves to keep the original behaviour.

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

9 years agoWindows: correct log message in buf_Sync()
Jeffrey Altman [Sat, 3 Sep 2011 23:03:05 +0000]
Windows: correct log message in buf_Sync()

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

9 years agoWindows: restructure cm_ResetACLCache locking
Jeffrey Altman [Sat, 3 Sep 2011 22:57:09 +0000]
Windows: restructure cm_ResetACLCache locking

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

9 years agoWindows: add cm_BPlusDirEnumBulkStatOne
Jeffrey Altman [Mon, 28 Feb 2011 01:27:33 +0000]
Windows: add cm_BPlusDirEnumBulkStatOne

cm_BPlusDirEnumBulkStatOne() is similar to cm_BPlusDirEnumBulkStat()
except that it is used to obtain the status info for one FID in
particular via RXAFS_InlineBulkStat, the parent directory FID, and
up to 48 other FIDs in the same directory which do not currently
have a registered callback.

The parent directory is included to prevent the directory FID
callback from expiring when a directory such as /afs/andrew.cmu.edu/usr/
that requires more status objects then exist in the cache are continuously
recycled.

Up to 48 other FIDs are requested since in most cases on Windows
every entry in a directory is required for an enumeration.

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

9 years agoWindows: remove warnings afskfw.c
Jeffrey Altman [Fri, 28 Jan 2011 04:09:00 +0000]
Windows: remove warnings afskfw.c

Sometimes warnings are errors and sometimes they are just warnings.
In this case, the krb5 error message functions were being passed
a krb5_context with the wrong level of indirection which resulted
in an actual error.  Other warnings were due to improper typing
and unnecessary casts.  Fix them all.

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

9 years agoWindows: non-persistent cache from pagefile->heap
Jeffrey Altman [Sat, 3 Sep 2011 22:41:43 +0000]
Windows: non-persistent cache from pagefile->heap

Change the non-persistent cache mode to use a heap allocated
cache in place of a paging file allocated cache.  With a heap
cache the memory for the cache can be locked into physical memory
so it won't be swapped out when running in virtual machines.
This patch does not apply such memory locking.

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

9 years agoWindows: Only mask Delete permission for SMB reqs
Jeffrey Altman [Mon, 18 Jul 2011 20:16:42 +0000]
Windows: Only mask Delete permission for SMB reqs

For SMB requests the Delete permission is masked if the
readonly attribute is set on the file.  Do not apply this
heuristic to non-SMB requests.

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

9 years agoWindows: buf_SetDirty do nothing if length is zero
Jeffrey Altman [Thu, 1 Sep 2011 13:51:06 +0000]
Windows: buf_SetDirty do nothing if length is zero

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

9 years agoWindows: conditionalize cm_Analyze timeLeft on SMB or RDR
Jeffrey Altman [Sat, 3 Sep 2011 22:25:10 +0000]
Windows: conditionalize cm_Analyze timeLeft on SMB or RDR

Restrict timeLeft in cm_Analyze() to SMB constraints only
when SMB mode is in use.

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

9 years agoWindows: additional CM_REQ flags
Jeffrey Altman [Sat, 3 Sep 2011 22:22:53 +0000]
Windows: additional CM_REQ flags

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

9 years agoWindows: add connection defaults for RDR mode
Jeffrey Altman [Sat, 3 Sep 2011 22:19:58 +0000]
Windows: add connection defaults for RDR mode

  CM_CONN_IFS_HARDDEADTIME       120
  CM_CONN_IFS_CONNDEADTIME        50
  CM_CONN_IFS_IDLEDEADTIME        50

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

9 years agoWindows: log SMB or RDR in use at startup
Jeffrey Altman [Sat, 3 Sep 2011 22:17:21 +0000]
Windows: log SMB or RDR in use at startup

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

9 years agoWindows: Make use of SMB interface a runtime decision
Jeffrey Altman [Sat, 3 Sep 2011 22:13:31 +0000]
Windows: Make use of SMB interface a runtime decision

Add 'smb_Enabled' and 'RDR_Initialized' flag variables.
Default smb_Enabled to true and RDR_Initialized to false.

Add registry value "SMBInterfaceEnabled" to permit disabling
the SMB interface.

If the redirector interface is initialized (a future set of
patchsets will add it) disable the SMB interface at runtime.

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

9 years agoWindows: pioctl path retrying with \\afs\all
Jeffrey Altman [Fri, 6 Aug 2010 22:24:47 +0000]
Windows: pioctl path retrying with \\afs\all

When the redirector is in use, \\AFS is identified as being an AFS path.
With the SMB redirector, \\AFS was not considered a valid path.  In order
to simulate the notion of \\AFS being the root volume, failover logic
was added to the symlink and fs modules being triggered that
would retry a request for \\afs\foo as \\afs\all\foo.

The VIOC_SYMLINK and VIOC_AFS_CREATE_MT_PT pioctls are broken.  The
'path' parameter that is passed in contains the directory entry that
is to be created.  Since the AFS redirector maps \\afs to the root.afs
volume the "foo" in \\afs\foo must exist in order for the
_._AFS_IOCTL_._ special file to be opened.

This patch implements an alternative to the failover.  If the opcode
is one of the two listed above and the input path is a UNC path,
then the path is re-written as \\AFS\all.  This is necessary because
the repeated attempts to open a UNC path through the SMB redirector
with different usernames can result in the smb session becoming
disconnected.  If this is done when the SYSTEM account is in use,
the tokens associated with the connection can be lost.

LICENSE MIT

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

9 years agoWindows: remove MULTIHOMED ifdef
Jeffrey Altman [Sat, 3 Sep 2011 03:51:59 +0000]
Windows: remove MULTIHOMED ifdef

All builds include the MULTIHOMED functionality.
Get rid of the #ifdef MULTIHOMED.

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

9 years agoWindows: missing ! in update volume location
Jeffrey Altman [Fri, 2 Sep 2011 22:36:13 +0000]
Windows: missing ! in update volume location

The check to see if the volume name is numeric or not was
missing a ! in order to perform the correct test.  Add it.

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

9 years agoWindows: improve handling of volume rename
Jeffrey Altman [Fri, 2 Sep 2011 22:32:40 +0000]
Windows: improve handling of volume rename

The windows cache manager tracks volumes by volume group.
Up to this point all volume location updates have been performed
by the volume name.  What if the volume name was altered?  In this
case the volume location information for the in use volume ids will
fail until a mount point to the new name is queried.  Before
marking the volume group as non-existent attempt to perform a
lookup using either the volume id for the readwrite or readonly
volume.

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

9 years agoWindows: refactor volume location updates
Jeffrey Altman [Fri, 2 Sep 2011 22:28:31 +0000]
Windows: refactor volume location updates

Break out the VL_GetEntryByName RPC calls into support
functions so we can reduce the amount of duplicated code.

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

9 years agomacos: update 32 bit kernel build flags
Derrick Brashear [Thu, 11 Aug 2011 14:39:11 +0000]
macos: update 32 bit kernel build flags

this is what the current xcode uses. do the same.

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

9 years agoxserver lock order violation
Derrick Brashear [Tue, 23 Aug 2011 04:20:37 +0000]
xserver lock order violation

individual volume locks are pretty far down, well after afs_xserver.

afs_SetupVolume (with tv->lock)-> InstallUVolumeEntry-> afs_GetServer.

Install*Volume is careful to protect against recursing into the volume
lock via ResetVolumeInfo. Unfortunately, GetServer acquires xserver,
and then if it needs to call GetCapabilities, it drops and reacquires
xserver.

turns out the volume locks weren't protecting much. they also aren't
grabbed before xvolume is dropped. fine, so, restructure to do all the
work, then merge the result.

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

9 years agoxvcb lock order violation
Derrick Brashear [Mon, 22 Aug 2011 18:56:03 +0000]
xvcb lock order violation

afs_FlushVCBs(1) = xvcb, xserver (in that order)

afs_GetServer = xserver, xsrvAddr, (call afs_RemoveSrvAddr which calls
afs_FlushServer, which gets xvcb)

"nope". do a little dance to get xvcb, searching for a struct server to reuse
again if we had to block.

if you're curious:
Lock afs_xserver status: (reader_waitingwriter_waiting, write_locked(pid:1589 at:36), 3 waiters)
Lock afs_xvcb status: (none_waiting, write_locked(pid:0 at:273))
Lock afs_xsrvAddr status: (none_waiting, write_locked(pid:1589 at:116))

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

9 years agoredhat: mockbuild updates for repoquery
Derrick Brashear [Tue, 30 Aug 2011 05:18:37 +0000]
redhat: mockbuild updates for repoquery

for starters, mock should be careful not to use parent yum cache
when running repoquery, the host runs it, we want the guests's
yum cache. be careful to not attempt to use the parent's yum cache
(in the default config).

additionally, we need to not try to build 64 bit kernel modules in
32 bit chroots. expand the list of rpms while ejecting any which are
64 bit if we're 32.

additionally, blacklist kernels which are the wrong osver.

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

9 years agoWindows: correct CheckOfflineVolumeState logic
Jeffrey Altman [Tue, 30 Aug 2011 13:49:11 +0000]
Windows: correct CheckOfflineVolumeState logic

Do not blindly set the return 'online' state to TRUE if
the state has not in fact changed.

Do not blindly clear the 'alldown' flag without checking the
actual 'down' state of the file server.

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

9 years agoxstat: cm xstat time values are 32 bit
Michael Meffie [Fri, 12 Aug 2011 18:29:48 +0000]
xstat: cm xstat time values are 32 bit

The kernel space cm xstat time structures are implemented as 32
bit values in memory and on the wire.  Define the client side
xstat userspace structures as 32 bit time values as well to avoid
size mismatches on systems with native 64 bit time values.

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

9 years agoaklog: work around lion kerberos disaster
Derrick Brashear [Thu, 25 Aug 2011 00:40:38 +0000]
aklog: work around lion kerberos disaster

fine, so, instead of needing weak crypto enabled, use krb5 config
paths trick and ship a config to deal.

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

9 years agoWindows: afslogon network provider debug registry value
Jeffrey Altman [Sun, 28 Aug 2011 16:03:53 +0000]
Windows: afslogon network provider debug registry value

create a new TransarcAFSDaemon\NetworkProvider "Debug" value
to be used for activating the network provider debugging.
The overlapping use of TransarcAFSDaemon\Parameters "TraceOption"
is just too confusing.

Permit both methods to be used.

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

9 years agoWindows: afslogon NPLogonNotify exit on KTC_NOCM
Jeffrey Altman [Sun, 28 Aug 2011 16:02:14 +0000]
Windows: afslogon NPLogonNotify exit on KTC_NOCM

If the service has started but is not responding to pioctls,
permit the NPLogonNotify() routine to exit.

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

9 years agoWindows: afslogon.dll is not a file system interface
Jeffrey Altman [Fri, 26 Aug 2011 17:57:15 +0000]
Windows: afslogon.dll is not a file system interface

Do not return a file system network type that corresponds
to a real file system inter since afslogon is in fact not
associated with a file system interface.  We can't return
WNNC_NET_NONE (0) because that prevents NPLogonNotify()
from being executed.  However, if we return an in use
file system value that can confuse the system when the
actual file system's network provider is also installed.

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

9 years agoWindows: torture error reporting
Jeffrey Altman [Fri, 26 Aug 2011 13:36:04 +0000]
Windows: torture error reporting

When LeaveThread() is called and GetLastError() has already
been called, pass the last error value to LeaveThread().  Otherwise,
the GetLastError() call in LeaveThread() may return an inaccurrate
result.

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

9 years agolibafs: crash in a more useful way if nchunks is zero
Garrett Wollman [Tue, 9 Aug 2011 03:59:17 +0000]
libafs: crash in a more useful way if nchunks is zero

In afs_CacheStoreDCaches(), if the parameter nchunks is zero, the
main loop will not execute, leaving the XSTATS pointer unchanged,
which will result in a null dereference in XSTATS_END_TIME.  Instead
assert that nchunks is nonzero, which will help the static analyzer
and will also generate a more useful panic message should this
error ever be encountered in operation.

There is presently only one call site, and it may be the case that this
condition can never be triggered.

(While in the neighborhood, also avoid dereferencing tdc immediately
before testing whether it is null.)

Change-Id: Idf68f1306d3e09771425c62df139c1de11806c22
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5179
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agolibafs: FillStoreStats doesn't need to be global; avoid pass-by-pointer
Garrett Wollman [Thu, 11 Aug 2011 01:52:44 +0000]
libafs: FillStoreStats doesn't need to be global; avoid pass-by-pointer

FillStoreStats is only used in afs_fetchstore.c, so make it static.
Parameter xferStartTime is an osi_timeval, which should be small
enough to pass by value, so do so.

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

9 years agodoc: missing $DBTOEPUB variable in the Makefile
chas williams - CONTRACTOR [Sat, 13 Aug 2011 14:29:31 +0000]
doc: missing $DBTOEPUB variable in the Makefile

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

9 years agoihandle: Fix IH_REALLYCLOSE for positional I/O
Andrew Deason [Wed, 24 Aug 2011 17:48:19 +0000]
ihandle: Fix IH_REALLYCLOSE for positional I/O

Currently, ih_fdclose (which is called by IH_REALLYCLOSE), goes
through every FD_HANDLE_OPEN FdHandle_t and closes it. If it finds
handles that are FD_HANDLE_INUSE, it skips those and sets a flag on
the parent IHandle_t. For non-positional I/O, any future opens cannot
use these _INUSE handles, since _INUSE handles cannot be reused, and
the handle will be actually closed when it is FDH_CLOSE'd.

For positional I/O, the situation is different. Multiple threads can
use the same _INUSE FdHandle_t, and so there is nothing currently
stopping a thread from IH_OPEN'ing an ihandle that has been
IH_REALLYCLOSE'd, and getting back an FdHandle_t that existed before
the IH_REALLYCLOSE was issued. This is important, since IH_REALLYCLOSE
is used on files that are deleted, and future IH_OPENs for the same
inode must not use the cached file descriptor. Getting this wrong can
cause data loss, since it can cause us to read from or write to a file
descriptor referring to a deleted file, when we instead should open a
new copy of that file.

To fix this, we create a new FdHandle_t state called
FD_HANDLE_CLOSING, which is set in IH_REALLYCLOSE if we encounter an
FD_HANDLE_INUSE FdHandle_t. In IH_OPEN, we always skip
FD_HANDLE_CLOSING handles, so we can never get back a cached file
descriptor from before an IH_REALLYCLOSE call.

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

9 years agoihandle: Actually assert active fdPs are not AVAIL
Andrew Deason [Wed, 24 Aug 2011 17:30:00 +0000]
ihandle: Actually assert active fdPs are not AVAIL

FdHandle_t's that are on the linked list for an associated IHandle_t
should not be in the state FD_HANDLE_AVAIL. For the non-PIO case, we
assert that this is the case in ih_open (since we assert that if the
FdHandle_t is not in INUSE state, then it must be in OPEN state).
However, for the PIO case, we were just skipping over any FdHandle_t's
that were in the AVAIL state. These should never exist while on that
linked list, so assert for the PIO case, as well.

In the absence of bugs, there is no functional change here, but it
perhaps makes the ih_open loop easier to understand.

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

9 years agoLINUX vcache lock ordering in afs_linux_readdir
Matt Benjamin [Wed, 24 Aug 2011 20:23:37 +0000]
LINUX  vcache lock ordering in afs_linux_readdir

Normalize shared and exclusive lock operations.  Take the lock
exclusive immediately, since the code assumes a write lock if
the vcache state is in flux or the entry is being fetched, releasing
-write- rather than shared, since we do not hold a shared lock.

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

9 years agoroken: no strcasecmp
Derrick Brashear [Thu, 25 Aug 2011 02:53:38 +0000]
roken: no strcasecmp

we don't provide it, don't map it.

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

9 years agoWindows: change buf_Find*() signature to accept cm_fid_t
Jeffrey Altman [Tue, 23 Aug 2011 20:02:28 +0000]
Windows: change buf_Find*() signature to accept cm_fid_t

The buf_Find*() functions require a cm_fid_t to match with the
cm_buf_t objects not a cm_scache_t.  Change the signature so
that the cm_scache_t is not required.  It should be possible to
search for a buffer even if the cm_scache_t is not present in
the cache.

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

9 years agoWindows: do not drop lock unnecessarily
Jeffrey Altman [Sun, 21 Aug 2011 04:37:34 +0000]
Windows: do not drop lock unnecessarily

do not drop cm_serverLock for a cm_PutServer call since
it will only reacquire it.  use cm_PutServerNoLock() instead.

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

9 years agoWindows: cm_serverLock read required not write
Jeffrey Altman [Sun, 21 Aug 2011 04:36:44 +0000]
Windows: cm_serverLock read required not write

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

9 years agoWindows: Be more efficient when processing locks
Jeffrey Altman [Fri, 19 Aug 2011 01:58:50 +0000]
Windows: Be more efficient when processing locks

Do not drop the cm_scacheLock only to reacquire it a few lines
later.

Do not manually set the tail of the queue when osi_RemoveHT
does it for us.

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

9 years agoWindows: be explicit when mapping sharing violation
Jeffrey Altman [Fri, 19 Aug 2011 01:57:12 +0000]
Windows: be explicit when mapping sharing violation

Only one lock acquistion failure should be mapping to
CM_ERROR_SHARING_VIOLATION.  That is CM_ERROR_LOCK_NOT_GRANTED.
Make it clear that is what we are doing.

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

9 years agoWindows: Track file server lock count
Jeffrey Altman [Fri, 19 Aug 2011 01:53:45 +0000]
Windows: Track file server lock count

The fsLockCount field is the lock count reported by the
file server as part of the status info.  Lock acquisition
and releasing does not obtain new status info but we can
estimate what the lock count is by tracking it ourselves
for each of our successful RXAFS_SetLock and RXAFS_ReleaseLock
RPCs and failed RXAFS_ExtendLock RPCs.

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

9 years agoWindows: remove signed/unsigned mismatch cm_aclent.c
Jeffrey Altman [Tue, 23 Aug 2011 01:12:25 +0000]
Windows: remove signed/unsigned mismatch cm_aclent.c

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

9 years agoWindows: avoid duplicate volume update queries
Jeffrey Altman [Tue, 9 Aug 2011 18:26:33 +0000]
Windows: avoid duplicate volume update queries

If multiple volume update queries have stacked up in
cm_UpdateVolumeLocation() and the active query failed,
do not re-issued the blocked queries.  Instead, prevent new
queries for 60 seconds and fail those that blocked during
the active query.

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

9 years agodir: verified pathnames fallout
Marc Dionne [Sun, 21 Aug 2011 16:02:29 +0000]
dir: verified pathnames fallout

Fix some issues introduced with the verified directory path names
commit in master:
- In GetVerifiedBlob, the output parameter is set to NULL on entry
and dereferenced later on.
- For Linux, the code in afs_linux_readdir was changed to pass a
DirEntry to GetVerifiedBlob.  This is incorrect, the function still
expects a DirBuffer pointer.
- In afs_dir_IsEmpty, the assignment of ep was removed, leaving
the function to dereference this pointer which was never set.

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

9 years agopod: use /OPTIONS when referring to the local OPTIONS section
chas williams - CONTRACTOR [Sat, 13 Aug 2011 15:01:28 +0000]
pod: use /OPTIONS when referring to the local OPTIONS section

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

9 years agodoc: generate admin ref from the pod documentation
chas williams - CONTRACTOR [Sat, 13 Aug 2011 14:18:45 +0000]
doc: generate admin ref from the pod documentation

a bit convoluted but this generates docbook from the pod documentation and
from that pdf, epub and mobi versions.  we are using variablelist.as.block
since that looks prettier on smaller devices/screen.

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

9 years agoDon't fail to build documentation if kindlegen doesn't exist
Russ Allbery [Sun, 24 Jul 2011 23:20:05 +0000]
Don't fail to build documentation if kindlegen doesn't exist

Check for kindlegen in configure and do nothing in the MOBI build
rule if the binary didn't exist.

This is still a bit of a hack since the rule will run with every
invocation of make.  The target needs to be made conditional.  But
at least this way make all in the documentation directory doesn't
fail.

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

9 years agoWindows: avoid cm_serverLock refcount leak
Jeffrey Altman [Mon, 22 Aug 2011 13:00:47 +0000]
Windows: avoid cm_serverLock refcount leak

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

9 years agolibafs: don't crash if afs_write() is called with zero-length uio
Garrett Wollman [Sat, 13 Aug 2011 22:34:47 +0000]
libafs: don't crash if afs_write() is called with zero-length uio

If AFS_UIO_RESID(auio) is zero in afs_write(), we could end up
calling afsio_free(NULL).  Guard the free.  (In the alternative,
perhaps we should just osi_Assert(totalLength > 0) instead?)

Change-Id: Ic218f039e2034b679cb4817a543af2e8307f36f8
Found-by: clang static analyzer with the help of AFS_NONNULL
Reviewed-on: http://gerrit.openafs.org/5259
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

9 years agoWindows: torture test updates
Jeffrey Altman [Tue, 16 Aug 2011 14:49:46 +0000]
Windows: torture test updates

roken'ize

remove dead code

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

9 years agoAdd NEWS entries for the 1.6.0 final release
Russ Allbery [Tue, 16 Aug 2011 03:20:31 +0000]
Add NEWS entries for the 1.6.0 final release

The date will be slightly off from when it will be officially announced,
but it should be close enough.

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

9 years agoPrefer dblatex to docbook2pdf
Russ Allbery [Sun, 24 Jul 2011 23:22:35 +0000]
Prefer dblatex to docbook2pdf

docbook2pdf, at least in version 0.6.14-1.1 in Debian, dies while
attempting to build the Admin Guide with an error about TeX capacity
exceeded.  dblatex seems to work reliably.  If both are installed,
prefer dblatex to docbook2pdf.

Change-Id: I7cf594c677cde84410bfefacf07cbbf398026ff3
Reviewed-on: http://gerrit.openafs.org/5091
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Russ Allbery <rra@stanford.edu>

9 years agomacos: fix race in afs_root
Derrick Brashear [Mon, 15 Aug 2011 16:17:06 +0000]
macos: fix race in afs_root

same race on PutVCache in afs_root as we had on other platforms,
for instance FreeBSD. use a local variable instead to avoid the race.
additionally, make sure we end up with the root flagged VROOT.

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

9 years agorpm: Update CellServDB
Simon Wilkinson [Mon, 15 Aug 2011 09:25:27 +0000]
rpm: Update CellServDB

The commit (a5d66d05fa0308d505de8bde59442e29be9d04f8) which updated
our in-tree copies of the CellServDB for the 14th August release
failed to update the copy that's referenced from the rpm spec file.
Update the filename used here so that rpms also get to have an
up to date CellServDB

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

9 years agoWindows: add assertions to cm_scache.c
Jeffrey Altman [Mon, 15 Aug 2011 04:37:31 +0000]
Windows: add assertions to cm_scache.c

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

9 years agoWindows: cm_ShutdownSCache corrections
Jeffrey Altman [Mon, 15 Aug 2011 04:34:00 +0000]
Windows: cm_ShutdownSCache corrections

Obtain cm_scache.dirlock, cm_scache.rw and cm_scacheLock
in the correct order.

Do not release cm_scache.rw when it is not held.

Since the cm_scacheLock is being dropped, preserve the value
of scp->allNextp prior to dropping the lock.

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

9 years agoWindows: Save Wix config at start if possible
Jeffrey Altman [Mon, 15 Aug 2011 04:23:57 +0000]
Windows: Save Wix config at start if possible

Save the current configuration at the start of the install
process so the user can be presented with a dialog prior
to installation asking whether the existing or saved
configuration should be used or whether a new configuration
should be created.

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

9 years agoWindows: More interlocked ops for cm_cell flags
Jeffrey Altman [Mon, 15 Aug 2011 01:41:47 +0000]
Windows: More interlocked ops for cm_cell flags

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