Commit Graph

10248 Commits

Author SHA1 Message Date
Simon Wilkinson
044785d587 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>
2012-05-24 08:48:35 -07:00
Simon Wilkinson
bd1248ca39 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>
2012-05-24 08:48:22 -07:00
Andrew Deason
47e1258480 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>
2012-05-21 17:52:33 -07:00
Andrew Deason
258a092260 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>
2012-05-21 17:51:58 -07:00
Andrew Deason
9eb924f16c 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>
2012-05-21 17:51:31 -07:00
Andrew Deason
2e2bc535bd 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>
2012-05-21 17:51:07 -07:00
Andrew Deason
6f6c799c4b afs: Add some comments explaining 'needvalid'
Add some comments to try and help explain the meaning of the
'needvalid' parameter to GetDSlot, added in
1a672914ab.

Change-Id: I4f1c704fa131df07e671f46b1b7575fbf607fce4
Reviewed-on: http://gerrit.openafs.org/7429
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-05-21 17:50:12 -07:00
Andrew Deason
cfae6cda3f Revert "afs: the assert seems to be inverted when using memcache"
This reverts commit bc7f10130f.

Change-Id: Ie4f4a103177f0485fc1196acfe4203ce06b6ce15
Reviewed-on: http://gerrit.openafs.org/7428
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-05-21 17:49:47 -07:00
Chas Williams (CONTRACTOR)
bc7f10130f 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>
2012-05-21 10:09:02 -07:00
Mark Vitale
33eff6597f 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>
2012-05-21 10:08:48 -07:00
Mark Vitale
38ebd79baf 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>
2012-05-21 10:08:30 -07:00
Jeffrey Altman
3a7dbe3315 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>
2012-05-21 07:26:01 -07:00
Jeffrey Altman
564c9733e5 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>
2012-05-19 13:48:08 -07:00
Jeffrey Altman
e04f324b5d 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>
2012-05-16 18:21:00 -07:00
Jeffrey Altman
94f96c6aae 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>
2012-05-16 18:20:43 -07:00
Jeffrey Altman
a9a768fb7a 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>
2012-05-16 06:03:30 -07:00
Mark Vitale
9a728fd86c 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>
2012-05-16 05:40:49 -07:00
Jeffrey Altman
97581f7510 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>
2012-05-15 16:58:45 -07:00
Jeffrey Altman
ac08a0c30d 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>
2012-05-15 16:58:25 -07:00
Jeffrey Altman
a160606616 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>
2012-05-15 16:58:08 -07:00
Michael Meffie
dfceff1d3a 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>
2012-05-12 06:33:26 -07:00
Mark Vitale
e1c6ad7d58 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>
2012-05-12 06:33:15 -07:00
Simon Wilkinson
0f30c95a03 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>
2012-05-11 18:49:07 -07:00
Simon Wilkinson
ad347dea32 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>
2012-05-11 18:49:00 -07:00
Derrick Brashear
0524e0d191 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>
2012-05-11 17:21:19 -07:00
Andrew Deason
0debf2d227 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>
2012-05-11 17:20:05 -07:00
Mark Vitale
a2f523b505 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>
2012-05-11 17:19:11 -07:00
Ken Dreyer
186158c9eb 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>
2012-05-11 17:18:44 -07:00
Andrew Deason
ecfd9549fc 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>
2012-05-11 17:14:56 -07:00
Simon Wilkinson
f45ed29d5f 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>
2012-05-11 16:40:55 -07:00
Simon Wilkinson
1a823e9326 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>
2012-05-11 16:39:52 -07:00
Russ Allbery
0f5dc583a9 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>
2012-05-11 16:37:50 -07:00
Simon Wilkinson
99108f9544 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>
2012-05-11 16:37:25 -07:00
Simon Wilkinson
c877c0b419 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>
2012-05-11 16:36:44 -07:00
Russ Allbery
319ec27236 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>
2012-05-11 16:36:06 -07:00
Simon Wilkinson
a18848fcae c-tap-harness: Fix import paths
Somehow or another, the file list committed as
098e6f141f 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>
2012-05-11 16:35:42 -07:00
Jeffrey Altman
c6782b86d7 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>
2012-05-10 15:45:27 -07:00
Jeffrey Altman
90ecc0ff72 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>
2012-05-10 15:44:51 -07:00
Hartmut Reuter
4b58432de4 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>
2012-05-08 10:26:55 -07:00
Andrew Deason
1e13ae53b3 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>
2012-05-08 10:26:43 -07:00
Derrick Brashear
80cb7bdebe 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>
2012-05-08 04:17:02 -07:00
Simon Wilkinson
a9595ab047 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>
2012-05-07 20:24:50 -07:00
Andrew Deason
a81f9237bf 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>
2012-05-07 20:22:23 -07:00
Andrew Deason
21ed79aeae 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>
2012-05-07 20:21:38 -07:00
Simon Wilkinson
098e6f141f 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>
2012-05-07 20:17:38 -07:00
Andrew Deason
427f53eea7 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>
2012-05-07 20:15:34 -07:00
Jeffrey Altman
e9e14b5519 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>
2012-05-07 10:04:00 -07:00
Jeffrey Altman
542dad7573 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>
2012-05-07 10:03:16 -07:00
Jeffrey Altman
6da91dfcb8 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>
2012-05-07 10:02:54 -07:00
Jeffrey Altman
4fce72b0e6 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>
2012-05-06 17:51:06 -07:00