openafs.git
11 years agofix audit init in vl and pr servers
Michael Meffie [Tue, 22 May 2012 15:45:50 +0000]
fix audit init in vl and pr servers

Correct error introduced in commit
0dd7c980acda0756150f11992a0d2236f340e0c2

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

11 years agocomerr: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:28:51 +0000]
comerr: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

11 years agoDon't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:33:33 +0000]
Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

11 years agoutil: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:32:28 +0000]
util: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

11 years agoupdate: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:31:53 +0000]
update: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

11 years agosys: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:31:07 +0000]
sys: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

11 years agoxstat: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 12:29:42 +0000]
xstat: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

11 years agolwp: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:33:28 +0000]
lwp: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

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

11 years agorx: Don't cast returns from allocator
Simon Wilkinson [Thu, 17 May 2012 11:31:39 +0000]
rx: Don't cast returns from allocator

malloc() and osi_Alloc both return (void *). So, don't bother
casting the return value before assigning it - its unnecessary
noise.

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

11 years agoauth & [ak]log: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:29:51 +0000]
auth & [ak]log: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

11 years agoafsmonitor & gtx: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:28:41 +0000]
afsmonitor & gtx: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

11 years agodbservers: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:26:37 +0000]
dbservers: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

11 years agolibadmin & uss: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 11:21:57 +0000]
libadmin & uss: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

11 years agofileserver & friends: Don't cast from malloc()
Simon Wilkinson [Thu, 17 May 2012 09:52:46 +0000]
fileserver & friends: Don't cast from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

11 years agobackup: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 09:18:24 +0000]
backup: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

11 years agobos: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 09:03:16 +0000]
bos: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

11 years agoJAVA: Don't cast returns from malloc()
Simon Wilkinson [Thu, 17 May 2012 08:37:50 +0000]
JAVA: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

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

11 years agoUnix CM: Don't cast allocator returns
Simon Wilkinson [Thu, 17 May 2012 08:19:03 +0000]
Unix CM: Don't cast allocator returns

All of our allocators return (void *) values, so there is no need
to cast the returns - doing so is just noise.

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

11 years agoDon't cast the return from calloc()
Simon Wilkinson [Thu, 17 May 2012 08:10:03 +0000]
Don't cast the return from calloc()

calloc returns a (void *) argument. So we don't need to cast its
output before storing it.

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

11 years agoDon't cast the return from realloc()
Simon Wilkinson [Thu, 17 May 2012 08:01:02 +0000]
Don't cast the return from realloc()

realloc takes, and returns a (void *) argument. So we don't need to
cast these parameters into, or out of, realloc. Doing so is just
noise, so don't bother.

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

11 years agoUse calloc, rather than malloc/memset
Simon Wilkinson [Thu, 17 May 2012 07:36:11 +0000]
Use calloc, rather than malloc/memset

Rather than doing
a = malloc(sizeof(me));
memset(a, 0, sizeof(me));

Just use
        a = calloc(1, sizeof(me));

This is simpler, shorter, and removes the potential for the size of
the memset not matching the size of the malloc (or the target of the
memset being wrong!)

Where the size is of the form (n * sizeof(me)), we also use
calloc(n, sizeof(me));

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

11 years agoDon't cast arguments to free()
Simon Wilkinson [Wed, 16 May 2012 19:38:02 +0000]
Don't cast arguments to free()

free(3) is defined as:

    void free(void *ptr);

so there is no need to cast the pointer argument being past to it to
(char *), (void *), or whatever other randomness happened to be floating
through the author's mind. Remove all such casts, as they are just
noise.

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

11 years agoauth: Simplify DNS lookups with asprintf
Simon Wilkinson [Wed, 16 May 2012 19:27:22 +0000]
auth: Simplify DNS lookups with asprintf

Instead of allocing a maximal string, and using snprintf to
construct each possible DNS search string, just use asprintf to
construct each string. This greatly simplifies the code, and makes
it much less likely that maths errors can creep in causing buffer
overflows in the future. The downside is that we have more round
trips to the allocator, but that shouldn't matter in this context.

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

11 years agoUse asprintf for string construction
Simon Wilkinson [Wed, 16 May 2012 19:23:41 +0000]
Use asprintf for string construction

Rather than using something along the lines of

    strOut = malloc(strlen(strA) + strlen(strB) + strlen(strC) + 1);
    strcpy(strOut, strA);
    strcat(strOut, strB);
    strcat(strOut, strC);

use asprintf for string construction, so we can just write

    asprintf(&strOut, "%s%s%s", strA, strB, strC);

roken provides an implementation of asprintf for platforms which are
missing one.

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

11 years agoUse strdup to copy strings
Simon Wilkinson [Wed, 16 May 2012 05:44:30 +0000]
Use strdup to copy strings

Where we have
    newStr = malloc(strlen(oldStr)+1);
    strcpy(newStr, oldStr);

replace these with
    newStr = strdup(oldStr);

It's shorter, clearer, and gets rid of a load of occurences of strcpy,
which some compilers are now warning is unsafe (although it isn't in
this context)

Get rid of a number of custom duplicate string functions and replace
them with strdup where the behaviour is identical

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

11 years agoafsd: Report fakestat correctly
Andrew Deason [Mon, 21 May 2012 23:15:58 +0000]
afsd: Report fakestat correctly

A fakestat value of 1 is for -fakestat-all, and 2 is for -fakestat,
not the other way around.

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

11 years agoafsd: Detect -dcache presence correctly
Andrew Deason [Mon, 21 May 2012 23:14:16 +0000]
afsd: Detect -dcache presence correctly

cmd_OptionAsInt will return 0 if the requested option is present and
valid.

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

11 years agoafsd: Avoid printing cacheBaseDir for memcache
Andrew Deason [Mon, 21 May 2012 23:01:49 +0000]
afsd: Avoid printing cacheBaseDir for memcache

cacheBaseDir is NULL when memcache is turned on; don't print it.

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

11 years agoafsd: Avoid dir interpolation for memcache
Andrew Deason [Mon, 21 May 2012 22:11:29 +0000]
afsd: Avoid dir interpolation for memcache

memcache doesn't make use of fullpn_DCacheFile, fullpn_VolInfoFile,
etc. Do not even try to generate these strings for memcache, since
cacheBaseDir will be NULL, and so this can cause a segfault on some
platforms including Solaris.

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

11 years agoafs: Add some comments explaining 'needvalid'
Andrew Deason [Mon, 21 May 2012 17:28:58 +0000]
afs: Add some comments explaining 'needvalid'

Add some comments to try and help explain the meaning of the
'needvalid' parameter to GetDSlot, added in
1a672914ab050811c99b6307c657630ab9b5c8ee.

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

11 years agoRevert "afs: the assert seems to be inverted when using memcache"
Andrew Deason [Mon, 21 May 2012 17:22:24 +0000]
Revert "afs: the assert seems to be inverted when using memcache"

This reverts commit bc7f10130f7b96923d1a1ad5c688ef0106a83178.

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

11 years agoafs: the assert seems to be inverted when using memcache
Chas Williams (CONTRACTOR) [Fri, 18 May 2012 00:57:38 +0000]
afs: the assert seems to be inverted when using memcache

needvalid will always be 1 for the memory cache -- i.e. the slots are
always valid.  see change id I53ea6e99649e4d6d5cbde58929dfcee1d45a3e7b.

Change-Id: Id1294d54cb5f20d226258e5da39fb4d4f782a694
Reviewed-on: http://gerrit.openafs.org/7421
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agovos: volume lock not released on convertROtoRW error
Mark Vitale [Tue, 8 May 2012 19:03:46 +0000]
vos: volume lock not released on convertROtoRW error

If an error occurs during convertROtoRW, the volume lock may
not be released.

Change-Id: Ic03af00676de836cade4e39a743b234a0dc9b6cf
Reviewed-on: http://gerrit.openafs.org/7389
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agovos: convertROtoRW does not respect volume lock
Mark Vitale [Tue, 8 May 2012 18:45:16 +0000]
vos: convertROtoRW does not respect volume lock

vos convertROtoRW was not checking the return code from
ubik_VL_SetLock().

Change-Id: I651c543f9a0070a9d34d9cca7583437e50e95dc8
Reviewed-on: http://gerrit.openafs.org/7388
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agoWindows: avoid deadlock TreeLock vs Fcb Resource
Jeffrey Altman [Fri, 18 May 2012 20:31:19 +0000]
Windows: avoid deadlock TreeLock vs Fcb Resource

Cannot call AFSPerformObjectInvalidate directly because
ObjectInfoCB->Specific.Directory.DirectoryNodeHdr.TreeLock is
held during the sequence

  AFSVerifyEntry->AFSValidateDirectoryCache->AFSVerifyDirectoryContent

and AFSPerformObjectInvalidate requires the Fcb->NPFcb->Resource
which must be held prior to the TreeLock.

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

11 years agoWindows: buf redir queue mgmt scp can be null
Jeffrey Altman [Fri, 18 May 2012 14:19:13 +0000]
Windows: buf redir queue mgmt scp can be null

buf_InsertToRedirQueue, buf_RemoveFromRedirQueue, and
buf_MoveToHeadOfRedirQueue can be passed a NULL cm_scache_t pointer.
If the pointer is NULL (as is the case during buf_Init() processing)
the scp->redirMx must not be obtained or a crash will occur.

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

11 years agoWindows: Apply MAX_FID_COUNT to AFS Redirector
Jeffrey Altman [Wed, 16 May 2012 13:52:00 +0000]
Windows: Apply MAX_FID_COUNT to AFS Redirector

Provide consistency between the SMB path parser and the AFS
redirector path processing by using the same constant, MAX_FID_COUNT,
for both.  MAX_FID_COUNT is the maximum number of unique file ids
that can exist in a path after all mount points and symlinks have
been expanded.  The current value is 512.

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

11 years agoWindows: AFSTearDownExtents may experience active extents
Jeffrey Altman [Mon, 14 May 2012 15:11:57 +0000]
Windows: AFSTearDownExtents may experience active extents

If there are extents with a non-zero ActiveCount when AFSTearDownExtents()
is executed, it must leave them alone and attached to the File Control
Block.  This has implications for its callers, especially AFSCleanupFcb()
since it may be the case that a Cleanup cannot be completed.

The AFSPrimaryVolumeWorker thread must therefore check after calling
AFSCleanupFcb() whether or not the Fcb ExtentCount is zero before
calling AFSRemoveFcb().

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

11 years agoWindows: avoid duplicate work cm_Analyze
Jeffrey Altman [Wed, 16 May 2012 03:27:36 +0000]
Windows: avoid duplicate work cm_Analyze

During VNOVOL processing, if the volume is replicated and the
server reference status is "not busy", set the status to busy
and avoid calling cm_SetServerBusyStatus() because that function
mirrors the loop that is already being processed.

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

11 years agovos: convertROtoRW may create two RW volumes
Mark Vitale [Tue, 8 May 2012 14:01:12 +0000]
vos: convertROtoRW may create two RW volumes

If the RW volume is listed after the RO convert target in the VLDB,
the code failed to detect that an RW is already present and would
create a second RW volume.

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

11 years agoWindows: init section ptrs for pioctl files
Jeffrey Altman [Tue, 15 May 2012 04:23:17 +0000]
Windows: init section ptrs for pioctl files

FIXES 130783

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

11 years agoWindows: Redir Ioctl thread safety
Jeffrey Altman [Mon, 14 May 2012 04:12:17 +0000]
Windows: Redir Ioctl thread safety

A crash dump showed that it is possible for a Cleanup
to race with a Read from the ioctl file.  Add reference counting
to protect against crashing under such a circumstance.

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

11 years agoWindows: Permit Media Player to work with mapped drives
Jeffrey Altman [Fri, 11 May 2012 23:24:54 +0000]
Windows: Permit Media Player to work with mapped drives

Windows Media Player was failing to play media files from
mapped drives if the mapping was to a directory several
levels below \\afs\cellname\.  The code to permit SUBST drive
letters to work got in the way during NPGetConnection processing.
Try to get the connection info without the drive substitution
logic.  Try again with the drive substitution if the result
is no connection present.

FIXES 130757

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

11 years agovolser: preserve stats over reclones and restores
Michael Meffie [Thu, 23 Feb 2012 17:34:44 +0000]
volser: preserve stats over reclones and restores

Optionally, preserve the volume usage statistics instead of clearing
them during reclone and restore operations.

Change-Id: I436b39b129b892912533ddeff5569b07224b075c
Reviewed-on: http://gerrit.openafs.org/3312
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

11 years agovos: convertROtoRW misc error reporting problems
Mark Vitale [Tue, 8 May 2012 16:38:38 +0000]
vos: convertROtoRW misc error reporting problems

Fixes a few inconsistencies and bugs in some error messages.

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

11 years agocmd: Add support for pulling options from files
Simon Wilkinson [Sun, 9 Oct 2011 00:20:57 +0000]
cmd: Add support for pulling options from files

With this change, we gain the ability to set our command line options
from krb5.conf configuration files. This is only available for tools
which are implemented using the new cmd_OptionAs accessor methods.

Callers should load their configuration file using
    cmd_OpenConfigFile("/path/to/config/file.conf");

(an addition to libauth to return a path to a system wide
 configuration file will be forthcoming)

and then set their command name (for example, "fileserver", "afsd",
"vos" and so on) using
    cmd_SetCommandName("mycommand");

The accessor functions will then populate their return values with
either:
  a) The command line options, if specified
  b) The contents of the tag matching the option name, in the
     [command_subcommand] section of the configuration file, if it
     exists
  c) The contents of the same tag, in the [command] section of the
     configuration file, if it that exists.
  d) The contents of the same tag in the [defaults] section of the
     configuration file.

Callers can also gain access to the entire configuration file by
calling cmd_RawFile, or to just the section corresponding to their
command line by calling cmd_RawSection. Note that when using the file
directly, it is up to callers to preserve consistency by implementing
similar inheritance rules as the above.

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

11 years agotests: Add additional cmd tests
Simon Wilkinson [Thu, 10 May 2012 15:51:01 +0000]
tests: Add additional cmd tests

Add additional tests to the libcmd test suite to verify the
behaviour of cmd_OptionPresent and cmd_OptionAsList

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

11 years agomacos: update AFS prefs pane
Derrick Brashear [Wed, 18 Apr 2012 15:57:10 +0000]
macos: update AFS prefs pane

modify afshelper to just run what it's told instead
of offering fixed operations. this avoids having a setuid
tool around. in spite of apple's suggestion this is correct,
it's actually more dangerous. instead, elevate privilege only
to run a small set of commands, then drop. allow
unlocking of the prefs pane, but make the menu extra prompt
for authentication when needed.
deactivate controls in the prefs pane when locked.

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

11 years agoCall rx_SetNoJumbo earlier
Andrew Deason [Fri, 4 May 2012 22:23:42 +0000]
Call rx_SetNoJumbo earlier

For ubik server processes, rx_SetNoJumbo needs to be called before
ubik initialization for it to effect the communication between
dbservers; otherwise, full database transfers may result in Rx
jumbograms on the wire regardless of the jumbo/nojumbo setting. Move
the call to rx_SetNoJumbo to before ubik initialization to avoid this.

Also move the call to rx_SetNoJumbo to immediately after rx_Init* for
all server processes, for consistency. Move similar calls to
rx_SetMaxMTU for the same reason.

Change-Id: Ic79415829601fcfb4e74e72fbf5711d0c32aaa0c
Reviewed-on: http://gerrit.openafs.org/7350
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agoDOC: vos convertROtoRW security requirements
Mark Vitale [Wed, 2 May 2012 17:55:16 +0000]
DOC: vos convertROtoRW security requirements

They were copied from another command; corrected them.

Change-Id: Ic77f1a91520ec4147e42864438d98942f6a7effc
Reviewed-on: http://gerrit.openafs.org/7305
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agodoc: add Windows section to fs newcell
Ken Dreyer [Fri, 16 Mar 2012 19:37:20 +0000]
doc: add Windows section to fs newcell

fs newcell works slightly differently on Windows. Document the
differences in the man page.

FIXES 125094

Change-Id: I3fb71ebb28290222069d795762f50a82f3fb6495
Reviewed-on: http://gerrit.openafs.org/6919
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agovol: Free vol header on attach_volume_header error
Andrew Deason [Thu, 3 May 2012 21:36:03 +0000]
vol: Free vol header on attach_volume_header error

In attach_volume_header, make sure we free the volume's header if
we're returning an error. We take care of the locks and i/o handles in
the immediately preceding block, but for an actual error we don't get
rid of the header. Do so.

Noticed by Tom Keiser.

Change-Id: I97e61700f644066ac1a0e6b45a67dd62c5397034
Reviewed-on: http://gerrit.openafs.org/7325
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agoMake the cmd config file parser build on Windows
Simon Wilkinson [Sun, 22 Apr 2012 14:20:18 +0000]
Make the cmd config file parser build on Windows

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

11 years agocmd: Don't expose krb5 error codes
Simon Wilkinson [Sun, 9 Oct 2011 00:17:19 +0000]
cmd: Don't expose krb5 error codes

Don't use krb5 error codes in our configuration parser, instead use an
error allocated from the existing cmd error table

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

11 years agoImport of code from rra-c-util
Russ Allbery [Fri, 11 May 2012 20:28:41 +0000]
Import of code from rra-c-util

This commit updates the code imported from rra-c-util to
3900f94b9b8c46a3cb2d83d73c6cf4b73be1cc10 (release/4.4)

New files are:
m4/krb5-config.m4

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

11 years agorra-c-util: Add additional file
Simon Wilkinson [Fri, 11 May 2012 20:27:02 +0000]
rra-c-util: Add additional file

Add the m4/krb5-config.m4 file, which is required for version 4.4,
to the list of imports.

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

11 years agotests: Start using the upstream C TAP harness
Simon Wilkinson [Mon, 7 May 2012 20:52:16 +0000]
tests: Start using the upstream C TAP harness

Instead of bundling our own copies of Russ's C TAP Harness, start using
source pulled from his git repository using the src/external import
mechanism. Note that we are not currently building the floating
point (is_double) portion of the harness.

In the process of doing so, we also upgrade our test harness to the latest
upstream version, 1.11. This is somewhat problematic, as there have been
some significant code changes since the version bundled with OpenAFS.
Work around these by
   *) Referencing the basic.h header as <tests/tap/basic.h>, rather than
      just <tap/basic.h>, to match the new upstream layout
   *) Changing the include path so that the tests/ directory can be
      found within it.

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

11 years agoImport of code from c-tap-harness
Russ Allbery [Fri, 11 May 2012 20:16:22 +0000]
Import of code from c-tap-harness

This commit updates the code imported from c-tap-harness to
d3fc03606efc8e76ff34f04470e6133db25a3982 (release/1.12)

New files are:
LICENSE
NEWS
README
tests/runtests.c
tests/tap/basic.c
tests/tap/basic.h
tests/tap/float.c
tests/tap/float.h
tests/tap/libtap.sh
tests/tap/macros.h

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

11 years agoc-tap-harness: Fix import paths
Simon Wilkinson [Fri, 11 May 2012 20:14:38 +0000]
c-tap-harness: Fix import paths

Somehow or another, the file list committed as
098e6f141f2234dcd0196096ab6f739db678f746 is missing the tests/
prefix for a number of object files. Reinstate this prefix.

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

11 years agoWindows: Avoid deadlock during "fs memdump"
Jeffrey Altman [Thu, 10 May 2012 12:36:33 +0000]
Windows: Avoid deadlock during "fs memdump"

When the afs redirector is in use, it is possible that "fs memdump"
could be executed while all of the pages in the Windows page cache
are dirty with data that must be purged and flushed to \\afs. In
such a situation it is not safe for afsd_service.exe to hold
global locks such as buf_globalLock, cm_scacheLock, etc. while
performing WriteFile() calls against %TEMP%\afsd_alloc.log if
afsd_alloc.log was opened without the FILE_FLAG_NO_BUFFERING flag.
Doing so can result in a deadlock as it can become impossible for
the Windows page cache to purge data to complete the WriteFile()
as all extent operations block waiting for the global lock to
be cleared.

The correct long term approach would be to use the FILE_FLAG_NO_BUFFERING
flag when opening %TEMP%\afsd_alloc.log.  However, this requires that
all writes to the file be performed using buffers that are consistent
with the drive geometry.  Such an approach would be incompatible with
the _CrtMemDumpAllObjectsSince() operation and would require a redesign
of the current interfaces.  See

http://msdn.microsoft.com/en-us/library/windows/desktop/cc644950(v=vs.85).aspx

for requirements when using non-buffered writes.

The short term fix is to dump the contents without holding the
global locks.  This can result in an inconsistent view of the world
but will ensure that deadlocks are avoided.  This patchset makes
such a change when the afs redirector is in use.

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

11 years agoWindows: cm_GetBuffer do not retry if biod empty
Jeffrey Altman [Wed, 9 May 2012 14:44:39 +0000]
Windows: cm_GetBuffer do not retry if biod empty

Change-Id: I583a69199b0e3163c3bc5b620543028f2950bfeb
Reviewed-on: http://gerrit.openafs.org/7390
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

11 years agoMake it build outside source tree
Hartmut Reuter [Mon, 7 May 2012 10:31:15 +0000]
Make it build outside source tree

some missing ${srcdir}/ inserted

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

11 years agovol: Remove redundant vop check in GetVolume
Andrew Deason [Wed, 2 May 2012 17:11:01 +0000]
vol: Remove redundant vop check in GetVolume

VAttachVolumeByVp_r (specifically attach_check_vop in attach2) already
handles checking for conflicting vol ops, and gives us VOFFLINE
appropriately. We don't need to check again in GetVolume.

Change-Id: Ibb93d423d3c856dd957a2569412a85698180ff8e
Reviewed-on: http://gerrit.openafs.org/7304
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agoc-tap-harness: add float.h
Derrick Brashear [Tue, 8 May 2012 03:31:02 +0000]
c-tap-harness: add float.h

add float.h to the list of files we import for c-tap-harness from
upstream

Change-Id: I133dd6172bab17ae183cc6fc983f92f19005ba85
Reviewed-on: http://gerrit.openafs.org/7381
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agotests: Use enum rather than #defines for tests
Simon Wilkinson [Sat, 8 Oct 2011 22:33:37 +0000]
tests: Use enum rather than #defines for tests

Change the command test so that it uses an enum, rather than #defines
for offsets into the parms array. This is mainly a cosmetic change, but
brings the test suite into line with the way that we're doing stuff in
the "real" code.

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

11 years agovol: Pay attention to specialStatus after VAVByVp
Andrew Deason [Wed, 2 May 2012 17:07:49 +0000]
vol: Pay attention to specialStatus after VAVByVp

attach2/VAttachVolumeByVp_r do not alter the yielded error code
according to specialStatus. So, pay attention to specialStatus after
receiving an error from VAttachVolumeByVp_r, to ensure we respond with
the correct error code.

Change-Id: I59e977dd1f0949f8fe5670c7a52429acbfb7d7e9
Reviewed-on: http://gerrit.openafs.org/7303
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agovol: Avoid VBUSY/VRESTARTING trick for offline vop
Andrew Deason [Wed, 2 May 2012 16:38:57 +0000]
vol: Avoid VBUSY/VRESTARTING trick for offline vop

Currently, if GetVolume() finds that the volume we're trying to attach
has a vol op that leaves the volume offline, we do the
VBUSY/VRESTARTING trick as described in CheckVnode(). This doesn't
make any sense for a couple of reasons.

For one, VBUSY/VRESTARTING is not the correct error code to return to
the client when an offline vol op is in progress and vp->specialStatus
is not set everywhere else we yield VOFFLINE.

Additionally, this block of code is only hit once for a particular vol
op. Once we reach this section, the volume is in UNATTACHED state, and
so on the next iteration of GetVolume we will immediately return
VOFFLINE (or specialStatus). So the CheckVnode-like situation is not
applicable, since we are not returning VBUSY to the same client for 15
minutes; we would return VBUSY once and then return VOFFLINE.

Change-Id: I0e8376df7937fd6bd01f9998371b9289c4ad2618
Reviewed-on: http://gerrit.openafs.org/7302
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agoConfigure src/external for c-tap-harness
Simon Wilkinson [Mon, 7 May 2012 20:21:26 +0000]
Configure src/external for c-tap-harness

Setup the src/external system so that we can pull in releases of
the C Tap Harness using that mechanism.

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

11 years agofs: Report default storebehind when errors exist
Andrew Deason [Mon, 7 May 2012 20:49:34 +0000]
fs: Report default storebehind when errors exist

After 904c9fbe, we no longer print out the default store asynchrony
when any of the supplied paths results in a pioctl error. However, if
just one (or a few) of the paths supplied results in an error (such
as, the path does not exist), this does not prevent us from reporting
the default value.

Instead, keep track of whether or not we have a valid value, and try
to determine the default if we haven't already by the end of
StoreBehindCmd, and print it out.

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

11 years agoWindows: cleanup redirector pipes
Jeffrey Altman [Mon, 7 May 2012 15:35:07 +0000]
Windows: cleanup redirector pipes

If pipe creation fails, cleanup the mess.

At shutdown, if there are pipes that have not been closed by
Windows, clean them up.

This is just to ensure that at shutdown the reference counts of
cm_scache_t objects in the cache are reset to zero.

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

11 years agoWindows: Correct refcount leak
Jeffrey Altman [Mon, 7 May 2012 04:56:11 +0000]
Windows: Correct refcount leak

The new duplicate avoidance code in cm_QueueBKGRequest() leaked
a cm_scache_t and a cm_user_t reference count.

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

11 years agoWindows: fix build with DEBUG_REFCOUNT
Jeffrey Altman [Mon, 7 May 2012 04:54:27 +0000]
Windows: fix build with DEBUG_REFCOUNT

cm_GetSCache added a new parameter.  The same parameter is required
for the cm_GetSCache macro when DEBUG_REFCOUNT is defined at build
time.

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

11 years agoWindows: Checksum server lists on Volume Errors
Jeffrey Altman [Sun, 6 May 2012 23:31:03 +0000]
Windows: Checksum server lists on Volume Errors

For VMOVED, VNOVOL and VOFFLINE checksum the server lists for
the current volume.  If the server list changes as a result of
the forced volume location update, do not set the updated flag
which prevents subsequent volume location updates for the current
cm_req object.

This combined with the previous patchset to filter volume locations
based upon the VLSF_NEWREPSITE flag will avoid outages during
vos release operations.

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

11 years agoWindows: cm_SetServerBusyState use cm_ServerEqual
Jeffrey Altman [Sun, 6 May 2012 13:54:55 +0000]
Windows: cm_SetServerBusyState use cm_ServerEqual

When the busy state of a server is set it must apply to all
server references if the server is multi-homed.  Use cm_ServerEqual()
to do so.

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

11 years agoWindows: Track Mixed RO Volume Release State
Jeffrey Altman [Sun, 6 May 2012 01:37:00 +0000]
Windows: Track Mixed RO Volume Release State

If the volume location information indicates that a replica site
is VLSF_NEWREPSITE then it implies that some of the replicas are
out of date.  Ignore the out of date replicas when constructing
the list and force a volume location list reset every five minutes
while the replica site info is mixed.

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

11 years agoWindows: Make CM resilient to transient VNOVOL
Jeffrey Altman [Sun, 6 May 2012 00:46:08 +0000]
Windows: Make CM resilient to transient VNOVOL

The 1.6.0 and 1.6.1 file servers send transient VNOVOL errors which
are no indicative of the volume not being present.  For example,
VNOVOL can be sent during a transition to a VBUSY state prior to
salvaging or when cloning a .backup volume instance.  As a result
the cache manager must attempt at least one retry when a VNOVOL is
receive but there are no changes to the volume location information.

This patchset records the VNOVOL error in the cm_req_t structure
If the volume is replicated, the volume's server reference into a busy state.
If the volume is not replicated, the thread is paused for two seconds.
In both cases, the request is retried.  If the VNOVOL error is received
a second time from the same server, the volume server reference is
deleted as before.  This is done to prevent repeated requests to the
VLDB server and the file server that are expected to fail.  The server
reference will be restored to the volume on the next volume location
update.

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

11 years agoWindows: cm_GetNewSCache drop lock to permit change
Jeffrey Altman [Sat, 5 May 2012 23:11:07 +0000]
Windows: cm_GetNewSCache drop lock to permit change

In cm_GetNewSCache the entire LRU queue is searched for a
cm_scache_t object that is safe to recycle.  If none are the LRU
queue was immediately searched again without dropping the
cm_scacheLock or taking a pause.  As a result it is quite possible
that a thread about to release a cm_scache_t was blocked from
doing so.

This patchset factors some of the logic a bit differently to
improve readability and adds new log messages to help diagnose
the cause of a problem if no cm_scache_t ever becomes available.

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

11 years agoWindows: Remove dead code in AFSRead.cpp
Jeffrey Altman [Sat, 5 May 2012 17:50:36 +0000]
Windows: Remove dead code in AFSRead.cpp

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

11 years agoubik: Initialize ubik_callPortal earlier
Andrew Deason [Fri, 4 May 2012 22:13:32 +0000]
ubik: Initialize ubik_callPortal earlier

As of 7caf4143, we call ubeacon_InitServerList* before ubik_callPortal
is set, causing Rx connections to be created to port 0, causing
various problems with communicating with other sites. Initialize
ubik_callPortal to the correct value before calling any such
functions, so we create connections to the right port.

Change-Id: I37dbf575bcdec10463c7b6006738678096a92573
Reviewed-on: http://gerrit.openafs.org/7349
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agoWindows: FCB cleanup must be done before ObjectInfo
Jeffrey Altman [Fri, 4 May 2012 00:01:22 +0000]
Windows: FCB cleanup must be done before ObjectInfo

When processing the cleanup and destruction of a File Control Block
the related ObjectInfoCB is required for proper cleanup.  Reorganize
the AFSPrimaryVolumeWorkerThread logic to ensure that this is true.
This involves dropping the VolumeCB->ObjectInfoTree.TreeLock around
the AFSCleanupFcb() call. While the lock is released it is possible
for the ObjectInfoCB->OpenReferenceCount to change.  Therefore, new
checks must be added after the lock is re-acquired to ensure that
an in-use object is not destroyed.

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

11 years agoWindows: AFSInitFcb STATUS_REPARSE cleanup
Jeffrey Altman [Thu, 3 May 2012 23:58:31 +0000]
Windows: AFSInitFcb STATUS_REPARSE cleanup

If a race is detected when creating a new File Control Block in
AFSInitFcb() the Fcb Header must be torn down and the ExtentsResource
and DirtyExtentsListLock must be deleted prior to freeing the pool
memory.

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

11 years agoWindows: cm_BkgFetch do not impose arbitrary timeout
Jeffrey Altman [Wed, 2 May 2012 22:20:45 +0000]
Windows: cm_BkgFetch do not impose arbitrary timeout

The afs redirector will queue extent requests for the entire file
if it is being copied to local disk as long as there is enough
page cache space to store it.  If the file is 8GB and the bandwidth
from the file server is 100K/second it may take a while to get to
the end of the request queue.  Do not arbitrarily time out the
requests.

Change-Id: I12d9358ee5de37fc78d68c8e07dd14ca5dda1832
Reviewed-on: http://gerrit.openafs.org/7320
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

11 years agoWindows: Treat all cached writes as write-through
Jeffrey Altman [Wed, 2 May 2012 22:05:26 +0000]
Windows: Treat all cached writes as write-through

Treat all writes that are cached in the windows page cache as
write-through requests so that they are delivered immediately to
the AFS cache.

The upside is that the afsd service can begin to store data to the
file server immediately which can be of significant importance whe
the AFSCache is larger than the file size and the file size is large
and the bandwidth to the file server is slow.  In that situation
the entire file can be written into the windows page cache and
will only be flushed to disk at the last handle close on the file.

The downside is that all data will be written to the file server
including that for files that will later have the delete pending
flag applied.

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

11 years agoWindows: AFSQueueFlushExtents permit NULL AuthGroup
Jeffrey Altman [Wed, 2 May 2012 22:04:23 +0000]
Windows: AFSQueueFlushExtents permit NULL AuthGroup

If the AuthGroup is NULL, search for an AuthGroup to use when
queuing the flush extents request.

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

11 years agoWindows: refactor AFSCleanupFcb
Jeffrey Altman [Wed, 2 May 2012 22:02:28 +0000]
Windows: refactor AFSCleanupFcb

move the checks for deleted and invalid files earlier in the
function to simplify other conditional tests.

Change-Id: I973f411b65c0327227f07718ae764572d6f37c85
Reviewed-on: http://gerrit.openafs.org/7317
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

11 years agoWindows: correct typos or mistaken comments
Jeffrey Altman [Wed, 2 May 2012 22:01:31 +0000]
Windows: correct typos or mistaken comments

Change-Id: Iae278c0121c1b4d3cc9aaab276fab798c1a8065b
Reviewed-on: http://gerrit.openafs.org/7316
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

11 years agoWindows: RDR_RequestFileExtentsAsync set current DV
Jeffrey Altman [Wed, 2 May 2012 21:58:39 +0000]
Windows: RDR_RequestFileExtentsAsync set current DV

if the buffer returned from cm_GetBuffer() has an offset that is
beyond the serverLength and it has a "bad" data version, set the
data version to the current value.  This is for debugging clarity.

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

11 years agoWindows: refactor cm_GetBuffer avoid BIOD construction
Jeffrey Altman [Wed, 2 May 2012 21:52:44 +0000]
Windows: refactor cm_GetBuffer avoid BIOD construction

Constructing a BIOD is a very expensive operation as it requires
obtaining exclusive locks on each and every buffer that in the
collection.  The prior code would construct a BIOD for a chunk
worth of buffers and then check to see if the current buffer is
beyond the serverLength or the truncation position.  If so, the
buffer is cleared and the buffer is returned as current after
releasing the BIOD.  This is very wasteful.  Instead, check every
buffer in the BIOD to see if it should be made current or not.
If yes, do so before releasing the BIOD.  This permits the construction
of the BIOD to be avoided for the rest of the buffers in the chunk.

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

11 years agoWindows: cm_InitDaemon initialize cm_bkgQueueCountp[]
Jeffrey Altman [Wed, 2 May 2012 21:47:46 +0000]
Windows: cm_InitDaemon initialize cm_bkgQueueCountp[]

Change-Id: Ie4abd1c26d54208921a78e421b447a8f4fc5684a
Reviewed-on: http://gerrit.openafs.org/7313
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

11 years agoWindows: cm_QueueBKGRequest improvements
Jeffrey Altman [Wed, 2 May 2012 21:42:59 +0000]
Windows: cm_QueueBKGRequest improvements

Do not add duplicate requests into the queue.  Outstanding extent requests
will be re-issued by the afs redirector on a periodic basis while
waiting for them to be satisfied.  If they are pending there is no
need to remember them a second time.

Use separate queues for Fetch and Store operations.  Store operations
might be blocked on the file server but a Fetch operation might be served
from the cache.

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

11 years agoWindows: buf_GetNewLocked skip redirector owned buffers
Jeffrey Altman [Wed, 2 May 2012 21:39:12 +0000]
Windows: buf_GetNewLocked skip redirector owned buffers

If a buffer is owned by the afs redirector, regardless of whether
or not it is dirty, do not use it.

Change-Id: Icc92f3cb8606ac67bcf561d409c76bd5a4a7bc06
Reviewed-on: http://gerrit.openafs.org/7311
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

11 years agoWindows: buf_RemoveFromRedirQueue in buf_Init
Jeffrey Altman [Wed, 2 May 2012 20:57:11 +0000]
Windows: buf_RemoveFromRedirQueue in buf_Init

use buf_RemoveFromRedirQueue in buf_Init instead of the roughly
duplicated code.

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

11 years agoWindows: AFSInitializeProcessCB failure stack exhaustion
Jeffrey Altman [Wed, 2 May 2012 18:32:01 +0000]
Windows: AFSInitializeProcessCB failure stack exhaustion

If AFSInitializeProcessCB() fails in AFSProcessCreate() it can
lead to a recursive loop of AFSValidateProcessEntry() ->
AFSProcessCreate() calls.  Only call AFSValidateProcessEntry()
if AFSInitializeProcessCB() succeeds.  On failure, log an error
to the trace log.

Change-Id: I67a65bed9a3193a5ce44eb01d30aed15fe9e469d
Reviewed-on: http://gerrit.openafs.org/7309
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

11 years agoWindows: More useful AFSDumpFile exception info
Jeffrey Altman [Mon, 30 Apr 2012 10:22:41 +0000]
Windows: More useful AFSDumpFile exception info

Modify AFSExceptionFilter to accept the __FUNCTION__ name
where the exception occurred.

Generate the trace dump file after the exception has been
handled so that it is possible to see where it happened
in the trace output.

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

11 years agoWindows: VNOSERVICE error translation
Jeffrey Altman [Mon, 30 Apr 2012 10:18:58 +0000]
Windows: VNOSERVICE error translation

Translate VNOSERVICE as CM_ERROR_RETRY and not CM_ERROR_OFFLINE.

Change-Id: I6daf9b9fb607192cedc057c518137772a7eb1bab
Reviewed-on: http://gerrit.openafs.org/7307
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

11 years agoWindows: VNOSERVICE message text
Jeffrey Altman [Mon, 30 Apr 2012 10:18:06 +0000]
Windows: VNOSERVICE message text

correct message text to indicate that an rpc has not been serviced.

Change-Id: Id2d82756253136ae6221aa2227be64bf654ee36e
Reviewed-on: http://gerrit.openafs.org/7306
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

11 years agoWindows: reorg RDR_CleanupFile to prevent lock leak
Jeffrey Altman [Sun, 29 Apr 2012 14:31:07 +0000]
Windows: reorg RDR_CleanupFile to prevent lock leak

RDR_CleanupFile could fail to drop a file lock if the user does
not have write permission on last handle close even if the file
is readonly or there were no dirty extents to be stored.  The
error handling would return the error immediately and skip the
file lock release.   This patchset changes the logic so that the
user permissions are not tested if the file is located on a readonly
volume or if there are no dirty extents or metadata changes to store.

In addition, if there is an error, skip to unlock processing and
not to function exit processing.

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

11 years agovos: Default to server confdir for -localauth
Andrew Deason [Thu, 3 May 2012 19:57:08 +0000]
vos: Default to server confdir for -localauth

For -localauth, we traditionally default to using the server
configuration directory, since that's usually the dir that has the
KeyFile in it. Keep doing that with the new ubik client interface.

Change-Id: I0f7e1ed180874f52c2b91b1ea3f74e763c26cd0c
Reviewed-on: http://gerrit.openafs.org/7324
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agovos: Correct comment
Andrew Deason [Thu, 3 May 2012 19:55:39 +0000]
vos: Correct comment

This is -localauth, not -serverauth

Change-Id: I8337c231905a5424b5a91b0ed981adade64ca144
Reviewed-on: http://gerrit.openafs.org/7323
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

11 years agovos setaddrs: notice unexpected errors
Andrew Deason [Thu, 3 May 2012 17:40:40 +0000]
vos setaddrs: notice unexpected errors

Currently 'vos setaddrs' only prints a message and errors out if the
VL_RegisterAddrs call fails with certain error codes (VL_MULTIPADDR
and RXGEN_OPCODE). But if we get something else like an access error,
we should of course print that out, instead of reporting success.

Change-Id: Id90c65604289651d9f20fb1ab2c706446162f324
Reviewed-on: http://gerrit.openafs.org/7322
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>