Matt Benjamin [Sun, 29 Aug 2010 19:06:22 +0000 (15:06 -0400)]
cache bypass Also increment page refcount in readpage
As noticed by a commenter, afs_linux_bypass_readpage needs
the same get_page operation as in afs_linux_bypass_readpages,
as background page accounting assumes we have done it.
Matt Benjamin [Fri, 27 Aug 2010 23:11:32 +0000 (19:11 -0400)]
DFBSD update dfbsd userland
Add new sysnames. Fix some userland header inclusions,
defend against kernel-mode ioctl interpretation when
building UKERNEL. Add fragments missing from DFBSD
MakefileProto template.
Matt Benjamin [Sun, 29 Aug 2010 21:33:03 +0000 (17:33 -0400)]
FBSD try-relax child vnode locking (recurse only)
In cases where afs_vop_lookup would return a child vnode
locked, continue to take an exclusive lock, but allow
recursion (LK_CANRECURSE). Allow recursion also at
afs_vop_link, where we specifically encountered a conflict
due to recursion.
Matt Benjamin [Sun, 29 Aug 2010 00:43:41 +0000 (20:43 -0400)]
FBSD, DFBSD (future) vnode_pager_setsize updates
Based on review of bundled filesystems on FBSD and DFBSD,
call vnode_pager_setsize in three unhandled cases (getattr,
setattr, and io growing a file; truncation was handled
correctly already). Following up on a suggestion by Ben
Kaduk.
Marc Dionne [Sat, 28 Aug 2010 19:50:04 +0000 (15:50 -0400)]
Make hcrypto depend on config
hcrypto needs the top-level include structure to be present so it
can install its header files. Add a dependency to "config" in
the Makefile to make this explicit and prevent occasional failures
with parallel builds.
Change-Id: If588d6a15fa1fdf371ec2841cc3a6e75077cccb0
Reviewed-on: http://gerrit.openafs.org/2620 Tested-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
Matt Benjamin [Fri, 27 Aug 2010 02:54:20 +0000 (22:54 -0400)]
FBSD restore old syscall register logic for older kernels
The syscall_register code appears to depend on coordination
with FreeBSD upstream, which hopefully can be completed by
RELENG_9. Use the original code for installation of the AFS
syscall everything older than that.
Simon Wilkinson [Sun, 14 Feb 2010 01:14:54 +0000 (01:14 +0000)]
Add new SetTokenEx pioctl
This change implements the new, XDR based, SetTokenEx pioctl. This
pioctl permits sending multiple tokens, of multiple types, into the
kernel in a single pioctl call. This patch provides a kernel
implementation of the pioctl, and a new library function
ktc_SetTokenEx, which will use either the new pioctl, or fall back
to the old one should SetTokenEx not be available.
Simon Wilkinson [Sun, 7 Feb 2010 14:15:26 +0000 (15:15 +0100)]
Make unixuser's vid advisory
The 'vid' element of the unixuser structure was performing two
functions. It was used in debug messages to clarify which user's
token had expired and, in a few locations, to signify whether the
user had tokens or not.
This patch removes this dual usage. 'vid' is renamed to viceId, so
all uses are found and fixed. Where it is used for debugging, it remains,
but we only set the viceId for a user when we first use an rxkad token
on that context. Other uses of 'vid' have been replaced with tests
against the UHasTokens flag in the user's states.
Simon Wilkinson [Fri, 5 Feb 2010 11:12:45 +0000 (11:12 +0000)]
Unix CM: Generalise token storage
This generalises token storage in the Unix CM, so that it isn't
rxkad specific. We add a new, dynamically allocated, list of tokens
hanging off each unixuser structure. Each token is expressed as
a discrimated union keyed on the security class of that token,
with the token's details contained within that Union.
All token handling is performed through a set of functions in
afs_token.c - token access is modified to use this interface
throughout the rest of the code.
Ben Kaduk [Thu, 26 Aug 2010 03:21:30 +0000 (23:21 -0400)]
FBSD: properly register our syscall
Use the provided interface, syscall_register(), instead of
manually tweaking the sysent table.
Starting afsd will still fail at present on FreeBSD HEAD
without an additional kernel patch to syscalls.master.
Matt Benjamin [Wed, 25 Aug 2010 20:19:18 +0000 (16:19 -0400)]
FBSD: give osi_NetReceive time to shutdown, reprise
The delay logic needs to follow soshutdown, and precede
soclose. The thread in osi_NetReceive is racing to do
another soreceive. That thread needs to win the race
and notice the socket is shut down before rx_socket is
torn down.
Matt Benjamin [Wed, 25 Aug 2010 07:34:35 +0000 (03:34 -0400)]
FBSD CM: don't call afs_close when recycling
Don't call afs_close when handling VOP_CLOSE on a recycled
vnode, since there was no matching open. This corrects the
opens count, which was seen to go have gone negative in the
reclaim vop. For clarity, assert if afs_vop_close is entered
with a VI_DOOMED vnode and avc->opens != 0.
Andrew Deason [Mon, 23 Aug 2010 17:55:21 +0000 (12:55 -0500)]
venus: make cacheout build again
Make src/venus/cacheout buildable again, by fixing several compiler
errors and warnings. Also clean up a few small things, like adding
'static' qualifiers.
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.