Andrew Deason [Wed, 13 Apr 2011 18:15:57 +0000 (13:15 -0500)]
Add "pretty" build option
Add the capability to do a "pretty" build, where we output something
like " CC /path/to/foo.o" to build foo.o, instead of the entire
compiler invocation, similarly to how the Linux kernel build appears.
Add the "pretty" building for CC and LD rules.
This also prints out some helpful information when a command fails,
which can sometimes otherwise be annoying to figure out post-mortem.
To enable the pretty building, make with V=0. To output everything
that is actually run with V=0, make with 'V=0 Q=' .
Note that this does not work with all makes, since not all makes will
propagate command-line-specified variables to sub-makes without -e.
Non-working makes include /usr/ccs/bin/make on HP-UX and Solaris.
However, GNU make will work, as will /usr/xpg4/bin/make on Solaris.
Andrew Deason [Tue, 8 Nov 2011 18:29:39 +0000 (12:29 -0600)]
Specify pattern rules in addition to suffix rules
A few makefiles specify an old-style suffix rule, such as:
.c.o:
$(AFS_CCRULE) $<
Not all makes seem to interpret these rules correctly (such as Solaris
/usr/xpg4/bin/make). Since it is easy to do so, specify pattern-based
rules along with these, like so:
Andrew Deason [Thu, 3 Nov 2011 18:17:33 +0000 (13:17 -0500)]
salvager: Implement AskDAFS via SYNC flags
Instead of probing the DAFS-ness of the fileserver by probing which
FSSYNC opcodes it supports, detect DAFS-ness by looking at the SYNC
response header flags, which explicitly state whether or not the
endpoint is DAFS. This avoids unnecessary "protocol mismatch" log
messages when the endpoint is not DAFS.
Andrew Deason [Fri, 4 Nov 2011 22:19:28 +0000 (17:19 -0500)]
volser: Remove debugging log messages
While the -log option to volserver is supposed to print additional log
information, it shouldn't spam the log with useless data. Remove some
of the log lines that are really more "debug" information, so we log
the same amount of information as in the 1.4 series.
Andrew Deason [Fri, 4 Nov 2011 17:42:33 +0000 (12:42 -0500)]
DAFS: Deal with exclusive-state volume headers
GetVolumeHeader assumes that headers on the LRU are not associated
with a volume in an exclusive state. This is known to not be true for
some cases when salvage requests are received over FSSYNC, and may be
true in other scenarios. It's easy to just skip such headers, so skip
them.
Jeffrey Altman [Fri, 4 Nov 2011 13:34:53 +0000 (09:34 -0400)]
Windows: NPCancelConnection set correct length
The RemoteNameLength passed in the IOCTL_AFS_CANCEL_CONNECTION call
must not include the trailing NUL. NPGetConnection() returns the
size of the buffer used which does include the trailing NUL.
Jeffrey Altman [Thu, 3 Nov 2011 18:14:52 +0000 (14:14 -0400)]
Windows: Simplify KFW_AFS_klog
Reduce the complexity of KFW_AFS_klog. Introduce
KFW_AFS_continue_aklog_processing_after_krb5_error() and
combine the input realm and realm_of_cell cases making
use of the RealmName variable.
Ken Dreyer [Mon, 31 Oct 2011 14:27:16 +0000 (08:27 -0600)]
doc: limitations of addsite on different partitions
A user on the openafs-info mailing list noted that the Admin Guide is
unclear about creating read-only replicas on different partitions on
the same fileserver. Clarify the rules here.
Jeffrey Altman (2):
Windows: fallback to PROV_RNG if no PROV_RSA_FULL
roken: posix errnos for windows
Love Hornquist Astrand (3):
drop __restrict to please old compilers
add krb5_is_enctype_weak
Don't export tests from library, reported in bug from Tom Payeire
Andrew Deason [Wed, 2 Nov 2011 16:35:42 +0000 (11:35 -0500)]
Solaris: Specify ARCHFLAGS in CFLAGS
Various autoconf tests which use the C compiler may yield different
results depending on whether or not we are compiling for x86 or amd64
on Solaris (different libraries are available, structures may be
different, et al). So, set CFLAGS depending on which arch we are
targeting, so the autoconf results are more consistent with the actual
compilation during the build.
Andrew Deason [Wed, 2 Nov 2011 16:32:56 +0000 (11:32 -0500)]
Do OPENAFS_OSCONF before compiler autoconf tests
OPENAFS_OSCONF can set the C compiler we use, as well as changing
various compiler flags. These changes can alter autoconf tests, so
allow OPENAFS_OSCONF to change these before various autoconf tests are
performed which require the C compiler.
Andrew Deason [Wed, 2 Nov 2011 15:43:54 +0000 (10:43 -0500)]
Remove -settime/RXAFS_GetTime client support
Remove the -settime option from afsd, and any code for making
RXAFS_GetTime calls in libafs. Server probes have been replaced by
calls to RXAFS_GetCapabilities, and the actual functionality of
synchronizing the system clock has been superseded by other systems
like NTP. Issue a warning for all code paths that try to enable
-settime support.
Historical note: the code that this commit is removing contains bugs.
Do not simply revert this commit to turn on -settime support again.
Andrew Deason [Thu, 3 Nov 2011 17:33:55 +0000 (12:33 -0500)]
external: trigger git commit-msg hooks on import
When we import commits, the new commit does not have a Change-Id in
the commit message. Usually a git commit-msg hook will be installed to
automatically insert a Change-Id into the commit message if one does
not already exist, so trigger the hook by performing a no-op 'git
commit --amend'.
Andrew Deason [Thu, 3 Nov 2011 17:27:22 +0000 (12:27 -0500)]
external: commit imports with --no-verify
Currently, importing external commits with import-external-git.pl may
fail if the current repository checks for whitespace errors, and the
external commits contain whitespace errors. So run the commit with
--no-verify, so we can make the commit before fixing up the whitespace
errors immediately afterwards.
Peter Scott [Wed, 2 Nov 2011 23:29:00 +0000 (19:29 -0400)]
Windows: fix deadlock in symlink Attrib retrieval
Commit df22620f66f5ce92776177d4d800fc7f4ae4ae99 introduced a
deadlock when retrieving file attributes for symlink objects.
To correct the deadlock, do not hold the Fcb locks during the
AFSRetrieveFileAttributes() call.
Peter Scott [Wed, 2 Nov 2011 23:25:36 +0000 (19:25 -0400)]
Windows: remember when a reparse point is opened
If the mount point or symlink is opened as a reparse point
we must remember that in the Ccb so that later reparse point
processing can be implemented properly. For now remember
with the CCB_FLAG_MASK_OPENED_REPARSE_POINT flag.
Jeffrey Altman [Fri, 14 Oct 2011 13:10:19 +0000 (08:10 -0500)]
klog.krb5: enforce DES for rxkad
0. Always request a TGT regardless of the state of
writeTicketFile.
1. request des-cbc-crc when requesting a ticket for an
rxkad service principal
2. check the returned key length to ensure that it matches
the permitted length of an rxkad key. If not, generate
an error instead of overwriting memory and continuing.
FIXES 130278
Change-Id: Ib7d27acc60c1b38dab4e2a56f83643477afb9721
Reviewed-on: http://gerrit.openafs.org/5619 Tested-by: BuildBot <buildbot@rampaginggeek.com> Tested-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementix.org>
Peter Scott [Mon, 31 Oct 2011 22:05:31 +0000 (18:05 -0400)]
Windows: log FSCTL_CSC_INTERNAL requests
FSCTL_CSC_INTERNAL requests are not supported and will
return STATUS_INVALID_DEVICE_REQUEST. However, log them
for easier debugging.
FSCTL_CSC_INTERNAL is defined in ntifs.h only for
Vista and above. Since afsredir is built for XP
and above its value must be conditionally defined
by us.
Peter Scott [Sat, 29 Oct 2011 17:55:46 +0000 (13:55 -0400)]
Windows: Directory Entry Processing
Memory corruption was detected due to improper handling
of directory entries and the short name b-tree during
directory revalidation and tear down. The problem
resulted in a BSOD most frequently when roaming profiles
were written back to the file server or when multiple
clients were actively modifying the contents of a directory
simultaneously.
This patchset makes a number of changes:
. rename processing no longer handles collisions locally.
the file server replaces a target atomicly when there
is a collision.
. directory validation is no longer delayed until
a handle is closed
. data version numbers are checked for implied
invalidation
Marc Dionne [Sat, 29 Oct 2011 23:23:07 +0000 (19:23 -0400)]
Linux: 3.1: update RCU path walking detection in permission i_op
The permission() inode operation changed again with kernel 3.1,
back to the form it had before 2.6.38. This compiles fine,
but is missing the new way of detecting when we get called in
RCU path walking mode, resulting in system hangs.
Simon Wilkinson [Tue, 21 Jun 2011 17:32:02 +0000 (18:32 +0100)]
rx: Remove the ADAPT_WINDOW code
RX still has the remnants of an old mechanism for doing RTT and
congestion window detection. This code is #ifdef'd out using
the ADAPT_WINDOW define, but is pretty much unservicable these days,
as it collides with the TCP style implementation (with ADAPT_WINDOW
enabled, both will attempt to manipulate a connections RTT and
window size)
As the current TCP-style RTT and window calculation seem to work
much better in deployment, and there isn't much hope for us being
able to maintain two different congestion mechanisms, just remove
ADAPT_WINDOW. It is in git, if we ever want it back (not that I
think we ever would).
Jeffrey Altman [Fri, 28 Oct 2011 15:36:10 +0000 (11:36 -0400)]
Windows: out of date version not in current chunk
In buf_GetNewLocked(), the comparision to decide whether a
cm_buf_t is a member of the current chunk must take the data
version into account. If the data version is out of date, it
is not part of the current chunk and is an object that can be
safely recycled.
Edward Z. Yang [Tue, 18 Oct 2011 03:16:15 +0000 (23:16 -0400)]
linux: Update Packaging to build OpenAFS services for Fedora's systemd
Fedora 15 now uses systemd (see http://fedoraproject.org/wiki/Systemd)
for the OS init system. While it currently has backwards
compatibility with older SysV-style init scripts, future versions of
Fedora may no longer support it, and OS startup tends to be faster
with the systemd service units. Also, systemd runs all the service's
processes within a linux kernel cgroup.
(see http://www.kernel.org/doc/Documentation/cgroups/cgroups.txt)
This change includes an openafs-client.service and
openafs-server.service unit files for the client and server packages
respectively.
Client
- Loading the openafs module was moved into
/etc/sysconfig/modules/openafs-client.modules. This causes the OS to
load the module on boot. This is the preferred way for modules to be
loaded with Fedora. (See
http://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/sec-Persistent_Module_Loading.html
for more details)
- The CellServDB file is generated with sed rather than cat.
This change was made because Systemd doesn't execute as a shell
script, but rather executes processes directly. Rather than invoking
a shell to concatenate the CellServDB.* files, they're written to the
CellServDB file using a sed oneliner.
- Do all of the proper kernel module loading and unloading.
Server
- Since systemd uses cgroups, when the service is shut down, all
processes in the openafs-server.service cgroup will be terminated.
The other changes are standard as per:
http://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
Original version by Jonathan Billings <jsbillin@umich.edu>.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Change-Id: Ifb41790ffe107b319097b9750273aecfe82c3349
Reviewed-on: http://gerrit.openafs.org/5637 Reviewed-by: Derrick Brashear <shadow@dementix.org> Reviewed-by: Alex Chernyakhovsky <achernya@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
Jeffrey Altman [Thu, 27 Oct 2011 21:57:25 +0000 (17:57 -0400)]
Windows: only flush buffers on shutdown if running
If a service shutdown message is received prior to the
service entering the running state, do not attempt to
buf_CleanAndReset() because the required data structures
and locks are not initialized.
Jeffrey Altman [Tue, 25 Oct 2011 19:32:11 +0000 (15:32 -0400)]
Windows: Do not EEXIST exact match during rename
AFS Rename operations on the file server will delete a
target file if it exists. Do not prevent renames because
an exact match of the target name exists in the target
directory.
Rod Widdowson [Sat, 22 Oct 2011 15:46:26 +0000 (16:46 +0100)]
Windows: Look for 8.3 name when doing a rename
If we are doing a destructive rename we need to find whether the
target file exists. This is done in the usual way (case sensitive
case insensitive), but the short name is not looked for.
This means that the rename of a file to a short name will not
supersede correctly; rather the service refuses the rename since
the target existed already.
This patch looks the target name up in the shortname tree if the
target name is short and all else has failed.
Jeffrey Altman [Mon, 17 Oct 2011 13:28:11 +0000 (09:28 -0400)]
Windows: free pointer after last reference
This is a superficial change but is being done for readability.
If given the choice of freeing memory and then testing the pointer
value or vice-versa, test the pointer value first.
Jeffrey Altman [Mon, 17 Oct 2011 13:22:53 +0000 (09:22 -0400)]
Windows: AFSEvaluateTargetByName free buffer if no return
For consistency with other functions in AFSCommSupport
modify AFSEvaluateTargetByName to free the DirEntry on
completion if the caller has not provided an out parameter
to accept it.
Rod Widdowson [Sat, 22 Oct 2011 14:00:03 +0000 (15:00 +0100)]
Windows: Defer deref of a directoryEntry
During the handling of SL_OPEN_TARGET opens (usually associated
with a rename) a directory entry was deferenced prior to its
contents being used (to set up a seconding inforation field).
This change just holds on to the reference until after that processing.
Rod Widdowson [Fri, 21 Oct 2011 15:57:02 +0000 (16:57 +0100)]
Windows: Set new file index correctly during rename
Directory entries are required to have a file index which is used during
directory enumeration. When inserting into a new directory we have to
update this from the target directory.
This code fixes a bug whereby it was being set from the source FCB, rather
than the target one. On failure we now also reset the value to its old value.
allow cloning of any volume to any volume with same parent ID
remove checks to disallow cloning of ro volumes to rw volumes,
which allows cloning of any volume within the same parent ID
grouping, including allowing destruction of newer version of the
volumes.
remove check for disallowing clones of backup or ro volumes
removes the if-statement ensuring that the volume being cloned is
not a backup volume, nor a read-only volume. This allows clones
from any type of volume to a given volume. Parent volume meta-data
is maintained, only the cloneId value changes.
Andrew Deason [Mon, 29 Aug 2011 22:41:31 +0000 (17:41 -0500)]
DAFS: Remove VOL_SALVAGE_INVALIDATE_HEADER
Currently VRequestSalvage_r takes a flag,
VOL_SALVAGE_INVALIDATE_HEADER, which causes the header for the
specified volume to be freed (via FreeVolumeHeader). This is almost
never safe to do, since there may be other users of the specified
volume that can be accessing the volume header at the same time.
There is also no reason to invalidate the header at the time of the
VRequestSalvage_r call, since the header must be invalidated when we
detach the volume (other utilities may change header information). So,
if there are any problems in the future because we do not invalidate
the header at the time of VRequestSalvage_r, it is the fault of the
detachment/offlining logic.
So, remove VOL_SALVAGE_INVALIDATE_HEADER and all of its users. Take
this opportunity to correctly document the VRequestSalvage_r headers
in the VRequestSalvage_r comment, as it was previously missing the
VOL_SALVAGE_NO_OFFLINE flag.
Michael Meffie [Thu, 13 Oct 2011 16:23:35 +0000 (12:23 -0400)]
DAFS: fssync online requires a partition name argument
fssync-debug online silently fails when run without a partition name.
Check for the required partition name on the server side and the client
side. Report errors back to the client when the server side fails to
pre-attach the volume.
Andrew Deason [Tue, 11 Oct 2011 15:51:14 +0000 (10:51 -0500)]
volser: Remove ExtractVolId
volser was using its own function to extract a volume ID from a
filename string, and was using atol to do so. The ato* family of
functions can have problems with larger volume IDs, not to mention a
lack of error checking, so don't use it. Since we already have the
function VolumeNumber in the vol package to do the very same thing,
just use that instead.
Andrew Deason [Mon, 3 Oct 2011 18:10:44 +0000 (13:10 -0500)]
viced: Check for HOSTDELETED in stillborn check
h_FindClient_r checks the connection rock for a client object twice.
First it sees if we already have a client object, and if we don't, we
effectively create one (or find a suitable one). Then we check again,
to see if someone else set the rock while we were creating a client
structure.
Currently, the first check checks if client->host->hostFlags has
HOSTDELETED set, but the second check does not. So, if the host
associated with the client has been deleted by someone else, currently
we will unnecessarily log a "stillborn client" message, and we will
continue to use the deleted host. If the host continues to be held by
someone, we will run into the same situation repeatedly on future
requests until all of the host references go away.
To fix this, also ignore HOSTDELETED clients when performing the
stillborn race check.
Andrew Deason [Fri, 14 Oct 2011 16:32:34 +0000 (11:32 -0500)]
vos offline: Bring volume back online for -busy
vos offline is supposed to bring a volume back online from "busy"
status before exiting, as volumes should not be in "busy" status for
extended periods of time. This was being enforced by required that
-sleep be specified; however, -sleep only results in the volume being
brought back online if a non-zero sleep time was specified. So, make
sure the volume is brought back online if -busy was specified.
Rod Widdowson [Sat, 22 Oct 2011 13:27:41 +0000 (14:27 +0100)]
Windows: Remove unused cleanup flag
In AFSOpenTargetDirectory the flag bRemoveShare was initialized
FALSE and never set TRUE. In teardown after failure some code
did listen to the flag, but the operation (IoRemoveShareAccess)
was not protected by the FCB mainlock which it should have been.
Rather than get the locking correct, just remove the flag entirely.
do set errors when we bomb out early
do not unlock and return early when we happen to do a correct zero
length read
do set errors the kernel can deal with if we're feeding a page routine
Marc Dionne [Mon, 24 Oct 2011 02:45:21 +0000 (22:45 -0400)]
dir: add missing return in DRead
A missing return in the kernel version of DRead causes the code to
think that no entry exists for a dir and proceed to allocate a new
one, if the entry is the third one in the hash chain.
If the existing entry is dirty, its contents are never written back,
and the pending changes to the directory are not seen by the client.
Simon Wilkinson [Sun, 23 Oct 2011 23:07:33 +0000 (19:07 -0400)]
rpm: Turn on debugging
Now that we build with a blank CFLAGS line, we need to make sure and
actually turn on debugging in the build system, so that our debuginfo
files are vaguely useful
Simon Wilkinson [Sun, 23 Oct 2011 20:23:34 +0000 (21:23 +0100)]
rx: Define afs_kmutex_t for LWP too
afs_kmutex_t is used for lock definitions in the kernel, and in
pthreaded builds. LWP doesn't have any equivalent, and all structure
members using this type have to be protected with RX_ENABLE_LOCKS, which
starts to become untidy.
Just make afs_kmutex_t an int for LWP, so that we can simplify our
headers, at the expense of some additional storage on LWP builds (which
are going away at some point, anyway)
Simon Wilkinson [Sun, 23 Oct 2011 15:38:13 +0000 (16:38 +0100)]
dir: Don't leak a buffer on a failed Enumerate
If, for some reasons, Enumerate encounters a hash object with a NULL
buffer pointer, that's no reason to leak the hash object. Make sure
that we DRelease it before failing
Simon Wilkinson [Wed, 12 Oct 2011 13:50:18 +0000 (09:50 -0400)]
rx: ackall handling
If we ACKALL a stream, then we're sending a hard ACK for all of the
packets in the stream. We shouldn't send that hard ACK, and then a
load of soft ACKs for packets that don't actually exist.
Andrew Deason [Fri, 12 Aug 2011 19:50:26 +0000 (14:50 -0500)]
LINUX: Revert group changes on keyring failure
On Linux kernels that support keyrings, when we setpag we try to add
the PAG to the session keyring and to the supplemental group list.
Currently, if we fail to add the PAG to the keyring (which may happen
due to key quotas, or possibly other reasons), we return failure but
the group list is still modified with the new PAG in it.
Therefore, if the keyring-based approach fails, the new PAG may still
be in use, but there are no keyring keys associated with that PAG, so
the PAG may never get destroyed. This can cause a large number of PAGs
to accumulate over time, causing performance problems.
So, change this so that, in the event that keyring installation fails,
we revert the group list back to what it was before we touched it.
Also mark all unixusers with the new PAG as expired, in case one got
created during processing. Thus, the new PAG never gets used.
Andrew Deason [Thu, 20 Oct 2011 21:57:14 +0000 (16:57 -0500)]
viced: Do not swallow errors on StoreData recovery
When we encounter any error in the StoreData fetch/store loop, we
reset the disk usage to ensure it remains correct, even in the face of
unexpected errors. However, when we do so, we use the errorCode from
VAdjustDiskUsage as our return value; if it is 0, we return success,
ignoring the error that got us in this code path in the first place.
Instead, keep track of a temporary errorCode for the disk usage
adjustment, and do not override our return value if there was no error
in the disk usage numbers.
Simon Wilkinson [Sat, 22 Oct 2011 08:43:41 +0000 (09:43 +0100)]
opr: Move queue header out of util
Move the header which is installed as opr/queues.h out of util/ and
into the new, top level, opr/ directory. Similarly move the tests out
of the util/ test suite, and into the opr/ tests
Simon Wilkinson [Tue, 11 Oct 2011 00:01:26 +0000 (19:01 -0500)]
dir: Remove double release in FindBlobs
When DRead() fails, we DRelease the entrybuf, then break. However,
this break takes us to the end of the function, where we promptly
DRelease again, causing a double free
Simon Wilkinson [Wed, 12 Oct 2011 17:04:28 +0000 (13:04 -0400)]
ukernel: add morepackets check in listener
Make the listener loop actually check for more packets needed,
like kernel, pthreads and lwp. Only checking for new packets every
20 seconds isn't sufficient on today's networks!