Russ Allbery [Fri, 24 Dec 2010 18:53:22 +0000 (10:53 -0800)]
Update NEWS for 1.5.78 and 1.6.0pre1
Based on the release notes. Add an entry for 1.6.0 with in progress
instead of a date to hold the release notes for 1.6.0pre1 rather than
creating separate entries for each release candidate. Users who track
the release candidates can refer to the public announcements, and this
will be cleaner when reading history later on.
Russ Allbery [Sat, 25 Dec 2010 01:18:38 +0000 (17:18 -0800)]
Supress errors when checking if kernel module loading is disabled
In the openafs-client init script, suppress errors from cat if the
modules_disabled flag file in /proc/sys/kernel doesn't exist, since
this was added in 2.6.31.
Russ Allbery [Thu, 23 Dec 2010 01:01:34 +0000 (17:01 -0800)]
Add $named to Should-Start for openafs-client
* Add $named to Should-Start in the openafs-client init script since the
client may do DNS lookups for the VLDB and file servers during startup
in some situations. (Closes: #586226)
Anders Kaseorg [Sat, 6 Nov 2010 07:03:19 +0000 (03:03 -0400)]
Linux: Fix AFS_NORETURN violation with osi_AssertFailK
Commit d86f0c44d3c5910a6b54895484dc0286eac9bc73 changed the
AFS_LINUX26_ENV implementation of osi_AssertFailK so that it returns,
contradicting its AFS_NORETURN prototype, in an effort to make the
following BUG() display the right line number. To fix this, move the
returning implementation into its only caller, the osi_Assert macro.
This fixes possible compiler misoptimizations due to
rx_kcommon.c:255:1: warning: ‘noreturn’ function does return
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/3276 Reviewed-by: Andrew Deason <adeason@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 1519144f83925d82117f31ce0872f77660f197ee)
Andrew Deason [Thu, 9 Dec 2010 00:16:14 +0000 (18:16 -0600)]
Add ioctl-based AFS calls for Solaris 11
Switch from using syscall-based AFS calls to ioctl-based AFS calls,
since syscall 65 was repurposed in some kernels in Solaris 11 and
OpenSolaris. Update the provided afs init script to accomodate the
additional steps needing for starting the AFS client.
Partially based off of some work by Derrick Brashear.
Andrew Deason [Thu, 9 Dec 2010 19:02:16 +0000 (13:02 -0600)]
DARWIN: Fix setpag syscall error detection
Darwin uses the same variable as the return value for
ioctl_afs_syscall, and as the last 'out' parmater, so the return value
for ioctl_afs_syscall will always overwrite whatever is written to the
last 'out' parameter. Instead, record two different variables, and
allow the returned error to overridte the error set as the last
parameter.
Andrew Deason [Thu, 4 Nov 2010 15:57:30 +0000 (10:57 -0500)]
UKERNEL: f_fsid is a struct on AIX
The statvfs f_fsid member is a struct with two fields on AIX when
_ALL_SOURCE is defined (which we define to get various extensions). So
in the AIX case, use it as such a struct instead of a single integer.
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.
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 [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.
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.
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.
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.
Ben Kaduk [Sun, 28 Nov 2010 04:25:03 +0000 (23:25 -0500)]
FBSD: clean up rx_socket teardown
We had previously been waiting for the SO_ISDISCONNECTED flag
to show up in the so_state field, but the flags are not really
used for stateless protocols such as UDP, and that flag never
shows up. Even with a full three-second wait, the rxk_Listener
sometimes still failed to fully terminate, preventing the reuse
of the rx port for a restarted afsd.
Copy from Solaris and loop until rxk_ListenerPid is zero, doing
bogus one-byte NetSends in the body of the loop.
Reviewed-on: http://gerrit.openafs.org/3391 Reviewed-by: Matt Benjamin <matt@linuxbox.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 622403c87a8cbcedcd1212fd32414285d103887b)
Ben Kaduk [Sat, 27 Nov 2010 04:28:50 +0000 (23:28 -0500)]
Catch up on FBSD releases
Add param.foo.h and sysname entries for the past and forthcoming
FreeBSD 7.2, 7.3, 7.4, and 8.2 releases. Also update the
MakefileProto.FBSD.ins that need touching, simplifying the libuafs
one in the process.
properly mark servers down for rx errors except OPCODE
if we get a negative (rx) error, it means the server is down,
*except* for RXGEN_OPCODE. make this handling consistent
(cherry picked from commit be770d4336c2fd7b8a83f18577ae6bb23a3f3e99)
The osi_PostPopulateVCache() routine in the OpenBSD version of
osi_vcache.c tries to use the non-existent variable "vc" instead
of "avc". This fixes it.
OpenBSD: Fix use of mstat Length field in osi_vm.c
The code for osi_VM_FlushPages() in osi_vm.c for OpenBSD incorrectly
tries to access field "m.Length" in the vcache structure "avc"
instead of "f.m.Length".
OpenBSD: Use Darwin version of afsi_SetServerIPRank() for OpenBSD 4.7 and above.
With OpenBSD 4.7, the ia_subnet and ia_subnetmask fields have been removed
from the in_ifaddr structure as part of a cleanup that considers them
unnecessary. Thus, the version of afsi_SetServerIPRank() that OpenBSD was
using no longer compiles. On the other hand, the Darwin version of this
routine seems suited to OpenBSD's needs since it doesn't use those fields
so we'll use that version for OpenBSD 4.7 and above instead.
Darwin: Assign correct value to myDstaddr in afsi_SetServerIPRank()
The value in sin->sin_addr.s_addr that's assigned to myDstaddr in the
Darwin version of afsi_SetServerIPRank() is in network byte order but
really needs to be in host byte order.
Note: This patch assumes that change I66f5c790d8c55b359e3550b6d71f3abe040a2820
has been previously installed. The patch fails otherwise.
Reviewed-on: http://gerrit.openafs.org/3402 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 2822416059fe192dc7e3c261b1e93510f2f10f3e)
Change-Id: I6fba524733ecf35e60419d449838e93a7a5255a6
Reviewed-on: http://gerrit.openafs.org/3452
DARWIN: Fix processing using rx_ifaddr_* macros in afsi_SetServerIPRank()
The macros rx_ifaddr_address, rx_ifaddr_netmask, and rx_ifaddr_dstaddress
all expand to a call to memcpy() which returns the destination address as
its return value. The test in the DARWIN version of afsi_SetServerIPRank()
for completion when using this macro, however, seems to assume that success
returns zero, which is wrong and results in myAddr, subnetmask, and
myDstaddr always being set to zero. This patch corrects this behaviour.
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.
Jeffrey Altman [Tue, 2 Nov 2010 20:16:20 +0000 (16:16 -0400)]
Windows: Do not leak cm_volume_t objects from the LRU queue
During cm_volume_t object recycling the object is removed
from the LRU to ensure that a single object is not recycled
by multiple threads at the same time. Before cm_FindVolumeByName()
exits the object must be re-inserted into the LRU if it is not
present.
as discovered by Benjamin Kaduk, we were usually holding rx_refcnt_mutex
but briefly, and here we held it longer, and thus around acquiring freepktQ
mutex. undo it by simply setting STATE_RESET sooner as newcall does.
Rx: protect rx_conn and rx_call refCount field with rx_refcnt_mutex
Add a new global mutex rx_refcnt_mutex to protect the conn->refCount
and call->refCount in place of relying upon the conn->conn_data_lock
and the call->lock.
This will relieve some lock contention with rx_ReceivePacket().
Rod Widdowson [Thu, 28 Oct 2010 17:34:41 +0000 (18:34 +0100)]
Windows: fix built in touch
Recent versions of windows add a whole bunch of attributes above
A_ARCH. (FILE_ATTRIBUTE_NOT_CONTENT_INDEXED was what bit be but
encryption of compression would do it).
This makes ~_A_ARCH not a good choice for testing nonwritability
of a file - so files with these new attributes just get silently ignored.
Using an explicit mask is much better. So do that.
Marc Dionne [Wed, 27 Oct 2010 00:33:41 +0000 (20:33 -0400)]
bucoord: parallel make fix
Fix an instance of a Makefile rule with multiple targets.
This can cause a parallel make to fail when two instances of
compile_et compete to write the same output files.
Spotted by a build failure with a corrupt bc.h header.
Jeffrey Altman [Thu, 28 Oct 2010 05:19:17 +0000 (01:19 -0400)]
Windows: Finish converting vol apps to pthread only
The src/vol directory on Windows is one of the rare examples
where a single directory builds both lwp and pthreaded versions
of libraries and executables. With this patchset the executables
are fully converted from lwp to pthread. This requires that
afsrpc.dll include the pthread implementations of the threadname,
fasttime, and lock implementations from the LWP directory.
The inclusion within afsrpc.dll permits the dviced and
dvolser directories to avoid rebuilding those object modules.
Ben Kaduk [Fri, 29 Oct 2010 16:01:04 +0000 (12:01 -0400)]
FBSD: lock interlock around v_usecount accesses
The FreeBSD vnode locking strategy requires that the vnode
interlock be held for all accesses to v_usecount, such as those
used by our VREFCOUNT and VREFCOUNT_GT macros. Conveniently,
a wrapper function is provided that takes the lock around its
access of the element, vrefcnt(). Use it for our macros.
Ben Kaduk [Fri, 29 Oct 2010 07:18:02 +0000 (03:18 -0400)]
FBSD: correct and simplify vcache eviction routines
osi_VM_FlushVCache and osi_TryEvictVCache were both attempting
to be wrappers around vgone(), with some checks before hand.
Implement the latter in terms of the former to prevent
code duplication and propagation of incorrect code.
Additionally, correct the locking around vgone(). The
vnode lock must be held, and we must also increase the vnode's
hold count so that it does not disappear out from under us.
As we need the interlock to check the usecount, keep it
locked until we lock the vnode lock, for extra protection.
As an added bonus, we no longer try to call vgonel(), which
is not an exported symbol and merely happened to work due
to the current kernel linker implementation.
Remove some stale comments.
With this change, a parallel buildworld completes on
my four-core machine.
Phillip Moore [Tue, 19 Oct 2010 15:31:47 +0000 (11:31 -0400)]
fs getfid defaults to '.', like other path-related commands
I noticed that all of the other commands that accept a list of paths
use the SetDotDefault() function to default to ".", when no arguments
are given. This patch adds that call to getfid, making it more
consistent with similar commands.
Phillip Moore [Tue, 19 Oct 2010 15:23:46 +0000 (11:23 -0400)]
fs getfid output changed for consistency with Windows implementation
This patch removes the redundant volume ID from the output of fs
getfid, and replaces it with the cell name, which is what the Windows
implementation provides.
Phillip Moore [Tue, 19 Oct 2010 12:24:41 +0000 (08:24 -0400)]
Makes fs getfid error handling consistent with other fs commands
This patch makes the fs getfid command print errors for paths that
can't be handled correctly, instead of quietly ignoring them, and it
also returns an error code if any such paths are encountered. This
makes the behavior consistent with other fs commands, such as
listquota, whereis, etc.
Phillip Moore [Tue, 19 Oct 2010 16:17:20 +0000 (12:17 -0400)]
Fix fs bypassthreshold to accept a size of -1 to disable
The fs bypassthreshold command assumes a value of -1 means the feature
is disabled, but the CLI refused to accept this argument, since it is
not strictly a digit (according ti isdigit()). This patch accepts the
string -1, and makes it possible to both enable AND disable this
feature.
Reviewed-on: http://gerrit.openafs.org/3009 Reviewed-by: Matt Benjamin <matt@linuxbox.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@openafs.org> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 1fa575c09ea7aa66e657b226465cb90dbba4af70)
Change-Id: I0e748b513bcb97c436bd10c8a80222fc10fce08c
Reviewed-on: http://gerrit.openafs.org/3228
Andrew Deason [Fri, 2 Jul 2010 21:57:42 +0000 (16:57 -0500)]
DAFS: Fix demand-salvages of attached volumes
Currently, when an error is encountered for an attached volume, we
call VRequestSalvage_r, which makes the volume go into the
VOL_STATE_SALVAGING state. This state implies that the volume is
offline, however, which is not necessarily the case if we're calling
VRequestSalvage_r from, for example, VAllocVnode_r or VUpdateVolume_r.
So now, make a new state called VOL_STATE_SALVAGE_REQ to indicate when
a salvage has been requested but the volume is not offline yet (and
thus is not yet ready to give to the salvager). If VCheckSalvage finds
a volume in this state, it offlines the volume first. The FSSYNC
VOL_OFF handler now checks for this state, and if we're giving the
volume to the salvager, we wait for the volume to exit that state.
VRequestSalvage_r also gains a new flag, VOL_SALVAGE_NO_OFFLINE. This
is to ensure that the existing salvaging code paths for unattached
volumes does not change (for when VRequesetSalvage_r is called from
attach2). If this flag is passed, we do what we used to do, which is
just salvage the volume without offlining it.
Jeffrey Altman [Thu, 28 Oct 2010 04:37:03 +0000 (00:37 -0400)]
vol: attach2 must always return with VOL_LOCK held
attach2() is required to return with the VOL_LOCK held
even though it is called without it. This must be true
for error conditions as well. Not all error paths are
obtaining the VOL_LOCK before returning. Add out paths for
lock held and lock unheld error cases.
Russ Allbery [Tue, 2 Nov 2010 17:15:21 +0000 (10:15 -0700)]
Don't attempt stop if module unloading is disabled
* In the openafs-client init script, don't attempt to stop or restart
the AFS client if module loading is disabled. Stopping afsd without
unloading the module would leave the system in an inconsistent state.
Jeffrey Altman [Thu, 14 Oct 2010 21:24:33 +0000 (17:24 -0400)]
down with assert, up with osi_Assert
because NDEBUG breaks things which happen inside an assert,
be done with that. instead, call osi_Assert wherever possible.
doesn't work for code which builds before rx; those cases we handle
by ensuring no operations happen inside the assert(). side effect:
move all pthread operations wrapped in asserts to MUTEX_mumble and
CV_mumble calls where those exist, so the assertions happen all in
one set of macroes.
Jeffrey Altman [Thu, 14 Oct 2010 21:24:33 +0000 (17:24 -0400)]
Rx: use osi_Assert/osi_Panic instead of assert
Avoid using the openafs src/util/assert.h implementation for Rx
and Rx security classes. Use the built-in osi_Assert() and osi_Panic()
functionality instead. This avoids all references to assert.h except
for rx_pthread.c (Unix only) which requires it for the assert()
references in the src/util/pthread_nosigs.h macros.
Jeffrey Altman [Mon, 11 Oct 2010 19:00:08 +0000 (15:00 -0400)]
Windows: Cleanup build scripts; no include\afs or include\rx
As part of the build system cleanup, minimize the number of
directories in which include\afs and include\rx paths are included
by default. To acheive this goal the windows openafs dirent.h is
moved from include\afs to include, references whenever possible to
openafs headers included in include\afs or include\rx are prefixed
with afs\ or rx\ as appropriate.
Some source files or directories have a broad range of interdependencies
that make separation quite challenging. For those directories or files
the inclusion of the path is added at the smallest possible level.
At some point in the future the WINNT\afsd\ headers should be moved
from include\afs to include\WINNT and should be installed there first
and then referenced internally from that location instead of from the
WINNT\afsd directory. That will permit further cleanup to be performed.
Simon Wilkinson [Mon, 25 Oct 2010 19:50:29 +0000 (20:50 +0100)]
rx: Fix starting of transmit timers
The code used to start the transmit timer once for every set of packets
that it sends. However, these packets might be sent individually or in
clumps, with blocking for sendmsg, and on peer->lock, between each set
of packet sends. This has the effect of, even on a very stable network,
producing a high degree of variation in RTTs and timeouts. This is a
particular issue where the connection size is larger, as the number of
packets being sent individually under the one timer grows too.
Fix this by moving timer initialisation to SendList. This already takes
the peer lock, so obtain the timeout value here too. This means that
each jumbo gram, or individual packet (where jumbograms are disabled)
is sent with its own start time, and stabilises RTTs.
Simon Wilkinson [Mon, 25 Oct 2010 09:14:12 +0000 (10:14 +0100)]
rx: Don't let timeouts force fast recovery
The current RX implementation goes into fast recovery whenever a
timeout occurs. This is incredibly wasteful, particularly on fast
connections. So, remove this in favour of TCP style behaviour.
Jeffrey Altman [Sun, 17 Oct 2010 04:35:36 +0000 (00:35 -0400)]
Windows: Use rx_Readv / rx_Writev
When USE_RX_IOVEC is defined, cm_BufWrite() will utilize rx_Writev()
instead of rx_Write() and cm_GetBuffer() will use rx_Readv() instead
of rx_Read() to improve throughput.
Asanka C. Herath [Mon, 18 Oct 2010 08:52:34 +0000 (04:52 -0400)]
Windows: Backup and restore configuration across installs
The MSI installer for OpenAFS does not preserve configuration data
across installs. This patch creates a backup of specific
configuration registry values when uninstalling OpenAFS and uses this
backup when subsequently installing OpenAFS.
Simon Wilkinson [Sat, 23 Oct 2010 14:07:42 +0000 (15:07 +0100)]
rx: Tidy up variables in RTT calc
We used to do rttp = &thisRtt, and then use rttp and thisRtt to
interchangably refer to the same data. This is just confusing, and
unnecessary. Replace all of the occurences of rttp with &thisRtt.
Take the opportunity to use the Clock_IsZero macro rather than doing
an explicit zero clock check.
Simon Wilkinson [Sat, 23 Oct 2010 13:51:56 +0000 (14:51 +0100)]
rx: More improvments to RTT calculation
Move the decision about whether a packet contributes to the peer's
rount trip time into the CalculateRoundTripTime function, and improve
the criteria used.
Previously, we only computed the RTT if we had not retransmitted. This
is bad, because it means that places where we have backed off in order
to retransmit never actually lengthen the RTT, and so the RTT is kept
artificially low, and we see a large number of retransmits. Instead,
use the serial of the ACK packet to determine which transmission is
being acknowledged, and if it is the first, or the last, transmission
use the appropriate sent time to calculate the RTT.
If we have no serial in the ACK (for a delayed ack, for example), or
if the serial doesn't match (where a single acknowledgement is soft
acking a number of packets), fall back to only using the ack if the
packet has not be retransmitted.
Also, avoid multiple counting of packets which have arrived as part
of a jumbogram by only permitting the last packet in a jumbogram to
contribute to the RTT. This avoids giving the RTT of jumbograms more
weight than those of normal packets - doing so would pull down the
RTT, as it in effect favours packets which have not be retransmitted.
Jeffrey Altman [Thu, 21 Oct 2010 18:13:03 +0000 (14:13 -0400)]
Rx: Treat rx_minPeerTimeout not as a minimum but as padding
An improved RTT and timeout calculation algorithm is being
developed but until we have it, treat rx_minPeerTimeout not as
a minimum value for the timeout but as padding to be added to
the measured RTT when computing the peer timeout value.
With this change rx does not begin to send large numbers of
resends when the RTT begins to exceed the rx_minPeerTimeout
value. Timeout triggered resends at the moment can force rx
into fast recovery mode which in turn kills performance. It
is better to avoid that problem for now.
Jeffrey Altman [Thu, 21 Oct 2010 18:23:18 +0000 (14:23 -0400)]
Rx: Fix socket() handling so errors are properly detected
socket() returns an osi_socket which on Windows is an
unsigned type (HANDLE). Therefore, tests of osi_socket < 0
will never identify when the INVALID_SOCKET value is returned.
On Windows, the OSI_NULLSOCKET is assigned to INVALID_SOCKET.
Replace all comparisons of (osi_socket < 0) with
(osi_socket == OSI_NULLSOCKET) as a means of detecting errors.
In addition, do not pass socket() the protocol value 0 when
IPPROTO_UDP is what is desired.
Finally, perror() on Windows never reports any error from Winsock.
perror() is a CRT function. To get the real socket error
WSAGetLastError() must be called and its value be written to
stderr.