Jeffrey Altman [Thu, 20 Jan 2011 06:39:11 +0000 (01:39 -0500)]
vol: make it clearer that SetOGM is not impl on Windows
Separate the SetOGM function into two implementations to
match the other OGM functions. Implement the Windows version
as returning -1 always.
In the future, the OGM functions could be renamed to express
their purpose: saving and restoring the volume id and tag
associated with a file. Windows currently encodes this
information using the CreationDate and the file name but
in the future this information might be stored in an alternate
data stream.
Jeffrey Altman [Thu, 20 Jan 2011 06:35:08 +0000 (01:35 -0500)]
vol: avoid double dir separators from addtoname
The manner in which addtoname() is used can often result
in double dir separators in path names. Check for it and
avoid doubling the separator in addtoname()
Reviewed-on: http://gerrit.openafs.org/3699 Reviewed-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com> Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 959a892afcc1f33871489912a8ea183fc7fca6c2)
Jeffrey Altman [Thu, 20 Jan 2011 06:23:37 +0000 (01:23 -0500)]
vol: clear ih_synced before dropping lock
in ih_reallyclose() clear ihP->ih_synced before dropped
the IH_LOCK. ih_reallyclose() is already committed to
performing the OS_SYNC() call. Failing to clear the ih_synced
flag before dropping the lock permits another thread, the ih_sync_all()
thread for example, to also conclude that it must sync the
file.
Jeffrey Altman [Sun, 16 Jan 2011 20:49:02 +0000 (15:49 -0500)]
Windows: refactor cm_CheckCBExpiration multihomed
cm_CheckCBExpiration() is refactored to make it easier
to read the decision process. cm_CheckCBExpiration()
determines when a callback is no longer usable and as a
result the object status info should be discarded.
The windows cache manager preserves status info past
callback expiration if all of the sources of a volume
became inaccessible prior to the callback expiration
time. The cache manager was improperly preserving the
status info for objects when the callback was issued by
a multi-homed file server when only the interface that
issued the callback is down.
A separate cm_server_t object is used to represent
each file server interface. When one interface goes
down and others are left up, the cache manager will
now replace the down cm_server_t reference for one that
is up. This substitution is performed as a side effect
of computing the effective downTime in cm_CBServersDownTime().
Jeffrey Altman [Fri, 14 Jan 2011 05:22:39 +0000 (00:22 -0500)]
Windows: use cm_ServerEqual() in cm_Analyze()
In cm_Analyze() when processing VNOVOL, VMOVED or VOFFLINE errors
do not use pointer equivalence as the test to determine if a
server is affected by the error. Use cm_ServerEqual() instead.
Fix cm_ServerEqual() to work even when both cm_server_t objects
are not UUID aware.
Jeffrey Altman [Sat, 15 Jan 2011 16:54:40 +0000 (11:54 -0500)]
vol: construct proper VolDir path on Windows
namei_HandleToInodeDir initializes the path name with
the nt_drive value. Therefore calling addtoname(name, name->n_drive)
produces the invalid path "D:\D:\\Vol_.....". Remove the unnecessary
addtoname() call.
Jeffrey Altman [Sat, 15 Jan 2011 16:47:47 +0000 (11:47 -0500)]
vol: use OS_DIRSEP when constructing paths
Do not assume that / is the directory separator when constructing
paths for internal consumption or log messages. Use OS_DIRSEP
or OS_DIRSEPC as appropriate.
Tom Keiser [Thu, 14 Oct 2010 05:24:03 +0000 (01:24 -0400)]
vol: make namei_ListAFSSubDirs deal with multiple/bad linktables
The salvager ends up deadlocking when multiple linktables exist
in the same volume group special directory. The issue is that we
open and flock all discovered linktables, but only close out the
last one found. Consequently, when our child scans the linktables
again, we deadlock against the locked and leaked descriptor(s) our
parent left around before forking.
While we have so far been unable to root-cause the actual creation
of spurious linktables, this patch will at least stop the salvager
from deadlocking against itself when this occurs.
Jeffrey Altman [Sat, 15 Jan 2011 16:39:39 +0000 (11:39 -0500)]
vol: initialize FdHandle_t stack objects
In namei_create() a temporary FdHandle_t is allocated on
the stack but was never initialized. Depending on what
prior data was on the stack the FdHandle_t could result
in subsequent operations failing in unpredictable ways.
Jeffrey Altman [Sat, 15 Jan 2011 16:07:19 +0000 (11:07 -0500)]
vol: Fix ntops to provide expected semantics
nt_open() can be asked to open a file with a path containing
directory components that do not yet exist. Modify nt_open()
to automatically create directories if necessary.
nt_read() and nt_pread() should not treat partial reads due
to reaching EOF as an error. Instead, return the bytes read.
Andrew Deason [Thu, 11 Mar 2010 18:19:47 +0000 (12:19 -0600)]
Parallel I/O extensions to namei backend
This adds the ability for certain namei operations (currently only
ListViceInodes) to occur across multiple different threads in
parallel. Currently this is only enabled when built with the
not-yet-existant AFS_SALSRV_ENV.
Jeffrey Altman [Sat, 15 Jan 2011 16:04:48 +0000 (11:04 -0500)]
vol: Windows requires binary fmode for salvager
In order for salvager to work properly it must read and
write data in binary mode. On Windows, this is accomplished
by calling _set_fmode(_O_BINARY) to set the default mode for
fopen(), etc.
Jeffrey Altman [Sat, 15 Jan 2011 16:01:55 +0000 (11:01 -0500)]
vol: fix OS_LOCKFILE/OS_UNLOCKFILE for Windows
On UNIX the OS_LOCKFILE and OS_UNLOCKFILE macros return zero
on success. Since Windows LockFile() and UnlockFile() return
non-zero (TRUE) on success, negate the return value as part
of the macro definition.
Jeffrey Altman [Fri, 14 Jan 2011 05:13:49 +0000 (00:13 -0500)]
Windows: osilog param size is size_t
The parameter size is size_t which permits pointers to be stored
on 32-bit and 64-bit systems. Make sure we store it as size_t
instead of truncating to long.
Andrew Deason [Sat, 8 Jan 2011 01:48:18 +0000 (20:48 -0500)]
git-version: Do not specify --ignore-submodules
Only new git versions reognize the --ignore-submodules option to
diff-index and diff-files. Do not pass this, to make git-version more
likely to work across different versions, as we don't have any
submodules in the tree anyway.
Jeffrey Altman [Sat, 8 Jan 2011 17:21:23 +0000 (12:21 -0500)]
Windows: refactor buf_Get() to improve readability
Refactor buf_Get() by using a switch() instead of a jumble
of if() conditionals.
Improve comments to make it clear that given the current
use and implementation of cm_BufRead() from cm_dcache.c
that created buffer pages will never be populated with
actual data.
Jeffrey Altman [Tue, 4 Jan 2011 02:07:10 +0000 (21:07 -0500)]
Windows: permit clean when switching platforms
When switching between i386 and amd64 in the same build tree
the "clean" make directive would fail due to NTLang.bat not
having been built in the new platform's destination directory.
Force NTLang.bat to be built as a dependency of cleanup and
delete it at the end along with the version files.
Simon Wilkinson [Sun, 14 Feb 2010 10:01:14 +0000 (10:01 +0000)]
Add "brief" option to rxgen
Add a new -b option to rxgen that turns on "brief" output. This makes a
number of changes to the data definitions produced by rxgen so they can
be more easily used by the calling code.
The changes are:
*) Use the new struct rx_opaque structure for all opaque data
definitions, rather than defining each as a unique structure.
This permits moving opaque data between rxgen structures to be
performed by simple assignment.
*) Use anonymous structures for internal definitions. Currently
rxgen also uses the field name as the structure name, which
prevents the use of a field name more than once within a
source file.
*) Don't embed the structure name within the names of the elements
within the structure. This significantly reduces the length of
assignment code, and makes for more readable callers.
Vincent Archer [Thu, 30 Dec 2010 16:34:28 +0000 (11:34 -0500)]
Windows: MIT license applies to parsemode()
Vincent Archer grants permission to OpenAFS to re-license
his MINIX contributions under the MIT license. A copy of the
e-mail granting permission is located in OpenAFS RT issue 128805.
Jeffrey Altman [Wed, 29 Dec 2010 16:35:17 +0000 (11:35 -0500)]
Windows: buf_CleanAsync scp->fid == bp->fid
If buf_CleanAsync or buf_CleanAsyncLocked are called
with a non-NULL cm_scache_t parameter, that status object's
fid must be the same as the associated cm_buf_t object.
If not, the wrong locks will be held.
If the cm_scache_t parameter is NULL and cm_FindSCache()
returns NULL, it means that the cm_scache_t object associated
with the bp->fid has been flushed from the cache. cm_GetSCache()
must therefore be called to allocate a new status object for the
FID. If the status object cannot be allocated, then any dirty
data stored in the buffer will be discarded.
Jeffrey Altman [Tue, 28 Dec 2010 19:39:47 +0000 (14:39 -0500)]
Windows: fs checkserver skip multi-homed up server
Multi-homed file servers can be detected by comparing the
uuid for the cm_server_t entries. If a server has at least
one up interface, do not list it as being down in the "fs checkserver"
response list.
Jeffrey Altman [Tue, 28 Dec 2010 00:34:14 +0000 (19:34 -0500)]
vos: do not mix memory allocation methods
ListVLDB mixed memory allocated with xdr_alloc() and memory
allocated with malloc(). This is not safe to do since it is
possible on some platforms for xdr_alloc() to allocated memory
using a method other than the malloc() linked to the vos
executable.
Instead of stealing the xdr_alloc()'d buffer, allocate a new
buffer and copy the contents.
Jeffrey Altman [Sat, 18 Dec 2010 23:39:07 +0000 (18:39 -0500)]
Windows: fs chmod and display mode in fs examine
Make use of the new pioctl VIOC_GETUNIXMODE and VIOC_SETUNIXMODE
operations to display the current mode in fs examine and permit
setting the mode with "fs chmod". The mode string parsing makes
use of Vincent Archer's code from Minix. The required copyright
statement and license is attached to parsemode().
afsconfig-windows.h gains definitions for various mode symbols
that are not defined by Visual Studio runtime headers.
Jeffrey Altman [Mon, 20 Dec 2010 14:59:43 +0000 (09:59 -0500)]
Windows: clear mountPointStringp on status change
If the data version of the cm_scache_t changes, we must clear
the mountPointString. Otherwise, if the object is a mountpoint
or symlink, cm_HandleLink() will not attempt to build the new
target string. The Windows CM never updates the contents of
a mountpoint or symlink. It always destroys the old and creates
a new one. However, the Unix CM simply updates the link data.
Apparently, the Windows clients have never noticed.
Andrew Deason [Wed, 8 Dec 2010 20:57:13 +0000 (14:57 -0600)]
DAFS: Avoid logging harmless LEAVE_OFF failures
The DAFS volserver can create temporary destroyMe volumes, which it
then tells the fileserver to keep offline with an FSYNC_VOL_LEAVE_OFF
message. When the fileserver doesn't know that the volume exists,
currently it responds with SYNC_DENIED, which causes the volserver to
log the error with a "negative response on circuit FSSYNC" message.
These are harmless, though, since leaving a volume offline that the
fileserver does not know about is a no-op. So return the SYNC_FAILED
code instead, which does not get logged, and is more consistent with
some other FSYNC handlers like FSYNC_VOL_DONE.
Andrew Deason [Wed, 8 Dec 2010 18:41:44 +0000 (12:41 -0600)]
DAFS: Fix VOL_QUERY_VOP error codes
Volumes in the VOL_STATE_DELETED state effectively do not exist. So,
when receiving an FSYNC_VOL_QUERY_VOP request for a volume, report
FSYNC_UNKNOWN_VOLID for a volume in the VOL_STATE_DELETED state.
Similarly, if the volume exists but on a different partition, we
should return the FSYNC_WRONG_PART reason code.
This allows volumes to be usable by the volume server in some corner
cases. For example, when a volume X exists on partitions A and B, and
the volserver deletes X on B. The fileserver then puts volume X in the
DELETED state, allowing checkouts over fsync, but FSYNC_VOL_QUERY_VOP
reports that no vop exists.
With this change, FSYNC_VOL_QUERY_VOP will instead report that the
volume does not exist, and so FSYNC_VerifyCheckout can succeed for
such volumes.
Reviewed-on: http://gerrit.openafs.org/3493 Reviewed-by: Tom Keiser <tkeiser@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 95fc9ece507d3c5bd7914afadaaae9456eea9b7a)
Andrew Deason [Wed, 8 Dec 2010 17:40:24 +0000 (11:40 -0600)]
Fix AUD_HOST callers
Servers using the AUD_HOST audit message should give the host IP in
network-byte order, as that is how the auditing code interprets it.
Fix the users of AUD_HOST that do not do so.
Stefan Kueng [Fri, 3 Dec 2010 20:24:33 +0000 (21:24 +0100)]
Windows: afs_shl_ext folder bkgrnd context menu
Make the context menu handler also work for folder backgrounds
and on Win7 for library folder backgrounds
For folder backgrounds, the shell passes the PIDL of the folder
instead of a data object. Extract the path from that PIDL. Also
extended the register function of the dll to add the required
registry keys.
Reviewed-on: http://gerrit.openafs.org/3443 Tested-by: BuildBot <buildbot@rampaginggeek.com> Tested-by: Stefan Kueng <tortoisesvn@gmail.com> Reviewed-by: Stefan Kueng <tortoisesvn@gmail.com> Reviewed-by: Jeffrey Altman <jaltman@openafs.org> Tested-by: Jeffrey Altman <jaltman@openafs.org>
(cherry picked from commit f8f8c0a48fbe086870a0cf35a62278c2b4ab743b)
Jeffrey Altman [Wed, 1 Dec 2010 23:47:29 +0000 (18:47 -0500)]
Windows: Remove fallback from GetCaps to GetTime
If the file server responds to RXAFS_GetCapabilities with
RXGEN_OPCODE the server is up and there is no need to fallback to
RXAFS_GetTime. Remove the code that performs the extra work.
Andrew Deason [Thu, 9 Sep 2010 14:41:40 +0000 (09:41 -0500)]
vos: Improve release recovery on timed-out trans
When a portion of 'vos release' takes long enough that a transaction
on one or more RO sites times out, it retries to release to those
sites. However, it does not take into account the situation where the
transaction on the original RO clone has also timed out, which it
usually will have if we took a long time to get to the ForwardMulti
stage for any reason.
Add a check to see if the clone RO transaction has timed out, and if
so, recreate the transaction on it. Check if the volume appears to
have changed at all, and if it has, bail out.
Jeffrey Altman [Fri, 26 Nov 2010 07:55:03 +0000 (02:55 -0500)]
Windows: NSIS installer requires the architecture for CL=1400
The NSIS installer at present is 32-bit only. Production releases
of OpenAFS have always been performed using the CL=1310 compiler
so it wasn't noticed that src/WINNT/install/NSIS/NTMakefile did
not define the ARCH (architecture) for the purpose of identifying
which redistributable runtime library installer should be
integrated into the build. For the CL=1310 compiler there are
not prebuilt installers for OpenAFS to integrate.
Jeffrey Altman [Fri, 26 Nov 2010 07:51:16 +0000 (02:51 -0500)]
Windows: make use of AFSDEV_BIN and set the PATH
ntbuild.bat defines AFSDEV_BIN which is set to the list of
directories from which executables required for the build
process will be executed. However, this value was never used
to modify the PATH environment variable. Make it do so.
Andrew Deason [Fri, 14 Jan 2011 20:00:14 +0000 (14:00 -0600)]
merge-pod: Be more compatible with older perl
merge-pod works fine with perl 5.00503, if we eliminate the 3-argument
invocation of open(). So, replace the open() calls with their
2-argument equivalent, and relax the version requirement a bit.
The build process for OpenBSD builds the no-NFS version of
the kernel module but, at install time, the NFS version is
subseuquently built and installed while the no-NFS version
is ignored. The NFS version does not load and is not needed
in OpenBSD so this patch makes sure that the no-NFS version
is installed and used.
Reviewed-on: http://gerrit.openafs.org/3684 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 6d8e3392b77d72f6d05b94fa9c48813ceed5980d)
OpenBSD: Remove duplicate assignment of COMMON_INCLUDE in libafs
When building libafs, the make file variable COMMON_INCLUDE is
assigned a value in two places: Makefile.common.in and
MakefileProto.OBSD.in. The assignment in the latter place is both
wrong and unnecessary. Remove it.
OpenBSD: Don't call non-existent routines in osi_vfsops.c
The OpenBSD version of osi_vfsops.c makes calls to routines
that do not exist in the system and aren't needed. In the
past, these calls were wrappered by an #ifdef for
AFS_DISCON_ENV which was never defined. That #ifdef is now
gone so this patch removes the calls to these routines,
which are remnants of the NBSD origins for this particular
code.
The netinet/in.h header file requires the inclusion of sys/types.h
(or some portion thereof). Most systems include it implicitly
within netinet/in.h. Some, such as OpenBSD, do not. In kopenafs.c,
sys/types.h is included after netinet/in.h which is fine in most
cases but means that, as a result, it will not compile on OpenBSD.
Moving sys/types.h before netinet/in.h solves this problem (and
should cause no problems on any other system).
OpenBSD passes an extra parameter in a call to afs_close()
in its OS-specific code. It went undetected in the past
but now causes compile headaches because of more accurate
prototypes in the header file. This patch removes the
offending extra parameter (which never actually caused any
problems because it was the last one in the parameter list).
OpenBSD: Fix use of macros for AFS_KALLOC/AFS_KFREE
The macro definitions for AFS_KALLOC and AFS_KFREE used by
afs_osi_alloc.c to perform OS-specific memory allocation
are only defined by the OpenBSD osi_machdep.h header file
if they already exist, which means: never. This patch fixes
this situtation and makes sure that afs_osi_alloc.c
actually uses them, eliminating a direct OS-specific call
in afs_osi_alloc.c.
OpenBSD: Remove macros definitions for afs_osi_Alloc et al.
The afs_osi_Alloc, afs_osi_Free, etc. routines are now
defined in afs_osi_alloc.c so the macro definitions defined
by osi_machdep.h for OpenBSD are no longer needed and, in
fact, interfere with the compile. Remove them.
OpenBSD does not retain ruid or rgid values in the
afs_creds_t structure (ucred). This patch, therefore,
removes any references to them in the afs.h file. Since
no attempt is made to actually use the removed code (or
macros) on OpenBSD, at least at this time, this does
not result in any real functional change.
Ben Kaduk [Fri, 14 Jan 2011 01:16:44 +0000 (20:16 -0500)]
FBSD: remove vestiges of Giant
We do not support versions of FreeBSD that used Giant to
serialize access to vnode fields, and we always use the same locking
(which really ought to be MPSAFE). Always set the MPSAFE flags
as needed, and do not bother to call VFS_[UN]LOCK_GIANT which
will never do anything for us.
Andrew Deason [Wed, 12 Jan 2011 16:29:46 +0000 (10:29 -0600)]
SOLARIS: Include sys/varargs.h for kernel stdarg
When compiling for the kernel, pre-10 Solaris seems to want
<sys/varargs.h> instead of <stdarg.h>, as documented in the Solaris
man pages. So include <sys/varargs.h> instead of <stdarg.h> where we
need variable arguments (afs_warn.c).
Reviewed-on: http://gerrit.openafs.org/3653 Tested-by: Andrew Deason <adeason@sinenomine.net> Tested-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 6d03eef7217be8f0b72f34ab023e69c976dea84d)
Ben Kaduk [Mon, 20 Dec 2010 00:33:28 +0000 (19:33 -0500)]
FBSD7: Don't sleep with the glock
On FreeBSD 7.X, vinvalbuf() can (will) sleep; this results in a panic
when the kernel is configured with WITNESS and we hold the glock around
it.
Drop the glock in this case.
Ben Kaduk [Sun, 19 Dec 2010 04:52:44 +0000 (23:52 -0500)]
Bring FBSD 7.X client back to life
Having been untested for quite some time, we had several
places that needed more conditionals to compile on FreeBSD 7.
Now we compile and start on 7.3-RELEASE, but have locking issues
under actual use.
It seems that we are also incompatible with the Heimdal 0.6.3 in
the base system -- aklog is unable to actually obtain the needed
credential when compiled against that kerberos implementation;
using MIT krb5 1.6.3 from ports works without incident.
Marc Dionne [Wed, 24 Nov 2010 00:08:24 +0000 (19:08 -0500)]
Cache bypass: switch to rx_Readv
Tests show that cache bypass doesn't scale very well past a few
concurrent processes, with a lot of lock contention in the RX
layer. Switching the implementation to the iovec based rx_Readv
alleviates much of this.
Also take advantage of the fact that the upper layer readpages
only sends down contiguous lists of pages, and issue larger read
requests and populate the pagecache pages from the iovecs we
get back. The loop logic is changed significantly to accomodate
the new pattern.
Read throughput is improved by about 30-40% for some parallel read
benchmarks I use. Along with some other tweaks, it can allow the
throughput to be more than doubled.
Marc Dionne [Tue, 23 Nov 2010 23:39:33 +0000 (18:39 -0500)]
Cache bypass: Only compile bypass code for the Linux kernel
Only compile the afs_bypasscache.c code if AFS_LINUX24_ENV is set,
since it's currently the only case where the code is actually used.
Only sections that caused problems for UKERNEL were previously
ifdef'ed.
Besides making the code cleaner, the main effect of this change
is to prevent compiling most of the bypass code for UKERNEL where
it isn't currently used.
If support for bypass is added for other platforms eventually, the
code here would need to be reworked anyway, ideally abstracting out
and moving any OS specific bits into the platform subdirectories.
Marc Dionne [Tue, 23 Nov 2010 23:21:16 +0000 (18:21 -0500)]
Cache bypass: remove ifdefs under src/afs/LINUX
Compile cache bypass code unconditionally under src/afs/LINUX
since it is now always enabled. Also remove syslog messages
about a "cache bypass patched module" when loading and unloading
the module.
Marc Dionne [Sun, 7 Nov 2010 20:06:16 +0000 (15:06 -0500)]
Cache bypass: release and unlock pages when we get 0-length reply
In some cases, such as reading past the end of file as known to the
server, fetchdata will get a 0 length reply. Deal gracefully by
unlocking and releasing any pages reserved by readpages. Failure
to do so here leads to deadlocks later as we can exit with some pages
still locked.
Reviewed-on: http://gerrit.openafs.org/3283 Reviewed-by: Matt Benjamin <matt@linuxbox.com> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit e4250dc64eb26b5da1480e9f5bd58d016f81847f)
Marc Dionne [Sun, 7 Nov 2010 18:35:36 +0000 (13:35 -0500)]
Cache bypass: adjust read size for non-contiguous readpages
The bypass code's readpages does deal with a non-contiguous list
of pages, but it doesn't adjust the size of the read it requests
from the background daemon accordingly. As a result we'll ask the
server for pages we were not asked to read.
Reviewed-on: http://gerrit.openafs.org/3282 Reviewed-by: Matt Benjamin <matt@linuxbox.com> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 0b6b2b3cab09eacf9b03638d8770c83aeb0b8fea)
Marc Dionne [Sun, 7 Nov 2010 18:14:55 +0000 (13:14 -0500)]
Cache bypass: make readpage deal with reads at end of file
When a file's size is an exact multiple of the page size, the vfs
will issue a readpage for an extra page at the end, for which there
is no data. Deal with it here instead of letting it trickle down
to the background daemon, which will issue an unnecessary read to the
server, and maybe get confused because there is no data.
Reviewed-on: http://gerrit.openafs.org/3281 Reviewed-by: Matt Benjamin <matt@linuxbox.com> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 8ec31f26770ef1e85fb3a6005467f0e2d3ce1715)
Marc Dionne [Tue, 23 Nov 2010 22:50:25 +0000 (17:50 -0500)]
Cache bypass: Remove AFS_KMAP_ATOMIC
Since AFS_KMAP_ATOMIC is defined unconditionally, remove the ifdefs
and the code for the !AFS_KMAP_ATOMIC case. We probably don't want
to support this feature on a kernel old enough not to have kmap_atomic.
This should exist on all 2.6 and even 2.4 linux kernels.
This simplifies the code for maintenance and later changes.
Marc Dionne [Tue, 11 Jan 2011 02:31:18 +0000 (21:31 -0500)]
Cache bypass: fix use of incorrect "states"
Test and set the correct field for cache bypass flags. There was
some confusion between cachingStates and the states associated with
vcache entries in a few places.
Reviewed-on: http://gerrit.openafs.org/3637 Reviewed-by: Matt Benjamin <matt@linuxbox.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 8c541079573274d726180d3d9679c6a26cda84ea)
Marc Dionne [Fri, 5 Nov 2010 00:49:41 +0000 (20:49 -0400)]
Cache bypass: Fix oops in bypass transition functions
The FCSBypass flag might change between the time we check it before
entering afs_TransitionToCaching or afs_TransitionToBypass and when
we check it again within the functions.
Instead of panicing, just exit if someone beat us to it. Also move
the checks within the write lock region to make sure the code
doesn't get run multiple times.
Reviewed-on: http://gerrit.openafs.org/3266 Reviewed-by: Jeffrey Altman <jaltman@openafs.org> Tested-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit f2c6ae300a211460c24c87752cf9400b9e61ee1f)
Ben Kaduk [Mon, 20 Dec 2010 00:29:17 +0000 (19:29 -0500)]
Zero rx_multi_lock before initializing it
FreeBSD's kernel debugging facilities will panic if it detects
an attempt to re-initialize an already-initialized lock, as detected
through some particular bits being nonzero. Zero everything out
before starting, to prevent this panic.
Tom Keiser [Wed, 13 Oct 2010 05:16:25 +0000 (01:16 -0400)]
provide more verbose logging when VGetVolumeByVp_r fails
FSYNC_com_VolOff() commits sepuku when VGetVolumeByVp_r() fails to return
a heavyweight ref to the volume. This small patch provides more detailed
debugging information so we have a better idea why VGetVolumeByVp_r failed.
Reviewed-on: http://gerrit.openafs.org/2969 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 3f0c08ad93bf98fbe64d5714649d675712410cc9)
Ben Kaduk [Sun, 19 Dec 2010 05:06:13 +0000 (00:06 -0500)]
FBSD: StopListener glocking fixup
afs_osi_Sleep requires the glock (so that it can sleep on it); we
dropped the glock earlier in osi_StopListener because soshutdown and
soclose can sleep, but we must (unconditionally!) acquire it for our
loop waiting on rxk_ListenerPid.
Andrew Deason [Thu, 11 Nov 2010 20:45:04 +0000 (14:45 -0600)]
vos release: Avoid full dump on all sites
Commit 9fed169b1c5c823fd96cea94daf712b2cf06c901 attempts to remove any
remote RO site that has RO_DONTUSE set. However, we set RO_DONTUSE on
all sites earlier in the release process if this is a full release,
resulting in all sites getting a full dump.
Correct this by remembering in 'origflags' what flags each site has
before we messed with the vldb entry.
Thanks to Mike Meffie.
Reviewed-on: http://gerrit.openafs.org/3296 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Tested-by: Michael Meffie <mmeffie@sinenomine.net>
(cherry picked from commit 97474963e58253f8c891e9f6596403213d53527b)
Simon Wilkinson [Sun, 26 Dec 2010 14:14:38 +0000 (14:14 +0000)]
volser: Fix broken bulk conversion
The converstions between the original, N and U bulk list return
values were all broken in various ways:
1/ Shifting from malloc to xdr_alloc() (in 4f1efdc8b73ed)
subtly changed the behaviour when handling an empty list. The
correct XDR representation of an empty list is {0, NULL}, not
{0, &memZero}. Fix the code so that if the source list is empty,
an empty destination list is returned.
2/ The destination list length was never being filled in. This means
that xdr_free() could not be safely used on this list, as the wrong
length would be passed to the allocator. Fill in the destination
list length as part of the conversion.
3/ xdr_free(...) is a no-op when called with an empty list - there's
no need to check before calling it. Remove these checks to improve
the code's readability.
4/ xdr_free(...) should only be called when the RPC returned
sucessfully. The stub is responsible for freeing data should the call
fail mid way through unmarshalling.
5/ Where an RPC returns the number of entries independently of the
length of a counted array, it is unsafe to use that length to
iterate the array without checking that it is within the array
bounds. Instead, just use the array length when performing
conversions.
Simon Wilkinson [Sun, 26 Dec 2010 14:00:42 +0000 (14:00 +0000)]
vos: Abstract out bulk list conversion
Pull the various segments of code that do bulk list conversion into
their own functions. This is purely code reorganisation at this point,
fixes for these functions will follow in subsequent patches.