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 [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.
Steve Simmons [Tue, 31 Aug 2010 23:21:50 +0000 (19:21 -0400)]
Update the man pages pod source adding text to discourage use of
uss. Usually the text added was a copy of a CAUTION section that
had already been added in a few places. This change applies it
consistently across all uss-related man pages. In pod1/afs.pod that
text would be excessively wordy; a briefer note is used there to
direct the reader to the full text.
This is a partial fix for RT bug #128018. It does not fully close
the bug; the AFS Administrators Guide needs to be updated as well.
Jeffrey Altman [Wed, 24 Nov 2010 10:24:43 +0000 (05:24 -0500)]
Windows: indicate that roken is a dynamic library for roken.h
Since the windows build of roken is a dynamic library we must
define ROKEN_LIB_DYNAMIC so that roken.h will specific the
correct values of ROKEN_LIB_VARIABLE, ROKEN_LIB_CALL, and
ROKEN_LIB_FUNCTION.
Jeffrey Altman [Wed, 24 Nov 2010 05:44:02 +0000 (00:44 -0500)]
roken: modify build configuration to permit Windows to work
When building roken the library must be built with different
ROKEN_LIB_xxx macro values than when the library is being
linked against. In particular, ROKEN_LIB_VARIABLE needs to
be exported when building and imported when linking.
Jeffrey Altman [Tue, 23 Nov 2010 17:11:46 +0000 (12:11 -0500)]
rxkad: fix bg-fcrypt to work with roken
On Windows, roken.h defines iov_len as len and iov_base as buf
so that it can use _WSABUF as the iovec structure. This has negative
consequences when there are local variables iov_len and iov_base
as the same time as there are variables len and buf. This was the
case in bg-fcrypt rxkad_EncryptPacket and rxkad_DecryptPacket.
As a result, rxkad compiled cleanly but did the wrong thing.
This patchset renames iov_len to ilen and iov_base to ibase in order
to avoid this issue.
Simon Wilkinson [Sun, 21 Nov 2010 10:16:26 +0000 (10:16 +0000)]
rx: Rework identity copying
Change the behaviour of the rx_identity_copy function so that it
copies the whole identity, not just the contents. Add a new function
rx_identity_copyContents which just copies the contents of an identity
into an existing identity structure.
This restores symmetry with the free and freeContents functions.
Ben Kaduk [Sat, 6 Nov 2010 04:02:31 +0000 (00:02 -0400)]
FBSD: close race in afs_root
Previously, we called afs_PutVCache(afs_globalVp) directly. This
is unsafe because PutVCache acquires locks which can sleep, losing
the serialization of the GLOCK. In rare circumstances, this can
result in two threads simultaneously making that call, and the
second one would panic in vputx() with a negative refcount.
Close the race by using a local variable for the afs_PutVCache()
calls, applying the change to afs_globalVp before dropping the GLOCK.
While here, fix up other race conditions.
Simon Wilkinson [Sat, 20 Nov 2010 10:25:06 +0000 (10:25 +0000)]
Imports: Add reporting of new and removed files
Make the commit message produced by import-external-git.pl also report
which files the script added and removed. Whilst this information is
available from the patch itself, having it in the commit message makes
it much easier to tell what happened when reviewing history through
git log.
Christof Hanke [Fri, 19 Nov 2010 20:30:21 +0000 (21:30 +0100)]
use proper 64bit casting for pointer-math
building with "./configure --enable-checking --enable-supergroups"
fails, because on 64bit, the casting in map.c gives a warning.
Just add another ifdef and cast according to the size of a pointer.
Jeffrey Altman [Sat, 20 Nov 2010 21:26:22 +0000 (16:26 -0500)]
Windows: permit aklog to build with krb4 support and roken
aklog.c defined S_ISDIR() which is now defined by roken.h
krb4 declared the types uid_t and gid_t which are defined by roken.h.
There is no mechanism to disable the declarations within the krb4
header (conf-pc.h) even those the declarations were never required
by the Kerberos v4 DLL. The patchset hacks the in tree local copy
of the kfw\inc\krb4\conf-pc.h header to avoid the conflict.
There is still an annoying warning due to kfw\inc\krb4\krb.h
providing a conflicting prototype for gettimeofday() but the
function is not used within aklog so there is no harm from it.
Jeffrey Altman [Sat, 20 Nov 2010 21:03:31 +0000 (16:03 -0500)]
Windows: Have get/free addrinfo and nameinfo functions
roken defines replacements for getaddrinfo, freeaddrinfo,
getnameinfo, and freenameinfo which are provided by winsock.
Add HAVE_xxxx macros as required to prevent roken substitution
from taking place.
Jeffrey Altman [Thu, 18 Nov 2010 03:33:48 +0000 (22:33 -0500)]
more rx/tests cleanups
Include roken.h, always reference rx headers with rx prefix,
add a resource file for Windows, remove warnings from testclient
and testserver. add a .gitignore file.
Felix Frank [Fri, 12 Nov 2010 23:10:31 +0000 (00:10 +0100)]
rxgen: add *TranslateOpcode functions to XDR code
Administrative commands and server binaries can benefit from the
ability to translate RPC OpCode numbers to proper function names.
For this purpose, rxgen now emits the function
char *PKGTranslateOpCode(int)
where PKG is replaced by the respective package prefix.
The function is generated in the exact same way that ExecuteRequest is.
This way, the right optimization (array storage vs. generated case
statement) according to the respective sparseness of OpCodes in the
different RX packages is maintained.
Andrew Deason [Fri, 12 Nov 2010 16:32:57 +0000 (10:32 -0600)]
doc: Do not process .in files for html
We do not want to process .pod.in files when generating HTML versions
of the man pages. Change the filename filtering logic to only accept
.pod files, so we'll also skip over all other stuff we don't want,
like CVS or fragments directories.
Simon Wilkinson [Mon, 1 Nov 2010 09:03:43 +0000 (09:03 +0000)]
Build: Fix broken bracketing in shared Makefile
There was a stray ( in the shared library build system. We hadn't
noticed this, as the only place that uses the shared makefile and
produces binaries is the hcrypto test suite that isn't built by
default.
Marc Dionne [Fri, 5 Nov 2010 21:30:02 +0000 (17:30 -0400)]
Linux: define llseek operations
With kernel 2.6.37 it is now mandatory to define the llseek operation
for files and directories. If these are not defined, no_llseek is
called, and any attempt to seek returns ESPIPE.
Most file systems use generic_file_llseek, but it seems safer to use
default_llseek which is what the vfs used to call for us by default.
In 2.6.37 these two functions are actually functionally identical.
Jeffrey Altman [Thu, 18 Nov 2010 02:42:00 +0000 (21:42 -0500)]
Windows: Add CODESIGN_OTHER option to make signtool rules
Some organizations may need to pass additional parameters to
signtool.exe. Add the optional CODESIGN_OTHER value to permit
arbitrary additional parameters to be specified.
Jeffrey Altman [Sun, 6 Jun 2010 15:03:44 +0000 (11:03 -0400)]
Convert from using nvldbentry to uvldbentry
The support routines relied upon by vos use the older nvldbentry
data structures which do not include the UUID for the server.
This patchset updates the code to use the uvldbentry structure
so that a future patchset can make use of UUID values when available.
Any functions from vsprocs.c which are referenced by vos.c are
considered public. This includes all of the VL_xxxx, UV_xxxx
and Lp_xxxx functions, the EnumerateEntry, SubEnumerateEntry, and
host mapping functions. For any which references an nvldbentry as a
parameter a new 'U' version is created that accepts a uvldbentry.
These new 'U' functions are then used throughout vos.c and the internal
routines.
Simon Wilkinson [Sat, 30 Oct 2010 14:17:09 +0000 (15:17 +0100)]
libroken: Build on windows
A minimal change set to get libroken to build on Windows. Sadly,
libroken contains definitions for a number of platform compatibility
macros which were previously scattered throughout the windows code.
These scattered macros have to be removed in order to build libroken.
The impact of this removal is that a very large number of files
throughout the tree require the addition of "roken.h" to pick up the
new compatibility code. The bulk of this change is adding these
includes.
In addition, some of the added includes add roken dependencies to the
Unix build. So, also add libroken to the build rules in affected Unix
Makefiles.
Andrew Deason [Wed, 10 Nov 2010 15:11:47 +0000 (09:11 -0600)]
Use afs_foff_t for file offsets
Some callers in vol and volser were not using afs_foff_t for file
offsets for calls to STREAM_ASEEK, FDH_TRUNC, FDH_PREAD, or
FDH_PWRITE. Most notably, in code for volume cloning, purging, and
dumping operations. Fix them to use afs_foff_t to prevent errors when
dealing with large special files.
Hartmut Reuter [Fri, 5 Nov 2010 10:31:28 +0000 (11:31 +0100)]
RXOSD and VICEP-ACCESS fields and bits in afs.h
struct vcache gets two new fields:
int protocol
which in the lower 16 bits contains the protocol number
1 classical rx-fileserver,
2 rxosd,
4 direct access to visible vicep partitions.
void *vpacRock
which for visible files in a vicep-partition contains
a pointer to a struct known only inside afs_vicep.c
which contains the pointer to the open file and other
information.
Andrew Deason [Wed, 1 Sep 2010 20:10:56 +0000 (15:10 -0500)]
ubik: Record the last write tid in writeTidCounter
ubik is currently tracking writeTidCounter for write transactions
separately from regular transactions (assigned from tidCounter).
Specifically, tidCounter is incremented twice for each transaction,
but writeTidCounter is incremented twice only for write transactions.
As a result, writeTidCounter and tidCounter tend to drift far apart.
This is a problem, since the tid for DISK_* calls uses the transaction
id of the current transaction (based on tidCounter), and VOTE_Beacon
uses writeTidCounter for its transaction id. So, in effect, the tid in
VOTE_Beacon is completely bogus and unrelated to the transaction id of
the actual current write transaction. This can cause valid write
transactions to become invalidated when tidCounter becomes negative,
since VOTE_Beacon will send a positive tid, and if there is a current
in-flight write transaction with a negative tid, SVOTE_Beacon will
deem the transactions inequal and will abort the write transaction.
So instead, record the transaction id counter for the last write
transaction in writeTidCounter. This way, when we call VOTE_Beacon, we
will use the correct transaction id counter for the current write
transaction, and SVOTE_Beacon on the remote site will not invalidate
the transaction.
Andrew Deason [Wed, 10 Nov 2010 21:35:17 +0000 (15:35 -0600)]
afscp: Add -s option
Add an -s option to afscp, to specify an amount of time to sleep in
the middle of a read or write operation. This can be helpful in
simulating a slow client.
Permit a popular path through afs_linux_dentry_revalidate to pass without
taking a lock which it actually does not need. This affects multi-core
software-build nodes in particular, where serialization and high stat() counts
restricts useful processing to a single core.
Andrew Deason [Tue, 12 Oct 2010 22:46:36 +0000 (17:46 -0500)]
viced: Add options for interrupting clients
Add the -offline-timeout and -offline-shutdown-timeout options to the
fileserver, to implement interrupting clients accessing volumes we are
trying to take the volume offline. Document the new options.
Currently this is only implemented for read operations. Implementing
this for write operations and callback breaks will require more work.
This also removes the VGetVolumeTimed interface from the volume
package, since the fileserver was the only user and with this change
the fileserver now uses the VGetVolumeWithCall interface.
Andrew Deason [Fri, 29 Oct 2010 16:29:37 +0000 (11:29 -0500)]
vol: Interrupt RX calls accessing offlining vols
When we are waiting for a volume to go offline, only wait a certain
amount of time for it to go offline before we interrupt all RX calls
associated with that volume. This amount of time is configurable in
the new offline_timeout and offline_shutdown_timeout volume package
option fields.
Andrew Deason [Fri, 29 Oct 2010 16:14:49 +0000 (11:14 -0500)]
vol: Add interfaces for registering RX calls
Add VGetVolumeWithCall and VPutVolumeWithCall, to associate RX calls
with volume heavyweight references. Also add the interrupt_rxcall
field to the volume package options structure.
This also adds the VIsGoingOffline function, so a caller can tell when
a volume is going offline.
Andrew Deason [Wed, 27 Oct 2010 22:34:40 +0000 (17:34 -0500)]
vol: Add VGetVolumeTimed
Replace the VGetVolumeNoWait interface with the more general
VGetVolumeTimed interface, which allows for waiting for offlining
volume for arbitrary amounts of time (instead of just "waiting
forever" or "not waiting at all"). Also add VOL_CV_TIMEDWAIT and
VTimedWaitStateChange_r as necessary to implement this.
Andrew Deason [Thu, 30 Sep 2010 17:39:22 +0000 (12:39 -0500)]
viced: Allow checkout of VOL_STATE_DELETED volumes
The fileserver allows nonexistent volumes to be checked out. Since
VOL_STATE_DELETED volumes conceptually do not exist, we should also
allow them to be checked out.
Change-Id: Ibc0f761569b339579acff03a3cbd9f795f783e0a
Reviewed-on: http://gerrit.openafs.org/2873 Reviewed-by: Tom Keiser <tkeiser@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
Andrew Deason [Fri, 12 Nov 2010 16:03:43 +0000 (10:03 -0600)]
doc: Fix fileserver synopsis
The fileserver synopsis was missing the leading 'fileserver' before
the options list. This causes the options list to not be interpreted
as POD, and so you get a lot of ugly unprocessed POD markup in the man
page. Fix that.
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.
Change-Id: I8c9582c9f7aaee92637ddc1ad11aed96fd69686b
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>
Andrew Deason [Thu, 29 Jul 2010 22:02:38 +0000 (17:02 -0500)]
Fix util test dependencies
The test programs in tests/util did not depend on libutil.a or
libtap.a. So, if libutil.a changed, they were not relinked. Add the
dependencies so correcting a part of libutil will cause the tests to
actually reflect the change.
Andrew Deason [Wed, 29 Sep 2010 16:48:44 +0000 (11:48 -0500)]
salvager: Do not break cbks when salvaging parts
When salvaging whole partitions / whole servers, the fileserver is
assumed to not be running. So only break callbacks if we are salvaging
a single volume. If we are salvaging a whole partition, do not tell
the fileserver to break callbacks on changed volumes, since the
fileserver will not be around and we will just hang.
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.
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.
Change-Id: If86ed785c4e9d50edb1a960142f726fa869c50fc
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>
Andrew Deason [Thu, 30 Sep 2010 16:34:59 +0000 (11:34 -0500)]
volser: Do not FSYNC_VOL_DONE temporary volumes
Currently, the volserver just looks at the destroyMe field in a volume
header to see if it should tell the fileserver a volume has been
deleted (FSYNC_VOL_DONE opcode). However, temporary volumes created by
the volserver (such as new volumes or clones) have destroyMe set, but
are obviously not deleted, and so the fileserver should just be told
FSYNC_VOL_LEAVE_OFF about these volumes instead.
Note that this commit slightly changes the meaning of the
vp->needsPutBack field. Now it must be set to VOL_PUTBACK_DELETE to
tell the fileserver that the volume has been deleted, and set to
VOL_PUTBACK if it just needs to be given back to the fileserver.
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.
Change-Id: I5468a4a68f4f415961298144f5bb581faeda540a
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>
Andrew Deason [Fri, 5 Nov 2010 21:48:28 +0000 (16:48 -0500)]
vol: Do not give back not-checked-out vols
VAttachVolumeByName_r has logic to give back a volume over FSSYNC if
we checked out a volume but failed to attach it for whatever reason.
However, the logic used for determining if the volume was checked out
or not is a bit inaccurate (even moreso than the comments imply),
potentially causing us to VOL_ON volumes that don't exist at all.
Instead of trying to guess based on various conditions whether or not
we checked out the volume, keep track of a variable that is only set
when we actually checkout the volume from the fileserver. Then only
give back the volume if it is set.
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.
Change-Id: Ic9e496c8c64d5e94f2cf9976d160ef5873f27249
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>
Simon Wilkinson [Fri, 1 Oct 2010 08:36:06 +0000 (09:36 +0100)]
rx: Reorganise includes
RX files were including the same header set in three different places,
once for user-land builds, once for kernel builds and once for ukernel.
The duplication was a bit pointless, and really frustrating when adding
new headers. So, reorganise the includes so that we only list headers
that are used in all three builds in one location.
Also take the opportunity to indent the #ifdefs so that it is clear
what is going on, and to remove some more of AFS_OSF_ENV and
AFS_AUX_ENV from kernel builds.
Michael Meffie [Thu, 4 Nov 2010 13:26:25 +0000 (09:26 -0400)]
avoid private stdio fields in waitkey
Use the stdio_ext functions provided by solaris and glibc
instead of directly accessing private stdio FILE structure
members. This is needed for 64-bit solaris builds and is more
portable in general since the FILE structure is meant to be
opaque. Remove the duplicated code in the pthreaded butc
package.
Andrew Deason [Fri, 5 Nov 2010 19:34:05 +0000 (14:34 -0500)]
DAFS: Do not let VScheduleSalvage_r free vp
In VScheduleSalvage_r, we were calling VCancelReservation_r, which has
the possibility of free'ing vp. Since we still use vp after doing this
(and since we're already inside VCancelReservation_r to begin with),
we must not free vp. Instead, just decrement nWaiters without
triggering any of the dtor code in VCancelReservation_r. This is safe
as long as all VScheduleSalvage_r callers ensure that they check to
free the vp if necessary, which they all do.
RedHat: Remove potpourri.h from RedHat SPEC file manifest
potpourri.h is no longer needed, so it should be removed from the
list of files to be installed. The missing file was causing the
RPM package build process to fail.
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.
Andrew Deason [Thu, 4 Nov 2010 16:37:31 +0000 (11:37 -0500)]
tsm: Make explicit rules for stem-changing targets
If the stem changes for generating a .o from a .c file,
implicit/suffix rules will not apply. That is, if we specify the
dependencies for 'bar.o' in a Makefile as so:
bar.o: foo.c
This will not match an implicit .c.o rule, since the filename stem
changes. We must add an explicit AFS_CCRULE invocation to make the
rule do anything.
This fixes this problem for the src/tsm41 directory. It may exist
elsewhere, but it's difficult to find unless the build breaks.