Andrew Deason [Fri, 21 May 2010 21:26:53 +0000 (16:26 -0500)]
vlserver: Allow reading during ubik writes
Turn on the new ubik_BeginTransReadAnyWrite functionality for the
vlserver, which allows us to read data from ubik during a conflicting
ubik write lock. When writing, we now update a copy of the
application-level cache, and write back the changes during a commit.
Andrew Deason [Fri, 21 May 2010 20:54:33 +0000 (15:54 -0500)]
vlserver: Access cache via vl_ctx
The vlserver application-level ubik cache (which consists of
HostAddress, ex_addr, and cheader) is currently being accessed via
global variables everywhere. Instead, access these via the new vl_ctx
struct that is passed to functions during a transaction, so we have
the ability to modify the cache without making all changes visible as
we change it.
Andrew Deason [Fri, 21 May 2010 16:12:50 +0000 (11:12 -0500)]
vlserver: Add a struct for trans-specific data
Instead of passing a ubik_trans pointer to many functions inside the
vlserver, pass a vlserver-defined vl_ctx struct, so we can add new
things to keep track of in a transaction that are not part of ubik.
Andrew Deason [Thu, 20 May 2010 20:22:11 +0000 (15:22 -0500)]
ubik: add interface for reading during write locks
Add ubik_BeginTransReadAnyWrite, which allows for reading from the
database, even while there is a conflicting ubik write lock. Reads are
still blocked while the local database is updating due to a write
transaction commit.
Andrew Deason [Tue, 22 Jun 2010 19:36:42 +0000 (14:36 -0500)]
ubik: Fix buffers for reading-during-writes
If we are reading while a write transaction is in progress, we can
encounter a buffer that is dirty if we're on the same site as the
writer. Ignore these buffers for readers, since they contain
uncommitted changes. Then, when the writer commits, invalidate the
resultant duplicate buffer, if one exists.
Andrew Deason [Tue, 22 Jun 2010 18:24:27 +0000 (13:24 -0500)]
ubik: Abstract buffer matching and pass trans ptrs
Abstract the code for matching buffers in DRead, and pass around
ubik_trans pointers instead of ubik_dbase pointers. This changes no
behavior, but makes changing ubik buffer code a bit easier.
Simon Wilkinson [Sat, 21 Aug 2010 11:05:37 +0000 (12:05 +0100)]
Don't include afsconfig.h in rxgen headers
Some headers generated by rxgen are installed. We can't use
afsconfig.h in installed headers, as it isn't installed (and it
shouldn't be, as it contains autoconf defines which will almost
certainly have namespace conflicts with other packages)
Revert the portion of 972a407 that added afsconfig.h to the
h_output function. This should now be safe as stds.h no longer
relies on the result of autoconf tests.
Marc Dionne [Fri, 20 Aug 2010 20:11:59 +0000 (16:11 -0400)]
s390x: only declare afs_sys_setgroups32_page where needed
Variable afs_sys_setgroups32_page is only used when __NR_setgroups32
is not defined. Make the declaration depend on it as well to clear
up an unused variable warning.
Simon Wilkinson [Thu, 19 Aug 2010 23:18:17 +0000 (00:18 +0100)]
hcrypto: Fix for IRIX
Fix the hcrypto build for IRIX, by including param.h in the
configuration header so that the platform specific redefinitions of
"inline" work correctly.
Andrew Deason [Thu, 22 Apr 2010 22:09:18 +0000 (17:09 -0500)]
Remove the global tempHeader/stuff structures
Currently, volinodes.h defines an array ('stuff') for easily accessing
information about different inode types. Part of the array points to
parts of a global 'tempHeader' structure, making this not threadsafe.
Change this into an interface which utilizes local storage to make
this threadsafe and remove those horridly-named global variables.
This adds the init_inode_info static inline function, for initializing
a local inode information table.
Andrew Deason [Thu, 24 Jun 2010 20:45:05 +0000 (15:45 -0500)]
vol-salvage: Move global vars into SalvInfo struct
Reduce the number of globals used in the salvager code, by making
functions pass around a 'salvinfo' structure that contains the
information regarding a particular salvage.
Jeffrey Altman [Mon, 16 Aug 2010 14:09:22 +0000 (10:09 -0400)]
Windows: prevent buffer overrun in cklog
The Windows version of klog.exe will overwrite the realm and
password buffers if the command line input is too long. Generate
an error and terminate the program instead.
Chaz Chandler [Wed, 4 Aug 2010 18:17:03 +0000 (11:17 -0700)]
autoconf detection of label support
acinclude.m4 now has struct label support detection and sets
HAVE_STRUCT_LABEL_SUPPORT in afsconfig.h. Obviates complicated
ifdefs in various src/afs/ and src/rx/ files. Must run regen.sh
to generate new configure and afsconfig.h.in, then configure will
detect label support and set afsconfig.h appropriately. Not sure
what to do for Windows, but should be a step in the right
direction.
Fixes issue with compilation of libuafs on IRIX and sunpro by accurately
detecting label support.
Marc Dionne [Thu, 12 Aug 2010 20:33:04 +0000 (16:33 -0400)]
Linux: avoid oops in memcpy_toiovec
With ADAPT_PMTU enabled, kernel_recvmsg can be called to receive
errors. The call is made with no iovec supplied (we pass a NULL
pointer), but with a size of 256. In the kernel, the memcpy_toiovec
function tests for size > 0, and proceeds to check iovec->iov_len,
which causes an oops. Fix by setting the size to 0.
Marc Dionne [Wed, 11 Aug 2010 23:28:53 +0000 (19:28 -0400)]
Linux: Rework statfs super block operations configure test
The configure test to detect if the statfs super block operation
needs a dentry argument is based on vfs_statfs, and assumes that
its signature matches the one of the operation. In 2.6.36 this is
no longer true and the test fails.
Rework the test to actually test the operation we're interested in.
Marc Dionne [Wed, 11 Aug 2010 22:55:29 +0000 (18:55 -0400)]
Linux: switch to evict_inode
In 2.6.36, the delete_inode and clear_inode inode operations
are replaced by evict_inode.
Rename our current clear_inode to evict_inode, and add a few
things that were previously handled by the generic delete_inode.
Marc Dionne [Wed, 11 Aug 2010 22:20:59 +0000 (18:20 -0400)]
Linux: adapt to truncate sequence changes
As part of changes to the truncate sequence, inode_setattr() no
longer exists, and all filesystems have to define the setattr op
so we can assume that it is not NULL.
Introduce a compat inline function afs_inode_setattr that hides
the tests and the different versions from the main code.
Note that the existing test for the inode_setattr() return type
will fail, but the value is no longer used in that case.
Marc Dionne [Wed, 11 Aug 2010 21:18:32 +0000 (17:18 -0400)]
Linux: use %pI4 if NIPQUAD is not available
The definition of NIPQUAD has been removed from the kernel headers
in the mainline kernel. Replace it by using the %pI4 format
specifier which takes the IP address as a single argument.
Andrew Deason [Tue, 10 Aug 2010 19:16:39 +0000 (14:16 -0500)]
viced: VNOVOL on deleted volumes
When the volserver deletes a volume, the fileserver should respond to
future access to that volume with VNOVOL and not VOFFLINE, since the
volume doesn't exist anymore. Do this in DAFS via a new state,
VOL_STATE_DELETED, and in non-DAFS by just setting specialStatus to
VNOVOL.
In the future we should also make sure the vp's for deleted volumes
get freed after a couple of hours, but not yet.
Andrew Deason [Fri, 6 Aug 2010 19:32:16 +0000 (14:32 -0500)]
volser: Ignore duplicate file tags when restoring
Currently, if the volserver encounters multiple file tags for a vnode
when restoring a volume dump, it will create extra vnodes which are
not recorded anywhere, and are leaked when the volume is removed.
Instead of doing that, ignore any duplicate file tags that are
encountered (which is what happens with other tags), and log a
warning.
Simon Wilkinson [Wed, 11 Aug 2010 22:14:31 +0000 (23:14 +0100)]
LINUX: More flock fixes
Turns out the we have two almost identical lock routines on Linux,
one for POSIX locks, and one for flocks. Fix them both. Also,
while we're at it, make the same fixes in the LINUX24 tree.
this is a short-term hack. macos lacks pags, and anywhere without
pags won't have tokens when fs discon online is run as root unless
the tokens are explicitly set for root... which can be bad mojo.
Simon Wilkinson [Wed, 11 Aug 2010 16:25:36 +0000 (17:25 +0100)]
LINUX: Use correct type of error in flock code
The flock code gets a kernel error code from afs_posix_lock_file()
but then passes this error code through afs_convert_code (which sees
that it is already negative, and returns EIO). Instead, we should just
return afs_posix_lock_file()'s code direct to our caller.
Jeffrey Altman [Wed, 11 Aug 2010 05:10:38 +0000 (01:10 -0400)]
Windows: cm_Analyze should treat VOFFLINE like VMOVED or VNOVOL
Volume package bugs in the file server can result in VOFFLINE
being returned to the client instead of VNOVOL or VMOVED. As
a result the Unix CM treats VOFFLINE the same as VMOVED and VNOVOL.
The Windows client has not. As a result, bugs in the file server
can cause the Windows client to lose if the volume has in fact
been moved to another server.
As part of this change, the volume location list is updated prior
to the volume status being applied to the server from which the
error was received.
Andrew Deason [Tue, 27 Jul 2010 21:22:47 +0000 (16:22 -0500)]
salvage: update inodes array after CopyAndSalvage
CopyAndSalvage makes a copy of the directory to salvage it. So, the
new directory will have a new inode. Update the array of directory
inodes to reflect this. Without this, we can fail to alter the
copied/salvaged directory later on, since we will try to read/write to
the wrong inode.
Andrew Deason [Wed, 28 Jul 2010 17:00:37 +0000 (12:00 -0500)]
salvage: Zero corrupted header
In the salvager, if we read in a corrupt header (either we get a short
read or the magic is mismatched), make sure we zero out the contents,
so we don't read garbage further on.
Andrew Deason [Wed, 4 Aug 2010 16:19:35 +0000 (11:19 -0500)]
rxgen: Error out if cpp exits with error
If we call 'cpp' and it returns with an erroneous exit code, exit with
an error ourselves. Otherwise we will return success and generate
empty results even if the input file is unreadable, for instance,
which causes confusing errors later in the build.
Jeffrey Altman [Thu, 5 Aug 2010 05:43:24 +0000 (01:43 -0400)]
Windows: optimize buf_FlushCleanPages
If the pages to be flushed are from a readonly or backup volume
they can't be dirty. In this case there is no need to stabilize
the pages before they are locked and recycled.
Stablilization is performed on the cm_scache_t object so do not
stabilize and unstablize for each cm_buf_t object.
Andrew Deason [Thu, 5 Aug 2010 03:49:29 +0000 (22:49 -0500)]
Unix: docbook revision tag requires a date
The docbook DTD requires a <revision> element to contain a <date>
element. So make a blank <date> one even though we don't keep track of
a date, so we can pass xmllint.
Andrew Deason [Tue, 3 Aug 2010 22:32:11 +0000 (17:32 -0500)]
Add DAFS docs to the Unix Quick Start guide
Modify the sections dealing with creating the 'fs' bnode to also
mention how to create the 'dafs' bnode, and add an appendix explaining
DAFS and the differences between DAFS and non-DAFS.
Andrew Deason [Thu, 29 Jul 2010 19:47:03 +0000 (14:47 -0500)]
util: add afs_exec_alt
Add the function afs_exec_alt to help programs easily execute an
"alternate" version of themselves. For example, for programs that are
built with/without DAFS support, or are built for 32-bit/64-bit
structures, etc.
Jeffrey Altman [Tue, 3 Aug 2010 03:28:39 +0000 (23:28 -0400)]
Windows: Reduce complexity of Freelance Callback Logic
Over the years the processing of the Freelance callbacks have
added functionality that behaves much more like FetchStatus checks
to a file server. If the data version of the object has changed,
get the new data. Given that is the case, we can remove much of
the original refresh logic that is rather race prone. Say goodbye
to cm_fakeGettingCallback and cm_fakeDirCallback.
Jeffrey Altman [Mon, 2 Aug 2010 20:06:39 +0000 (16:06 -0400)]
Windows: When processing pioctl paths ensure callbacks are obtained
When processing a pioctl path with either smb_ParseIoctlPath or
smb_ParseIoctlParent, cm_SyncOp(CM_SCACHESYNC_NEEDCALLBACK|GETSTATUS)
must be called on the cm_scache_t object to ensure that it is up
to date before we permit cm_Lookup or other operations to be performed
on it. Add the cm_SyncOp() call to smb_ParseIoctlPath and
smb_ParseIoctlParent to ensure it is done for all pioctl operations.
Windows: Don't configure client when not installing client
The 32-bit tools installer was displaying client configuration wizard
pages. Since, the 32-bit tools share configuration with the AFS
service, the 32-bit tools installer should not be attempting to change
client configuration. Remove said wizard pages from the 32-bit tools
installer.
Andrew Deason [Fri, 30 Jul 2010 20:32:53 +0000 (15:32 -0500)]
ptserver: Do not use cell for entry name len check
Do not use the local cell name when determining if a new entry name is
too long. This check assumes that foreign cells will use our local
cell name (assumed to be our local Kerberos realm) in a certain way,
and prevents creating users that will make those names too long.
This is undesirable for several reasons. One is that the local realm
name may not be the same as the local cell name (and we may have many
local realms). Another is that we cannot reliably predict how foreign
cells will construct foreign pt entry names, so preventing entry
creation based on that may prevent names that will never cause any
problems. This check also assumes that our names will be used as
foreign entries in other cells, which may not be the case.
So, remove the check based on the local cell name, and remove the
pr_realmNameLen variable while we are at it, since this is all it is
used for.
Thanks to Jeffrey Altman for discussion, and for bringing this up in
the first place.
Windows: Do not reference cm_data.rootSCachep directly
cm_data.rootSCachep is a global pointer to the cm_scache_t that
represents the root.afs volume root directory. Throughout the
code this cm_scache_t was being used without ensuring that a
callback to the volume is in fact valid.
Under most circumstances this would not be a problem. However,
it is possible for a request to fail due to the lack of a callback
at a critical moment. Add a new function cm_rootScachep() that
attempts to ensure that a callback is present (if possible) prior
to use the cm_scache_t object.
Windows: Update root.afs scache dv when Freelance dir bufs are regenerated
When the contents of the Freelance root directory changes the fake
directory buffers are updated and a fakeDirVersion is incremented.
The dataVersion of the cm_scache_t object is supposed to be updated
on the next access by performing a fake get callback request.
Unfortunately, this did not always occur because of a race. If another
Freelance object is updated first, the root directory object would
never successfully get a fake callback.
This patchset ensures that the generation of the fake directory
buffer content and the callback are obtained under the same set
of locks thereby removing the race.
Andrew Deason [Mon, 2 Aug 2010 05:44:37 +0000 (00:44 -0500)]
SOLARIS: let xlator load if amd64/nfssrv is loaded
The NFS translator-enabled kernel module refuses to load if
misc/nfssrv is not also loaded. We were only checking misc/nfssrv and
misc/sparcv9/nfssrv, though, not misc/amd64/nfssrv. Check that, too,
as it may be loaded on amd64 machines.
Skip over 'fragments' directory when scanning for PODs
The generate-html script scans the directories to compile a list of
POD files. The list of candidates include the 'fragments' directory,
which causes an error when the script attempts to open it as a file.
Andrew Deason [Fri, 30 Jul 2010 17:03:06 +0000 (12:03 -0500)]
ptserver: Allow longer foreign user names
The ptserver was restricting all names to be less than PR_MAXNAMELEN -
pr_realmNameLen - 1, so that the local realm and a '@' can be safely
appended for foreign user registration. This check is overly
restrictive for foreign users, since the local realm will never be
appended to the user name (it already has the foreign realm name
appended). So, just check for PR_MAXNAMELEN for foreign users.
Andrew Deason [Thu, 29 Jul 2010 17:43:25 +0000 (12:43 -0500)]
Remove bless-related options from vos manpages
'vos online' and 'vos offline' were documented as taking -bless and
-unbless options, respectively. They do not actually take these
options, and since adding that functionality, while useful, will
require protocol changes, they are likely to take some time to appear.
Andrew Deason [Wed, 28 Jul 2010 22:10:10 +0000 (17:10 -0500)]
viced: Correct unblessed attach2 errors
Don't set the vp to NULL; instead just go to the general error
handling code. When a volume is not blessed, we just want it to go
offline, not go into an error state. Furthermore, we must free the
volume header when nUsers is set to 0, so manually do so when we do
not call VRequestSalvage_r.
Andrew Deason [Wed, 28 Jul 2010 22:47:21 +0000 (17:47 -0500)]
vol-bless: Detach, not put, volumes on completion
vol-bless was just calling VPutVolume when it was done blessing or
unblessing a volume. Instead call VDetachVolume, so we actually give
the volume back to the fileserver when we are done if !nofssync.