Marc Dionne [Tue, 22 Nov 2011 02:27:06 +0000 (21:27 -0500)]
Linux: make sure backing_dev_info is zeroed
The afs backing_dev_info structure is allocated dynamically
without zeroing out the contents. In particular there's no
guarantee that congested_fn is NULL, causing spurious oopses
when bdi_congested in the kernel tries to call it.
Marc Dionne [Sat, 29 Oct 2011 23:23:07 +0000 (19:23 -0400)]
Linux: 3.1: update RCU path walking detection in permission i_op
The permission() inode operation changed again with kernel 3.1,
back to the form it had before 2.6.38. This compiles fine,
but is missing the new way of detecting when we get called in
RCU path walking mode, resulting in system hangs.
Russ Allbery [Tue, 23 Aug 2011 19:50:55 +0000 (12:50 -0700)]
Generate stub header files for h/*.h files included in libuafs
Previously, the libuafs build created a symlink from h to
/usr/include/sys so that files included under h/* by kernel source
files could be found in the normal system header location. However,
this assumption about the system header location is no longer valid.
Debian and Ubuntu systems with multiarch have arch-specific include
paths so that the same host can be used to build 32-bit and 64-bit
binaries with different system headers, and those include paths are
automatically searched by the compiler. This means some standard
headers are no longer found directly in /usr/include/sys but are
instead found in /usr/include/<arch>/sys.
Using a stripped-down version of similar code for building the kernel
module on Linux, create an h directory containing stub header files
that just include the relevant system <sys/*.h> header file instead.
This allows the compiler to implement its normal internal header
search algorithm.
Also remove all the other symlinks, such as sys, netinet, etc., that
just pointed to the same directories under /usr/include. We can assume
the normal compiler search algorithm will find these headers without
requiring this assistance.
Simon Wilkinson [Mon, 15 Aug 2011 09:25:27 +0000 (10:25 +0100)]
rpm: Update CellServDB
The commit (a5d66d05fa0308d505de8bde59442e29be9d04f8) which updated
our in-tree copies of the CellServDB for the 14th August release
failed to update the copy that's referenced from the rpm spec file.
Update the filename used here so that rpms also get to have an
up to date CellServDB
Derrick Brashear [Mon, 15 Aug 2011 16:17:06 +0000 (12:17 -0400)]
macos: fix race in afs_root
same race on PutVCache in afs_root as we had on other platforms,
for instance FreeBSD. use a local variable instead to avoid the race.
additionally, make sure we end up with the root flagged VROOT.
Jeffrey Altman [Mon, 15 Aug 2011 04:23:57 +0000 (00:23 -0400)]
Windows: Save Wix config at start if possible
Save the current configuration at the start of the install
process so the user can be presented with a dialog prior
to installation asking whether the existing or saved
configuration should be used or whether a new configuration
should be created.
Jeffrey Altman [Sat, 13 Aug 2011 18:35:53 +0000 (14:35 -0400)]
Windows: Insert Server Reference List changes
When inserting a new cm_serverRef_t object into a server list
perform the following operations:
1. take advantage of the fact that the cm_serverLock is held
exclusively to purge the list of any deleted entries that
could not be removed previously.
2. check to ensure that the item that is being added does not
already exist in the list. If it does, discard it.
Jeffrey Altman [Fri, 12 Aug 2011 23:02:48 +0000 (19:02 -0400)]
Windows: Fix cm_serverRef ref counts
Use Interlocked operations consistently
Simplify cm_ServerInsertList(). It no longer increments the
refCount on the serverRef object. Instead it leaves the refCount
as is. Its the caller's responsibility to add a reference if
required.
Add reference counts and hold locks in places where the
volume server list was used unprotected.
Garrett Wollman [Sat, 13 Aug 2011 22:51:02 +0000 (18:51 -0400)]
libafs: don't call afs_PutDCache(NULL) in afs_GetDownD()
It's possible for an eviction candidate to be omitted by the small
for loop (around line 670), leaving its reference in victimDCs
set to NULL. In the big for loop that follows, don't call
afs_PutDCache() when we hit one.
Found-by: clang static analyzer with help from AFS_NONNULL
Reviewed-on: http://gerrit.openafs.org/5260 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 10d27341808be41b29fbcc09b8bd7523c3b7a541)
Simon Wilkinson [Fri, 15 Apr 2011 18:40:45 +0000 (19:40 +0100)]
dir: Protect against circular hash chains
The dir package didn't protect against circular hash chains when
performing directory lookups. A corrupt directory could therefore
cause a client or a fileserver to go into an endless loop if that
directory contained a loop in its hash chain pointers.
Fix this by exiting the lookup if the hash chain has more elements
than the total number of entries in a directory. This maximum number
of entries is taken as being (number of entries per page) * (max
number of pages), which is considerably more than the real maximum
value.
(cherry picked from commit bb25bdfcb059fc54a57fd4733ce3184e231ca88d)
Simon Wilkinson [Sat, 16 Jul 2011 22:30:59 +0000 (23:30 +0100)]
libafs/dir: Verify directory pathnames
Provide a new routine, GetVerifiedBlob() which will ensure that the
pathname contained within a directory blob is correctly terminated
before returning it to the caller. For the purposes of this function,
correct termination is defined as having a terminating \0 character
within the same directory page as the blob itself.
(cherry picked from commit d1946ffe9be0031a2daf907f5e96cf0ee7f5e15e)
Andrew Deason [Thu, 5 May 2011 16:18:08 +0000 (11:18 -0500)]
libafs: Get rx conn ref with afs conn ref
When we get a reference to an afs_conn with afs_Conn and its variants,
we assume we can use the tc->id rx connection without holding any
locks. However, if tc->forceConnectFS gets set, the tc->id connection
can be destroyed and recreated out from under us. So, to avoid using a
possibly freed rx connection, grab a reference to the rx connection at
the same time as we grab a reference to the afs conn. And also put
back the same reference with afs_PutConn.
Andrew Deason [Fri, 22 Jul 2011 21:09:52 +0000 (16:09 -0500)]
libafs: Avoid duplicate afs_Analyze in bulk stat
In afs_DoBulkStat, we can call afs_Analyze multiple times for the same
set of connection objects. Since afs_Analyze puts its reference to the
given afs_conn and rx_connection structures, calling it more than once
can cause the reference counts on those objects to be lower than they
should be.
Instead of making another afs_Analyze call, just alter the error code
inside the normal do/while afs_Analyze loop, so the 'loop' afs_Analyze
call gets the appropriate error code from the first bulk stat'd entry.
Jeffrey Altman [Sun, 7 Aug 2011 18:11:17 +0000 (14:11 -0400)]
Windows: make osi_Log macro safe for if..else
wrap the osi_Log macro's internal if statement with
a do {...} while(0) block in order to ensure that
it is safe for use in if..else controls without bracing.
Jeffrey Altman [Thu, 4 Aug 2011 21:25:01 +0000 (17:25 -0400)]
Windows: adjust scache LRU postion upon deletion
If the object represented by a scache object is deleted,
update the LRU position of the scache object to make it
the first object in the LRU queue to be recycled. This
preserves the cached objects for those that might prove
useful in the future.
Instead of using malloc() and free() to allocation lock reference
structures, cache allocated objects in a free list. This reduces
memory fragmentation.
Jeffrey Altman [Thu, 4 Aug 2011 21:08:45 +0000 (17:08 -0400)]
Windows: after dir enum adjust dir scache LRU
During a directory enumeration the directory scache object
is reference counted so it can't be recycled. However, if
there are more directory entries than the maximum number
of cached scache objects the directory scache object will
end up being the next object to be recycled after the refcount
is dropped. Since the directory is clearly a hot object, before
dropping the reference, adjust the scache LRU position so that
it is the last object to be recycled.
Fix the variable name for the directory scache to be 'dscp'
for consistency.
Will Maier [Sun, 31 Jul 2011 13:24:12 +0000 (14:24 +0100)]
RedHat: Return status values from client init
The init script provided with OpenAFS always returns 0 when the status
subcommand is called, even if the service is not running.
For example:
$ sudo service afs status; echo $?
afsd is stopped
0
This change makes sure the init script exits with the value returned
by the status function from /etc/init.d/functions. With this patch,
the afs init script behaves as expected when used, for example, in a
Chef service resource:
$ sudo service afs status; echo $?
afsd is stopped
3
Andrew Deason [Fri, 29 Jul 2011 21:44:11 +0000 (16:44 -0500)]
SOLARIS: Do not release NULL root vp on unmount
When we unmount, and afs_globalVp is NULL (e.g. because root.afs was
unavailable when the client was started), we will panic the machine if
we try to release it. So, if afs_globalVp is NULL when we hit our
unmount handler, don't touch it.
Simon Wilkinson [Wed, 3 Aug 2011 17:45:01 +0000 (18:45 +0100)]
volser doesn't depend on tviced, but on vlserver
Nothing within the volser/ directory depends on tviced, so remove the
unecessary dependency. Add an explicit dependency on vlserver, so that
libvldb is available to us.
This is required to get rid of some potential circular loops when we
start including volser objects in libafsauthent
Garrett Wollman [Sun, 7 Aug 2011 03:15:14 +0000 (23:15 -0400)]
vos: don't free stack garbage on error
If wantExtendedInfo is true, then pntr is used uninitialized.
In the other case, UV_ListVolumes will have set it to NULL
before doing anything (even if it returns an error), so this
free() is dead anyway.
Garrett Wollman [Sun, 7 Aug 2011 03:49:10 +0000 (23:49 -0400)]
butc: avoid testing stack garbage; remove dead initializer
"code" is unconditionally set early in saveDbToTape() so there's
no need to initialize it. On the other hand, dumpEntry.id is used
before dumpEntry is initialized, so set it to what appears to be
the expected value before any non-local exits could cause it to be
inspected.
Set the executable bits on the libraries installed in libdir. This
change is important because it causes 'rpmbuild' to generate Provide
tag metadata for the libraries in the package, which is necessary now
that some binaries in other packages have generated Requires tags for
libraries packaged in the base package. 'rpmbuild' will not generate
the Provides tag if the libraries lack executable permission.
Andy Cobaugh [Fri, 15 Jul 2011 16:06:12 +0000 (12:06 -0400)]
rpm: remove postinstall message from openafs-client
Printing out information on how to configure cacheinfo and ThisCell
is a bit noisy, and pam_afs.so is probably not what most people
want to use nowadays.
Reviewed-on: http://gerrit.openafs.org/5026 Reviewed-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk> Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 30cd8dafa73d90a943f00af05e4841699bc18534)
Simon Wilkinson [Tue, 12 Jul 2011 00:45:10 +0000 (01:45 +0100)]
rpms: Fix handling of x86 architectures
Once upon a time, our specfile would assume that if you were
building for i386 you were building userspace, and that i586 or i686
implied doing a kernel only build. This is no longer the case, and
now everything on modern Fedora is built for i686, so we should adapt
the spec file for this.
Garrett Wollman [Tue, 9 Aug 2011 01:18:15 +0000 (21:18 -0400)]
kdb: don't dereference a null pointer on corrupt database
When iterating through the database, kdb would dereference a
null pointer if it encountered an error retrieving the value
or if the value was not the right length, in code that was clearly
cut-and-pasted from the other branch of an "if" statement where a
specific entry was requested on the command line. Print the name
of the entry with the problem as was apparently intended.
Garrett Wollman [Wed, 10 Aug 2011 04:18:28 +0000 (00:18 -0400)]
FBSD: catch up with the disappearance of VOP_GETVOBJECT
The vnode operation VOP_GETVOBJECT disappeared in FreeBSD 6.0, an
embarrassingly long time ago. Six years ago, a kluge was added
to emulate its behavior, but it did not correctly emulate the
return value of the old VOP implementation. As a result,
osi_VM_StoreAllSegments() could never actually do anything. Since we
don't support FreeBSD before 8.0, remove all references to VOP_GETVOBJECT
and examine vp->v_object directly instead.
This has the result that osi_VM_StoreAllSegments() will actually do
something now, which may not be desirable. (Previously, if somehow
the vnode had no associated VM object, it would crash, and otherwise
it would do nothing at all.)
Jeffrey Altman [Mon, 1 Aug 2011 15:05:51 +0000 (11:05 -0400)]
Windows: conditionalize mappings of error values
Visual Studio 10 adds a large number of additional POSIX C99
error values to errno.h. Wrap each mapping with #ifndef to ensure
that we do not redefine the C runtime errno.h definition.
Jeffrey Altman [Mon, 1 Aug 2011 15:00:55 +0000 (11:00 -0400)]
Windows: unified afs errors must use nt mapping
On Windows, error.h does not provide a complete list of POSIX
C99 error values. OpenAFS fills in the gaps with a private
error mapping table afs/errmap_nt.h (src/util/errmap_nt.h).
If errmap_nt.h is not included prior to processing unified_afs.h,
values such as ELOOP will be mapped to EIO instead of the unique
value defined by errmap_nt.h.
If a cm_BkgDaemon thread finds a queued request whose cm_scache_t
has the CM_SCACHEFLAG_DELETED flag set, do not execute the request
and fail it immediately with CM_ERROR_BADFD. Any attempt to execute
the request will fail with VNOVNODE from the file server.
Windows: cm_BkgDaemon should not do cm_SyncOp's job
cm_SyncOp is designed to synchronize operations among multiple
threads. The background daemon threads should not filter requests
based upon cm_SyncOp states. Doing so is racy and does not produce
better performance.
If the cm_scache_t flags include CM_SCACHEFLAG_DELETED, do not
bother releasing an outstanding file lock to the file server.
The lock went away when the file was deleted. Any attempt to
release will fail with VNOVNODE which is translated locally into
CM_ERROR_BADFD.
If a RXAFS_ReleaseLock RPC fails with VNOVNODE, treat it as
success.
Add PERL variable to the build system. If not specified
externally the variable will be set to 'perl'. However,
ActiveState Perl should be used and not Cygwin Perl. The build
environment should indicate that by specifying a PERL setting.
On Windows, the git repository is checked out as CR-LF.
Tell perl to open the pod file with cr-lf as the end of line.
On Windows, the input file names are of the form podX\foo.pod.in.
Cygwin perl cannot parse the directory for the file name unless
the path separator is converted from \ to /.
The userrealm string in KFW_AFS_get_cred() should not include
the '@' symbol from the user principal. Including the '@' produces
an invalid realm name.
Add KTC and PT error messages to those that can be
translated within afskfw.lib. This improves the error
logging for afslogon.dll, afscreds.exe, and afssrvadm.exe
When computing whether or not to perform an offline volume
check it is critical that the 'lastBusyVolCheck' variable
be assigned the current time instead of 'lastVolCheck'.
By setting the wrong variable a new offline volume check is
performed every 10 seconds which is undesireable.
Add an explicit message that the shutdown sequence is complete.
This is necessary because during a Windows OS shutdown, the service
is frequently killed prior to the memory mapped file is fully released.
because of how the root fid is created we can end up being dumb.
turns out we never want to bypass doing the full pass for root anyway
so just force fixup to not happen.
* Fix generation of protocol documentation from Doxygen headers.
Doxygen cannot be called directly on header files and needs a
configuration file to be generated first. Thanks, Anders Kaseorg.