The LazyWriterThread should not be recorded in the FCB. It is
possible for multiple lazy writes to occur on a file in parallel
in separate threads. The value is not used for anything in any
case. AFSCommonWrite() tests the LazyWriterThread value but only
if 'bMapped' is FALSE. Since 'bMapped' is always TRUE, the
comparison is never performed. Remove the test and the value.
Jeffrey Altman [Sun, 14 Oct 2012 19:46:06 +0000 (15:46 -0400)]
Windows: Add cm_SyncOp to cm_ReadMountPoint()
Add a cm_SyncOp(CM_SCACHESYNC_FETCHDATA) call to cm_ReadMountPoint()
to prevent multiple FetchData RPCs being issued for the same
mount point at the same time.
In AFSInitFcb() assign pFcb->ObjectInformation before the
InterlockedExchangePointer call and not afterwards. Assigning
it afterwards leaves a small race where the ObjectInformation
value will be invalid.
Jeffrey Altman [Wed, 17 Oct 2012 00:26:43 +0000 (20:26 -0400)]
Windows: OpenTargetDirectory AFSInitFcb Reparse Test
In AFSOpenTargetDirectory the test to determine if AFSInitFcb
allocated a FCB or returned an existing one (STATUS_REPARSE)
was reversed. If AFSInitFcb was called and AFSOpenTargetDirectory
eventually failed, an in use FCB would be freed.
Jeffrey Altman [Sat, 6 Oct 2012 05:40:47 +0000 (01:40 -0400)]
Windows: Do not call buf_ClearRDRFlag unlink/rmdir
When processing unlink and remdir operations initiated by the
SMB stack do not call buf_ClearRDRFlag. The redirector upon
receiving the AFS_INVALIDATE_DELETE call will cancel outstanding
extent operations, mark the FCB deleted, and tear down any held
extents.
Simon Wilkinson [Fri, 12 Oct 2012 09:07:22 +0000 (10:07 +0100)]
rx: Use opr queues
Modify RX so that it uses opr queues throughout, rather than the older,
non-type-safe rx_queue structure and macros. Attempt to clarify which
items in a structure are queue headers, and which are linkage pointers.
This has the knock on effect that including an RX header doesn't
automatically give you rx_queue.h in your application's namespace.
Simon Wilkinson [Thu, 11 Oct 2012 11:34:46 +0000 (12:34 +0100)]
rx: Move server queue entry structure out of rx.h
Hide the server queue management structure in its own header file,
rather than exposing it globally in rx.h. This structure has always
been private - applications have no business knowing about it!
Marc Dionne [Fri, 12 Oct 2012 20:31:24 +0000 (16:31 -0400)]
libafs: Fix second pass in ShakeLooseVCaches
Commit 3105c7ff introduced a two phase process for reclaiming
vcache entries. First go through the list and do what's possible
without sleeping (skipping aliased dentries on Linux), then do
a second pass only if necessary, allowing sleeping.
Unfortunately the test for the end of the VLRU scan is incorrect
and can never trigger, so this second pass was effectively disabled
and any code that is conditional on defersleep=1 was never
exercised. The code to start the second scan also has issues.
Fix the end of VLRU test, and also correctly set the variables
needed to restart the scan.
Andrew Deason [Tue, 11 Sep 2012 18:59:21 +0000 (13:59 -0500)]
LINUX: Ignore 'offender' in error queue processing
The 'offender' is who generated the error, possibly who sent us an
icmp packet (the given 'port' will be 0). What we want is the peer
that is actually unavailable, which is already in the 'addr' variable
we received from the recvmsg itself.
Andrew Deason [Tue, 11 Sep 2012 17:48:14 +0000 (12:48 -0500)]
rx: Check for peer deadness in rxi_Resend
If we need to resend something, the peer we're sending to may be dead.
Check if the peer is dead in rxi_Resend, so we don't have to wait
(possibly several seconds) for the next rxi_CheckCall.
Andrew Deason [Fri, 7 Sep 2012 22:04:18 +0000 (17:04 -0500)]
LINUX: Allocate error queue buffer once
We call osi_HandleSocketError in a loop, so make sure we process all
of the errors. We were allocating a buffer to process the errors in
osi_HandleSocketError itself, but we can reuse the same buffer on
subsequent invocations, to reduce allocation/free pressure if we need
to call osi_HandleSocketError more than once. So, do that.
Andrew Deason [Fri, 7 Sep 2012 21:58:05 +0000 (16:58 -0500)]
rx: Process error queue after noticing errors
If errors exist in the socket error queue, we will notice by a sendmsg
or recvmsg returning an error. If we never get an error, we don't need
to check the error queue. So, only call osi_HandleSocketError after
such an error has been returned, so we can avoid unnecessarily
checking the error queue when there are no errors.
The fuse tests are fundamentally broken as they stand:
*) They rely on files that have not been committed to the tree. To
function correctly the file fuse/conf/CellServDB must be present
*) They always run, regardless of whether the fuse helper binaries are
installed on the developers system, or even on whether the tree was
built with fuse support enabled.
*) They pass, even if fuse fails to start up
*) The file fuse.sh is committed, despite being unused. This is
particularly confusing, as it looks like this is where the tests
are performed from (its not, testing is done in dynroot-t)
*) fuse-log should be either cleaned up, or flagged as ignored in
.gitignore
Revert the commit until such time as all these issues can be fixed
Simon Wilkinson [Wed, 10 Oct 2012 13:45:03 +0000 (14:45 +0100)]
tests: Reformat loopback tests
Reformat the loopback tests to match our house style - 4 spaces for
first indent, a tab for the second, and so on, opening brace of a
function on a newline, spaces around assignments, and so on.
Andrew Deason [Thu, 4 Oct 2012 20:49:56 +0000 (15:49 -0500)]
DAFS: VRS_r with VOL_SALVAGE_NO_OFFLINE in attach2
One caller of VRequestSalvage_r in attach2 was not passing the
VOL_SALVAGE_NO_OFFLINE flag. This really should be passed for every
place that manually sets vp->nUsers = 0, since then the VPutVolume_r
handlers will never fire.
Andrew Deason [Wed, 3 Oct 2012 19:44:46 +0000 (14:44 -0500)]
sys: Split up syscall.lo 'echo's
Currently we echo a string to syscall.lo to generate it. However,
'echo' is often a shell builtin, and some shells (such as bash) do not
interpret escape codes like \n unless the -e option is given. So, this
results in syscall.lo containing a single commented line, which
results in .libs/libafsrpc_sys.a not getting created, which later on
causes errors.
Instead, just split the syscall.lo generation into separate echo
invocations, to make sure we work everywhere.
in order that this can potentially be extracted entirely
to a platform-specific file, (and possibly dbus-equivalents
inserted also) consolidate the macos system events handling code
Andrew Deason [Tue, 2 Oct 2012 19:38:20 +0000 (14:38 -0500)]
afs: Avoid tracking file locks for RO volumes
Advisory file locks for RO volumes don't make a lot of sense, since
there are no possible writes to worry about. The fileserver already
does not track these, so don't even bother processing them in the
client.
Troy Benjegerdes [Mon, 27 Feb 2012 04:56:06 +0000 (22:56 -0600)]
Add some basic tests to check out fuse
Update makefiles to have 'make test' and 'make check' use the
_nolibafs build version, since there are no tests that (currently)
require the AFS kernel module to be built.
Clean up fuse test copyright notice, Alphabetize configure.ac
Jeffrey Altman [Mon, 1 Oct 2012 16:03:49 +0000 (12:03 -0400)]
Windows: File Info Query Symlinks
For Symlinks, always set the Reparse Point attribute and
set the Directory attribute if the target is a directory.
Do not return the file attributes of the target.
Jeffrey Altman [Mon, 1 Oct 2012 15:04:23 +0000 (11:04 -0400)]
Windows: Dir Enum behavior for Symlinks / MPs
Comparisons of the behavior of cmd.exe, powershell.exe, and tcc.exe
with regards to directory enumeration show that when Symlink file
information is returned that the "reparse point" data should be
reported along with whether or not the target is a directory.
For mount points, the reparse point file information should always
be returned and the type should always be directory.
The target timestamps, file sizes, etc. should never be returned.
The process type check in afsredir.sys was performed during the
Process Creation callback which is processed in the context of the
parent process which might not be the same type (32-bit or 64-bit)
as the process being created.
In commit 19f1e0f7cf40c3da1d49c789358bd814f7e3b3eb strdup()
was replaced by xdr_alloc() and memcpy(). Unfortunately,
the patch was wrong and the pointer to which the result of
xdr_alloc() was assigned was overwritten with zero.
All callers to AFSDoExtentsMapRegion() hold the ExtentsResource
so there is no need to obtain it again within the function. Instead
add an ASSERT to confirm that the resource is held.
The RDR_ParseIoctlPath and RDR_ParseIoctlPathParent functions
are helper functions within RDRIoctl.cpp. Make them static
and remove them from the header.
The cm_req_t structure flags store information related to
the source of the request and whether the process is WOW64 or not.
This information is required for proper pioctl processing. Add
a cm_req_t structure to the RDR_ioctl_t structure and initialize
it in RDR_SetupIoctl() which is called from RDR_PioctlOpen().
on 64-bit Windows, only 32-bit processes have the WOW64 request
type flag set. Reverse the conditional to permit proper evaluation
of the 64-bit sysname list.
Andrew Deason [Tue, 25 Sep 2012 16:16:35 +0000 (11:16 -0500)]
RedHat: Avoid the DKMS escaping silliness
Depending on the version of DKMS, the current MAKE[0] variable in the
dkms.conf needs different numbers of backslashes. Commit 81a9a33e
tried to address this by changing the contents of dkms.conf depending
on whether or not we were on Fedora. However, the change occurred in
DKMS 2.2, so if someone running RHEL tries to use a newer DKMS, this
will fail.
So instead of trying to guess at the level of escaping we need, just
avoid needing to escape anything with backslashes. We can quote the
heredoc marker to avoid variable expansion inside the heredoc, we can
use a case statement instead of using backticks and local variables
and such, and we can use single quotes for the outer MAKE assignment.
With this, we should not need any backslashes when writing dkms.conf,
so we should work with any DKMS version.
Casting NULL shouldn't be necessary in most cases. Eliminate this
in favor of shorter lines and consistency. Function pointers, variadic
arguments should still be cast.
Marc Dionne [Thu, 27 Sep 2012 01:37:33 +0000 (21:37 -0400)]
viced: Remove unused gettimeofday calls
StartTime and EndTime are set with gettimeofday(), but are not
used for any calcualtions or statistics, and appear to never have
been used. There are platforms where gettimeofday is expensive,
so remove the variables and the calls.
Andrew Deason [Mon, 24 Sep 2012 18:03:34 +0000 (13:03 -0500)]
LINUX: Define printf/uprintf as variadic macros
Instead of defining the string 'printf' itself, make printf (and
uprintf) variadic macros. This avoids renaming printf to printk for
things like '__attribute__((format(printf,X,Y)))'.
Note that this is Linux-specific; compilers on other platforms may not
support variadic macros.
This avoids many warnings in the Linux kernel module build if we
include Linux headers after AFS headers.
Andrew Deason [Thu, 30 Aug 2012 22:10:36 +0000 (17:10 -0500)]
rx: More afspag-specific objects
For Linux, each object in the kernel module needs to be in only one
module for KBUILD_MODNAME. For AFS_RXERRQ_ENV, we pull in some
additional headers that require KBUILD_MODNAME in rx. So, just add a
few more afspag-specific rx objects.
Change-Id: I80b4a8648141856dffce6e26d5c034dffd8dd5cf
Reviewed-on: http://gerrit.openafs.org/8113 Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Tested-by: Andrew Deason <adeason@sinenomine.net>
Andrew Deason [Tue, 11 Sep 2012 23:46:42 +0000 (18:46 -0500)]
rx: Save errno in LWP rxi_Sendmsg
Much of this code examines errno or WSAGetLastError to determine what
to do. However, some other operations between the actual sendmsg call
and code that examines errno may modify errno. So, save the value of
errno to ensure errno reflects the actual error we got from sendmsg;
this also slightly simplifies some of the logic.
Andrew Deason [Thu, 2 Aug 2012 19:02:09 +0000 (15:02 -0400)]
doc: Add quotes to bos create in DAFS QSG section
In appendix C in the QSG, we give an example 'bos create'. The given
-cmd arguments should have quotes, or they will be interpreted as
individual arguments to 'bos create'.
Marc Dionne [Wed, 19 Sep 2012 00:29:06 +0000 (20:29 -0400)]
quiet build: Define NOQ version of LT_LDLIB_lwp
When the command is invoked within a case statement, we need the
"NOQ" version of RUN_LD. Add the LT_LDLIB_lwp_NOQ variant and use
it under src/sys where LT_LDLIB_lwp causes a build error.
perluafs is a shared library, therefore we need to use the PIC version
of the opr library (just like any of the other libraries that have two
flavors and get linked with perluafs).
Marc Dionne [Sat, 15 Sep 2012 17:53:06 +0000 (13:53 -0400)]
rxkad: silence unused variable warnings in v5gen.c
Sprinkle AFS_UNUSED attributes where the compiler complains
about unused variables.
Note that this file is assembled from code generated by the heimdal
source. A similar fix exists in the generator code upstream, so
when the file is re-generated in the future it should not be
necessary to re-apply this.
Simon Wilkinson [Sun, 16 Sep 2012 18:54:48 +0000 (19:54 +0100)]
tests: Convert opr tests to use libtool
Avoid the problems with libopr's dependencies by just converting
the tests to use the libtool version of the opr library. While we're
at it, make the tests pthreaded too.
Change-Id: I4e570b288ea57c758c848be1d545e5ee59771ab9
Reviewed-on: http://gerrit.openafs.org/8127 Reviewed-by: Jason Edgecombe <jason@rampaginggeek.com> Tested-by: Jason Edgecombe <jason@rampaginggeek.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Simon Wilkinson [Sun, 16 Sep 2012 14:39:25 +0000 (15:39 +0100)]
Split up libtool support into LWP and pthread
Currently, the type of library you build is determined by whether
the library is build in a pthread, or an lwp build directory. However,
this prevents building an LWP library in a directory that builds
pthreaded clients and servers.
As we want to continue to provide LWP libraries for backwards
compatibility, but move over to pthreaded binaries, this causes
some issues.
So, split up the libtool logic, so we have Makefile.libtool, which
you include if you want to build a pthreaded libtool library, and
Makefile.lwptool, for building a library which supports LWP and
pthreaded use. These only affect how .lo files are built - so the
.o files used for non-library objects are managed with the
Makefile.pthread and Makefile.lwp includes as before.
Simon Wilkinson [Sun, 16 Sep 2012 16:48:08 +0000 (17:48 +0100)]
tests: Fix volser Makefile
The volser Makefile had a bad path for liboafs_util, and was still
directly pulling in some objects from the fileserver build. Fix it
so that it uses proper libraries.
Change-Id: Ic36c6a0f93c299bd04d48fa4238c4da5cbc571d4
Reviewed-on: http://gerrit.openafs.org/8125 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jason Edgecombe <jason@rampaginggeek.com> Tested-by: Jason Edgecombe <jason@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Marc Dionne [Fri, 14 Sep 2012 23:23:55 +0000 (19:23 -0400)]
libafsauthent: fix parallel build
Same logic as ee18ccbe - we have to avoid building libafsauthent.la
and libafsauthent_pic.la at the same time. Add a dependency to
force make to build them in sequence.
Simon Wilkinson [Fri, 14 Sep 2012 10:42:56 +0000 (11:42 +0100)]
opr: Libtool archive should depend on symbol file
There should be a dependency between the libtool archive
liboafs_opr.la and the symbol map for the archive
(liboafs_opr.la.sym) so the archive is rebuilt if symbols are added
to, or removed from, the map file.
Simon Wilkinson [Wed, 12 Sep 2012 09:20:43 +0000 (10:20 +0100)]
libafs*: Don't re-export opr/util functions
On Solaris, a library can't re-export functions which come from one
of its dependencies - so libafsrpc can't easily republish the 5 opr
functions that are currently in the libafsrpc map file.
Including the bits of the opr library that define these functions
causes problems with then linking libafsrpc against libopr, which
we do in a number of places.
libafsauthent has exactly the same problem, with a few symbols that
it pulls in from util.
The affected symbols were all added relatively recently, and have
limited uses outside of the OpenAFS tree, so just remove them from
the export list so we are one step closer to building on Solaris
again.
Simon Wilkinson [Fri, 31 Aug 2012 10:13:06 +0000 (11:13 +0100)]
libafsauthent: Build with libtool
Construct the libafsauthent library with libtool. All libraries
contributing to libafsauthent provide a libauthent_<library>.la
convenience library, which we use libtool to combine into shared
and static versions of libafsauthent.
Simon Wilkinson [Wed, 12 Sep 2012 05:53:24 +0000 (06:53 +0100)]
opr: Add hcrypto to the library list
uuid needs hc_RAND_bytes, which means that liboafs_opr has a dependency
on hcrypto (and, until hcrypto is libtooled, on libroken as well). Make
this dependency explicit.
Simon Wilkinson [Wed, 12 Sep 2012 05:51:08 +0000 (06:51 +0100)]
ptserver: Fix parallel builds
It's not safe to have libtool building a blah.lo at the same time as
gcc is building blah.o. A Makefile must exclusively use either the .lo
or the .o form.
Fix ptserver so that ptint.xdr.lo is the only one referenced, and just
explicitly pull in the LWP object for the ptserver.
Simon Wilkinson [Thu, 30 Aug 2012 11:41:04 +0000 (12:41 +0100)]
kauth: Use libtool
Modify the kauth directory so that we use libtool to build its library.
Unlike most of our other directories, kauth has few pthreaded consumers
within the tree, so the libtool library itself is currently unused. The
libtool conversion is done as a stepping point for libafsauthent, which
does include kauth objects.
At the same time, we take the opportunity to modify kaserver so that it
uses libkauth, rather than referencing the library objects directly