Simon Wilkinson [Mon, 30 May 2011 19:14:45 +0000 (20:14 +0100)]
vos: Add the -config option
Add the -config option to all vos commands, so that the user can set
the location of the configuration directory to use. This is primarily
provided for testing purposes, and will shortly be used to hook vos
up into the TAP-style test suite.
Simon Wilkinson [Mon, 30 May 2011 19:02:31 +0000 (20:02 +0100)]
cmd: Add support for disabling specific abbrevs
Sometimes, when adding a new command parameter, it's necessary to
prevent it from colliding with an existing abbreviation. This patch
adds a new command flag CMD_NOABBRV which can be set on a parameter
to indicate that it should not be considered when checking for
ambiguous abbreviations.
For example, if a command has the existing '-cell' option which is
popularly abbreviated to '-c', adding a '-config' option would
cause the existing abbreviation to stop working. However, if '-config'
is added with the NOABBRV flag set, '-c' will continue to work.
Jeffrey Altman [Sat, 4 Jun 2011 17:28:26 +0000 (13:28 -0400)]
Windows: refactor fs acl funcs into fs_acl.c
The ACL structure definitions and manipulation functions
were defined both in WINNT/afsd/fs.c and WINNT/client_exp/gui2fs.cpp.
Extract them to WINNT/afsd/fs_acl.c and refactor them so that a
single copy can be maintained for both modules.
The most significant change is to CleanAcl() which now accepts
a cellname instead of a file path. By accepting a cellname the
ACL functionality is completely isolated from the path processing
and pioctl operations.
At the present time, fs.exe calls CleanAcl() with a cell name
and afs_shl_ext.dll does not. All callers in fs.c have been updated
to use the new behavior.
gui2fs.cpp also comments functions that exist in the file but
have no caller. These can be removed at a later date if they
are not required.
Jeffrey Altman [Sat, 4 Jun 2011 03:39:59 +0000 (23:39 -0400)]
Windows: Add GetFileInformationByHandleEx to fs_InAFS
If available on the operating system, use
GetFileInformationByHandleEx to translate the path into
the file system normalized form. This permits paths that
cross NTFS reparse points to be successfully evaluated as
being in afs. For example:
c:\afs -> \\afs\all
GetFileInformationByHandleEx is integrated into Vista and
Server 2008 and above.
Jeffrey Altman [Fri, 3 Jun 2011 18:19:27 +0000 (14:19 -0400)]
Windows: refactor fs, symlink and fs_utils
over the years a large number of duplicated functionality
has been added to symlink.c and fs.c. Refactor both so all
common functionality is implemented within fs_utils.c.
Ensure that all functionality migrated to fs_utils.c and
symlink.c uses the SafeString library functions.
Update the build rules for afs_shl_ext.dll, afscreds.exe
and afsconfig.exe to support the changes to fs_utils.c.
Jeff Blaine [Sun, 5 Jun 2011 20:38:53 +0000 (16:38 -0400)]
Remove completed tasks from todo list, add info about git/gerrit preference
Removed completed tasks (fstrace subcommand help in-binary and issue with
-noexecute vs. -dryrun in vos delentry) from todo list. Added info about
git/gerrit preference for documentation help, but patches still allowed
to the openafs-doc list.
Simon Wilkinson [Mon, 30 May 2011 16:39:56 +0000 (17:39 +0100)]
src/tests: Fix a couple of build issues
Fix a couple of build problems with the old src/tests directory.
Firstly, now that we're using asnprintf in libauth, we need to include
libroken as a dependency here too.
Secondly, the build rule for dumptool is wrong. Fix it.
Simon Wilkinson [Sat, 14 May 2011 07:37:31 +0000 (08:37 +0100)]
rxperf: -S takes an argument
The -S option to rxperf (which permits the maximum number of server
threads to be set) takes a parameter. Update the getopt string so
that we can give it one.
Simon Wilkinson [Sun, 17 Apr 2011 18:14:01 +0000 (19:14 +0100)]
viced: Rationalise FS_STATS_DETAILED logging
Every RPC handler in the fileserver contained a copy of an identical
code block to handle starting, stopping, and recording detailed logging
statistics. Replace all of this with a structure and 4 helper functions,
which will make maintenance much easier.
Simon Wilkinson [Sun, 24 Apr 2011 19:52:08 +0000 (15:52 -0400)]
viced: Remove old /vice/file/parms config file
This commit removes support for overriding command line options with
the contents of /vice/file/parms. This option has never been documented,
and only supports setting at most 15 command options. Replace the old
function with one which checks for the existence of this file, and
outputs a warning if it is found.
Jeff Blaine [Fri, 27 May 2011 19:49:52 +0000 (15:49 -0400)]
kvno invocation correction, language cleanup, afs/cell principal preferred
Properly show kvno command syntax, add information about preferring
'afs/cell' for the principal over 'afs', and changed "noted this down"
to "made note of"
Simon Wilkinson [Tue, 31 May 2011 07:31:55 +0000 (08:31 +0100)]
vos: print_addrs never receives multi-homed addrs
The magic address that tells the vlserver that a host is multi-homed,
and to look up the multi-homed address structure is an internal
implementation feature, which shouldn't be exposed to clients.
print_addrs is only ever called with the results of VL_GetAddrsU, which
has already converted any multi-homed pointers, so it doesn't need the
logic to handle them itself.
configure should attempt to find the XML tools we need to process
the documentation. if it can't, it should provide a safe default.
still allow the user to override via command line.
Michael Meffie [Fri, 24 Sep 2010 01:18:36 +0000 (21:18 -0400)]
xstat: cope with different size timeval structures
In xstat_fs_test and afsmonitor, try to display the xstat data
from the fileserver even if the fileserver has differently sized
timeval structures, or different word ordering, as the xstat
client program.
Simon Wilkinson [Tue, 19 Apr 2011 07:18:56 +0000 (08:18 +0100)]
Linux CM: Update wait code
Update the wait code to use the more modern wait_event_freezable()
macros. If those macros are not available, fall back to the older
wait_event_interruptible macro, and build our own
wait_event_freezable on top of this.
These changes should simplify our interactions with the wait queue
and refrigerator bits of the kernel, as we're now using more standard
interfaces to them.
Simon Wilkinson [Sun, 17 Apr 2011 22:43:51 +0000 (23:43 +0100)]
Linux CM: Use kernel allocator directly
In another few locations within the Linux portion of the cache
manager, directly use the kernel allocator. We can do so here
because we can guarantee that the amount of memory being allocated
is less than the page size, and there is a kfree() in all of the
exit paths, so we don't need the magic freeing behaviour, either.
Simon Wilkinson [Sun, 17 Apr 2011 22:40:55 +0000 (23:40 +0100)]
Linux CM: Use kernel allocator directly for events
When allocating memory for our events system, use the kernel
allocator directly, rather than going via our shim. This is much
more efficient, but has the drawback that we are now responsible
for freeing our own memory, rather than it all being magically
given back upon shutdown.
Simon Wilkinson [Sun, 17 Apr 2011 20:41:15 +0000 (21:41 +0100)]
Linux CM: Files don't need a page
We were using osi_AllocLargeSpace to allocate our files. This gives
a page to every struct osi_file we create, which seems a little bit
excessive. Just use kmalloc directly instead, and let the kernel's
allocator deal with the slabbing.
Simon Wilkinson [Sun, 17 Apr 2011 19:52:50 +0000 (20:52 +0100)]
libafs: Tidy up iovec allocation and trimming
Tidy up the way that we perform iovec allocation and trimming by
making the rest of the world look a little bit more like Darwin.
This relies upon a struct uio, followed by 16 iovecs, being able
to fit into a SmallSpace sized block. On the majority of 32 bit
systems, such a block is 256 bytes long (on AIX and HPUX it is
152 bytes). With a 32bit size_t, an iovec is 8 bytes, so 16 of
them is 128 bytes, and a struct uio is 24 bytes, giving a grand
total of 152.
linux: rpm: Fix SELinux attributes on /afs when installing openafs-client package
Since the directory /afs isn't included in the package manifest, but
rather created in a script in the openafs-client package, it never
gets the appropriate SELinux attributes that are required to mount a
volume (mnt_t).
This change fixes the problem by running '/sbin/restorecon' (if it is
an executable that exists) on the /afs directory after the
openafs-client package is installed, right after the directory is
created.
Michael Meffie [Tue, 24 May 2011 14:28:37 +0000 (10:28 -0400)]
volinfo: refactor mode variables
Untangle the various global mode variables, which became muddled when dsizeOnly
and saveinodes were introduced. DumpInfo now indicates the default mode and
DumpVnodes means print the vnode entries, not scan but sometimes print. Remove
unused globals.
Michael Meffie [Mon, 23 May 2011 02:53:46 +0000 (22:53 -0400)]
volinfo: refactor volume and vnode handling code
Refactor volume and vnode handling code for better
maintainability. Move the code invoked by -saveinodes to a new
function. Remove an unneeded else clause in HandleVolumes.
Ben Kaduk [Tue, 31 May 2011 19:25:35 +0000 (15:25 -0400)]
Enable gencat for i386_fbsd_*
The machines certainly have a /usr/bin/gencat, and I see nothing
in history to indicate a reason for this prevention.
Allow the 32-bit machines to build afszcm.cat and make packaging
more uniform between architectures.
Simon Wilkinson [Mon, 23 May 2011 05:24:09 +0000 (06:24 +0100)]
vlserver: Add flags to extent address entries
Add a "flags" field to the extent address entry so that we can store
per server bit flag information. Rename the header flags feel (and
corresponding macro) so that it's explicitly a header flag. Take
this opportunity to also fix this comment to clarify that the header
flags are not a copy of anything from the vlentry, but that they
must be at the same structure offset as the vlentry flags field (so
that something accessing an extent block as if it was a vlentry can
see what it is from the flags)
Simon Wilkinson [Mon, 23 May 2011 05:20:35 +0000 (06:20 +0100)]
vlserver: Make space in extent block explicit
The address entry side of the union within the extent addr block
actually has a significant amount of free space. It looks as though
the original author assumed that a UUID required 16 32-bit words,
rather than 16 octets, and sized the structure to match.
Make the free space within the structure explicit, so that it can
be used for future expansion
Simon Wilkinson [Thu, 19 May 2011 18:15:44 +0000 (19:15 +0100)]
vlserver: Rationalise multi homed host processing
The same code for getting extent structures for multi homed hosts
was scattered throughout vlprocs.c, sometimes with error handling,
and sometimes without. Rationalise all of this into a pair of
static inline functions, which do all of the hard work.
Simon Wilkinson [Thu, 19 May 2011 17:56:27 +0000 (18:56 +0100)]
vlserver: Use correct memsets in vlentry convertor
The various vlentry_to_<blah> conversion functions have obviously
been copy and pasted from each other. However, the size of the
structure which is being zeroed has not been updated when we are
zeroing different structures. Fix this, so that we always clear all
of the structure that we are filling.
Simon Wilkinson [Thu, 19 May 2011 17:53:27 +0000 (18:53 +0100)]
vlserver: Clean up abort logic
Clean up the failure logic in the server RPC handlers so that there
is always a single exit point upon aborts. This should make it much
easier to fix the various problems with cleaning up memory when
RPCs fail.
Simon Wilkinson [Thu, 19 May 2011 17:19:29 +0000 (18:19 +0100)]
vlserver: Use correct base value when replacing
When we're removing existing address entries the code calculates
a base and index value for each entry that we're removing an address
from. However, it then _uses_ a previously calculated base value,
with the new index. This works fine if the old base and the new base
match, but if they don't, chaos will ensue.
Simon Wilkinson [Thu, 19 May 2011 16:57:30 +0000 (17:57 +0100)]
vlserver: Rename errorcode to code
The convention in the OpenAFS code is to use 'code' or 'ret' for
return values from functions. Rename 'errorcode' in vlprocs.c to
be in keeping with this convention.
Simon Wilkinson [Thu, 19 May 2011 14:06:15 +0000 (15:06 +0100)]
vlserver: Tidy up request counting
Tidy up the counting of requests and aborts in the vlserver. Don't
hide a variable allocation within a macro, convert macros to inline
functions, and make it possible to not count particular operations
by passing in an opcode of 0.
Simon Wilkinson [Sat, 4 Jun 2011 17:04:48 +0000 (18:04 +0100)]
aklog: Remove Windows specific code from header
When commit 3f54c934b9c933d5f34644a096c821375db17d97 removed all of
the Windows code from aklog, it missed the stuff in aklog.h. Get
rid of this too, for clarity.
Simon Wilkinson [Sat, 4 Jun 2011 15:41:41 +0000 (16:41 +0100)]
ubik: Initialise global version lock before use
Commit e4ac552ab79be21d90397079eaf6be7050497752 introduced a global
version lock to ubik, but doesn't initialise this lock before make use
of it. On platforms which require that pthread mutexes are initialsed,
this causes an assertion failure.
Initialise this lock at the same time as we MUTEX_INIT all of our other
locks.
Michael Meffie [Mon, 13 Dec 2010 19:53:50 +0000 (14:53 -0500)]
xstat: print collection values in debug mode
Print the values of the integers returned in the collection data
when the -debug option is given to xstat_fs_test and xstat_cm_test
test programs. This allows us to at least see what the unformatted
values are when there is a mismatch in timeval sizes between the
host and client (aka the 32/64 bit xstat bug). This change could
break scripts which call the xstat test programs with the debug
option. New debug output are prepended with 'debug:' to be
easily ignored.
This change permits "fs setacl" to change ACLs in a relative
manner, rather than just setting rights absolutely as it is
done now.
If a single plus (+) or minus (-) character is appended to
the rights' letters argument, the new rights are computed
relatively to the existing ones.
A few examples should make clear that behaviour:
old rights: rights set: new rights:
-----------------------------------------------
rl a+ rla
rlid idwa- rl
rla write- a
rl write- [none] (ie. entry deleted)
[any] read= rl
As shown in the last example, a '=' character got implemented
also (and for free) as an alternative writing of the current
and default behaviour of just setting an ACL.
Simon Wilkinson [Wed, 27 Apr 2011 18:24:56 +0000 (14:24 -0400)]
dir: Explicitly state buffer locations for data
DNew and DRead always returned directory page aligned pointers,
however the directory code further manipulates those pointers,
requiring the DRelease be able to fill a page when passed a pointer
to any address within that page. This is relatively straightforward
in the userspace implementation, but much more complex in the kernel,
where all of the directory pages are not necessarily contiguous.
Resolve this issue by making DNew, DRead and DRelease all return a
new structure, struct DirBuffer. This structure contains both a
pointer to the data, and an implementation specific private
pointer to data describing the page containing the address. The
directory code is free to play with the data pointer as it wishes,
as long as the private pointer to the page is passed through intact.
DRelease (and DVOffset) can then simply use the private pointer for
their operations, without having to walk page lists.
This new behaviour also requires changes to the directory functions
GetBlob, FindItem and FindFid which all return pointers to directory
data.
Simon Wilkinson [Tue, 31 May 2011 07:28:51 +0000 (08:28 +0100)]
vos: Don't leak/overflow bulkaddrs
The vos listaddrs command repeatedly reuses a bulkaddrs array. It
zeros it once (without freeing the allocated memory), and then
repeatedly uses it without zeroing in a loop. This means that the XDR
library assumes that a sufficiently large block is already allocated,
doesn't reallocate for the incoming data, or check limits.
This means that if the first call to VL_GetAddrsU returns a set of
addresses smaller than subsequent calls, we'll write past the end
of the array, causing memory corruption.
Fix this by freeing the arrays correctly with each pass of the call.
Adam Megacz [Fri, 23 Mar 2007 19:14:41 +0000 (12:14 -0700)]
make bozo honor -rxbind correctly
Bozo needs to call rxInitHost() rather than rxInit() when -rxbind is
present. This patch causes it to read NetInfo/NetRestrict earlier in
the startup process so it can make that decision.
Derrick Brashear [Thu, 26 May 2011 05:39:18 +0000 (01:39 -0400)]
macos: bulkstat caller reference handling
if bulkstat is called and fakes up vnodes for non-dir cases, it can
guess wrong, and we end up needing to fix up the type by swapping
in a new vnode under the vcache. however, references are tracked on
the vnode, and more importantly, callers can know about the vnode;
unlinking a vcache from a vnode leaves null pointers to blow up on.
thing is, we shouldn't end up with a un-fixed-up vcache in use:
any caller of ProcessFS will notice if the vnode is the wrong type,
and fix it. so in order to reach CStatd, we have to fix it.
the only places where we can get a vcache in use not CStatd are:
FindVCache, LookupVCache, GetVCache where InReadDir. The last happens
only on Linux. LookupVCache doesn't happen anywhere that matters
(CForeign, or we immediately dispose...). FindVCache is only called
somewhere which won't lead to us fixing up during create, but that
vnode isn't returned to callers; we finalize in the result of create
and return the vnode that's linked to the vcache, which will be correct.
so, the only other place we can have a reference which won't immediately
get fixed up is in lookup, across the bulkstat call. if that's true,
and we return from bulkstat a non-CStatd vcache, lookup will fill in the
entry manually. so, if there are references remaining after we do a fixup,
unmark CStatd so the caller (presumably lookup, given the above) will give
back the vcache and retry, getting a corrected vnode as a result, with
the reference on the vnode we want it on.
Christof Hanke [Wed, 25 May 2011 20:16:59 +0000 (22:16 +0200)]
autoconf: add test for typedef'd structs
AC_CHECK_LINUX_STRUCT does not work for structs which are typedef'd.
The gcc will complain with "error: storage size of ‘_test’ isn’t known"
and fail the test.
Thus the new test-macro AC_CHECK_LINUX_TYPED_STRUCT.
Ben Kaduk [Thu, 26 May 2011 05:11:14 +0000 (01:11 -0400)]
FBSD: VIMAGE support
Starting in FreeBSD 8.0, there is support for multiple virtual
network stacks (generally to be exposed to separate jail(8) environments).
It is enabled as a kernel configuration option, so our builds against
GENERIC have not failed, but we fail to build when options VIMAGE
is present. Fix our variable references accordingly.
Change-Id: I679361b8ea62b0eae90c0aa61287dfc2dd189481 Submitted-by: Hiroki Sato of freebsd.org
Reviewed-on: http://gerrit.openafs.org/4721 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: BuildBot <buildbot@rampaginggeek.com>
Andrew Deason [Mon, 23 May 2011 20:42:10 +0000 (15:42 -0500)]
tests: Correctly pass string args in superuser-t
We need to give a NULL pointer for string OUT arguments, so XDR knows
to allocate a new string. Also free the string each time so it gets
set back to NULL.
Andrew Deason [Mon, 23 May 2011 22:11:28 +0000 (17:11 -0500)]
cmd: Fix parsing positional args
If the first parameter of a libcmd syntax is a flag, cmd_Parse was
skipping over positional arguments, since j will be 0 at this point
(the j variable is only used if we're processing an explicit switch).
Effectively revert this area to what it was before a2f1ca5fd52ac2fb7e68b101bbe3da9878c10474 so such positional parameters
work again.
Also move the j variable to inside the only block in which it is used,
to try and avoid such mistakes in the future.
Replace uintptr_t type cast with uintptrsz in afs_vcache.c
A recent change (commit 80fe111f0044aa7a67215ad92210dc72cb7eb2c0)
to afs_vcache.c contains a call to afs_warn() whose second parameter
contains a "(uintptr_t)" type cast as part of a double type cast.
This presents an issue on some systems, such as OpenBSD, where this
object type is defined in a header that is not presently included.
This change modifies that type cast to instead use the AFS-internal
"(uintptrsz)" type which should provide the same effect.
Note that an earlier version of this patch ateempted to remove the
"offending" type cast as redundant but it was pointed out that some
systems require this kind of cascading type cast when casting pointers
to integers to deal with possible size issues.
Michael Meffie [Sat, 21 May 2011 16:38:03 +0000 (12:38 -0400)]
volinfo: fix volume aux totals output
Do not print the volumes aux totals prematurely when running
volinfo with the -headers flag on an namei fileserver. Instead
print the aux totals only once after the link table size is found.
Michael Meffie [Fri, 20 May 2011 17:53:48 +0000 (13:53 -0400)]
doc: document volinfo -filenames option
Add the namei -filenames option to the volinfo man page.
Note this option as implemented implies the -vnode flag, but for
consistency with the other fields that modify the default mode
output, it is documented to be accompany the -vnode flag.
Michael Meffie [Wed, 18 May 2011 17:42:27 +0000 (13:42 -0400)]
volinfo: fix -filenames option check
Fix the logic for checking the presense of the volinfo -filenames
option. The original patch inadvertently added the -filenames
check as an if-else cause to the -orphaned flag check, which
prevents filenames from being printed when listing orphaned
vnodes.
Derrick Brashear [Fri, 20 May 2011 18:13:01 +0000 (14:13 -0400)]
macos: bulkstat redux
simplify the logic which can require sleeps in various vcache
resolution paths. instead of the two-pass system we had before,
just guess using the even/odd hack what type a vnode will be.
if a vnode turns out to be a link and thus we are wrong, we
do a fixup later. other callers who "race" with bulkstat
(which is a supported feature, otherwise you'd have to block
callbacks) will also call through a fixup to get the correct
backing vnode type. this is necessary as the KPI doesn't
let us change the type of a vnode after it's been created.
side effect: eliminate many of the ugly cases where we had been
sleeping waiting for a vnode to be finalized even before bulkstat.
Derrick Brashear [Fri, 20 May 2011 18:10:49 +0000 (14:10 -0400)]
dynroot: mark vnode types on dynroot vnodes
when we create a vnode using a dynroot fid, we weren't bothering
to update the type from the default (typically VREG); most
dynroot vnodes are actually VDIR...
Andrew Deason [Thu, 19 May 2011 22:02:35 +0000 (17:02 -0500)]
SOLARIS: Reset syscalls on mod_install failure
If our call to mod_install fails for any reason (for example, if the
afs entry is missing from /etc/name_to_sysnum), we may still have set
the sysent structures for setgroups and ioctl to point at libafs code.
So calls to those syscalls will cause a panic, since the code they
point to is no longer loaded.
To avoid this, just reset the sysent entries back to what they were if
we fail to load, just like we do when unloading the module.
Andrew Deason [Thu, 5 May 2011 20:10:54 +0000 (15:10 -0500)]
libafs: Implement unixuser RW locks
Currently code dealing with changing unixuser structs does not obtain
any locks protecting the contents of the unixuser struct, though some
functions like afs_GetUser have a parameter indicating what type of
lock should be obtained. This can result in the token data for a user
being changed at the same time another thread tries to use the token
data.
To ensure mutual exclusion of such operations, add a lock field to the
unixuser struct, and actually lock it according to the intentions of
the relevant code.
Andrew Deason [Mon, 16 May 2011 18:45:49 +0000 (13:45 -0500)]
libafs: Always use anonymous VL connections
afs_NewVolumeByName was using the areq given by the caller for
afs_SetupVolume, which may represent authenticated credentials. Give
afs_SetupVolume &treq instead, which will be anonymous, so we don't
have to deal with rxkad for VL lookups.
Jeff Blaine [Thu, 19 May 2011 01:46:52 +0000 (21:46 -0400)]
Hide -noexecute in favor of -dryrun
Makes all previous -noexecute arguments hidden (still callable)
and replaces them with -dryrun whose help text has been made
common where appropriate instead of the 3 previous ways the
argument was explained.
Jeffrey Altman [Wed, 18 May 2011 17:51:53 +0000 (13:51 -0400)]
auth: failback to afs3-vlserver for afs3-prserver
If the DNS SRV lookup is for afs3-prserver or afs3-kaserver,
fallback to a lookup for afs3-vlserver since those services
are traditionally hosted on the same machine as the vlserver.
Andrew Deason [Mon, 16 May 2011 20:02:14 +0000 (15:02 -0500)]
viced: Check vnode length on Rename and Link
Commit 2578555d7e08131bf2fe4cdd0aa4b32567a76eb2 added vnode length
checks when we create or remove vnodes, but not during Rename and Link
operations (when vnodes are neither created nor destroyed). Add the
check in Rename and Link.
Andrew Deason [Thu, 12 May 2011 15:57:09 +0000 (10:57 -0500)]
viced: Enable NAT ping on hosts
Turn on NAT ping on the Rx connection for the callback channel for
hosts. This should help improve behavior for clients behind NATs and
stateful firewalls, even for clients that predate NAT ping
functionality.
Andrew Deason [Fri, 6 May 2011 18:12:17 +0000 (13:12 -0500)]
dasalvager: unlink fsstate.dat when standalone
If the DAFS salvager is running in a standalone mode, unlink the
fileserver's fsstate.dat file if any volumes change. Otherwise, volume
data could have changed and the fileserver will retain callback
promises for the data in those volumes until it tries to attach the
volume. This way, callbacks are broken via callback state
reinitialization.
A better solution is to record which volumes have changed, and the
fileserver can break callbacks for them on startup. But this at least
eliminates a regression from non-DAFS behavior.
Simon Wilkinson [Sun, 24 Apr 2011 19:29:37 +0000 (15:29 -0400)]
cmd tests: Initialise string retval
The cmd_OptionAsString function attempts to free the previous value
of the string passed to it. Make sure that we initialise the return
value to NULL before passing it in in the test suite.
Andrew Deason [Tue, 10 May 2011 19:16:06 +0000 (14:16 -0500)]
libafs: Flush vcaches in afs_shutdown
Currently, a few platforms (linux, linux24, solaris, irix) flush all
vcaches during shutdown. However, they do this before calling
afs_shutdown(), resulting in afs_FlushVCache queueing VCBs and
possibly trying to give the callbacks back to the server.
Instead of this, perform the flushes in afs_shutdown itself, so we do
this after we try to give up all callbacks to all servers, and we do
this while afs_shuttingdown is set, so we don't try to queue VCBs.
This also consolidates some of the duplicated code to flush all
vcaches, and now does this for all platforms.
Andrew Deason [Tue, 10 May 2011 17:54:53 +0000 (12:54 -0500)]
libafs: Do not write-lock afs_xserver on ICBS
Our RXAFSCB_InitCallBackState* handler currently write-locks
afs_xserver when it clears the SCAPS_KNOWN flag for the relevant
server. However, the afs_xserver lock is for protecting the global
list and hash table of server structures, and is not necessary to
acquire in order to modify the flags of an individual server struct.
For instance, CkSrv_GetCaps does not acquire any locks to modify the
server flags.
Taking this lock conflicts with a read lock on afs_xserver acquired by
afs_FlushVCBs when it traverses the list of server structures.
afs_FlushVCBs may contact a server that then calls InitCallBackState
on us, causing a deadlock if ICBS waits for the afs_xserver lock.
So, avoid locking afs_xserver in this case, to avoid that deadlock.