Andrew Deason [Tue, 10 Aug 2010 19:16:39 +0000 (14:16 -0500)]
viced: VNOVOL on deleted volumes
When the volserver deletes a volume, the fileserver should respond to
future access to that volume with VNOVOL and not VOFFLINE, since the
volume doesn't exist anymore. Do this in DAFS via a new state,
VOL_STATE_DELETED, and in non-DAFS by just setting specialStatus to
VNOVOL.
In the future we should also make sure the vp's for deleted volumes
get freed after a couple of hours, but not yet.
Andrew Deason [Fri, 6 Aug 2010 19:32:16 +0000 (14:32 -0500)]
volser: Ignore duplicate file tags when restoring
Currently, if the volserver encounters multiple file tags for a vnode
when restoring a volume dump, it will create extra vnodes which are
not recorded anywhere, and are leaked when the volume is removed.
Instead of doing that, ignore any duplicate file tags that are
encountered (which is what happens with other tags), and log a
warning.
Simon Wilkinson [Wed, 11 Aug 2010 22:14:31 +0000 (23:14 +0100)]
LINUX: More flock fixes
Turns out the we have two almost identical lock routines on Linux,
one for POSIX locks, and one for flocks. Fix them both. Also,
while we're at it, make the same fixes in the LINUX24 tree.
this is a short-term hack. macos lacks pags, and anywhere without
pags won't have tokens when fs discon online is run as root unless
the tokens are explicitly set for root... which can be bad mojo.
Simon Wilkinson [Wed, 11 Aug 2010 16:25:36 +0000 (17:25 +0100)]
LINUX: Use correct type of error in flock code
The flock code gets a kernel error code from afs_posix_lock_file()
but then passes this error code through afs_convert_code (which sees
that it is already negative, and returns EIO). Instead, we should just
return afs_posix_lock_file()'s code direct to our caller.
Jeffrey Altman [Wed, 11 Aug 2010 05:10:38 +0000 (01:10 -0400)]
Windows: cm_Analyze should treat VOFFLINE like VMOVED or VNOVOL
Volume package bugs in the file server can result in VOFFLINE
being returned to the client instead of VNOVOL or VMOVED. As
a result the Unix CM treats VOFFLINE the same as VMOVED and VNOVOL.
The Windows client has not. As a result, bugs in the file server
can cause the Windows client to lose if the volume has in fact
been moved to another server.
As part of this change, the volume location list is updated prior
to the volume status being applied to the server from which the
error was received.
Andrew Deason [Tue, 27 Jul 2010 21:22:47 +0000 (16:22 -0500)]
salvage: update inodes array after CopyAndSalvage
CopyAndSalvage makes a copy of the directory to salvage it. So, the
new directory will have a new inode. Update the array of directory
inodes to reflect this. Without this, we can fail to alter the
copied/salvaged directory later on, since we will try to read/write to
the wrong inode.
Andrew Deason [Wed, 28 Jul 2010 17:00:37 +0000 (12:00 -0500)]
salvage: Zero corrupted header
In the salvager, if we read in a corrupt header (either we get a short
read or the magic is mismatched), make sure we zero out the contents,
so we don't read garbage further on.
Andrew Deason [Wed, 4 Aug 2010 16:19:35 +0000 (11:19 -0500)]
rxgen: Error out if cpp exits with error
If we call 'cpp' and it returns with an erroneous exit code, exit with
an error ourselves. Otherwise we will return success and generate
empty results even if the input file is unreadable, for instance,
which causes confusing errors later in the build.
Jeffrey Altman [Thu, 5 Aug 2010 05:43:24 +0000 (01:43 -0400)]
Windows: optimize buf_FlushCleanPages
If the pages to be flushed are from a readonly or backup volume
they can't be dirty. In this case there is no need to stabilize
the pages before they are locked and recycled.
Stablilization is performed on the cm_scache_t object so do not
stabilize and unstablize for each cm_buf_t object.
Andrew Deason [Thu, 5 Aug 2010 03:49:29 +0000 (22:49 -0500)]
Unix: docbook revision tag requires a date
The docbook DTD requires a <revision> element to contain a <date>
element. So make a blank <date> one even though we don't keep track of
a date, so we can pass xmllint.
Andrew Deason [Tue, 3 Aug 2010 22:32:11 +0000 (17:32 -0500)]
Add DAFS docs to the Unix Quick Start guide
Modify the sections dealing with creating the 'fs' bnode to also
mention how to create the 'dafs' bnode, and add an appendix explaining
DAFS and the differences between DAFS and non-DAFS.
Andrew Deason [Thu, 29 Jul 2010 19:47:03 +0000 (14:47 -0500)]
util: add afs_exec_alt
Add the function afs_exec_alt to help programs easily execute an
"alternate" version of themselves. For example, for programs that are
built with/without DAFS support, or are built for 32-bit/64-bit
structures, etc.
Jeffrey Altman [Tue, 3 Aug 2010 03:28:39 +0000 (23:28 -0400)]
Windows: Reduce complexity of Freelance Callback Logic
Over the years the processing of the Freelance callbacks have
added functionality that behaves much more like FetchStatus checks
to a file server. If the data version of the object has changed,
get the new data. Given that is the case, we can remove much of
the original refresh logic that is rather race prone. Say goodbye
to cm_fakeGettingCallback and cm_fakeDirCallback.
Jeffrey Altman [Mon, 2 Aug 2010 20:06:39 +0000 (16:06 -0400)]
Windows: When processing pioctl paths ensure callbacks are obtained
When processing a pioctl path with either smb_ParseIoctlPath or
smb_ParseIoctlParent, cm_SyncOp(CM_SCACHESYNC_NEEDCALLBACK|GETSTATUS)
must be called on the cm_scache_t object to ensure that it is up
to date before we permit cm_Lookup or other operations to be performed
on it. Add the cm_SyncOp() call to smb_ParseIoctlPath and
smb_ParseIoctlParent to ensure it is done for all pioctl operations.
Windows: Don't configure client when not installing client
The 32-bit tools installer was displaying client configuration wizard
pages. Since, the 32-bit tools share configuration with the AFS
service, the 32-bit tools installer should not be attempting to change
client configuration. Remove said wizard pages from the 32-bit tools
installer.
Andrew Deason [Fri, 30 Jul 2010 20:32:53 +0000 (15:32 -0500)]
ptserver: Do not use cell for entry name len check
Do not use the local cell name when determining if a new entry name is
too long. This check assumes that foreign cells will use our local
cell name (assumed to be our local Kerberos realm) in a certain way,
and prevents creating users that will make those names too long.
This is undesirable for several reasons. One is that the local realm
name may not be the same as the local cell name (and we may have many
local realms). Another is that we cannot reliably predict how foreign
cells will construct foreign pt entry names, so preventing entry
creation based on that may prevent names that will never cause any
problems. This check also assumes that our names will be used as
foreign entries in other cells, which may not be the case.
So, remove the check based on the local cell name, and remove the
pr_realmNameLen variable while we are at it, since this is all it is
used for.
Thanks to Jeffrey Altman for discussion, and for bringing this up in
the first place.
Windows: Do not reference cm_data.rootSCachep directly
cm_data.rootSCachep is a global pointer to the cm_scache_t that
represents the root.afs volume root directory. Throughout the
code this cm_scache_t was being used without ensuring that a
callback to the volume is in fact valid.
Under most circumstances this would not be a problem. However,
it is possible for a request to fail due to the lack of a callback
at a critical moment. Add a new function cm_rootScachep() that
attempts to ensure that a callback is present (if possible) prior
to use the cm_scache_t object.
Windows: Update root.afs scache dv when Freelance dir bufs are regenerated
When the contents of the Freelance root directory changes the fake
directory buffers are updated and a fakeDirVersion is incremented.
The dataVersion of the cm_scache_t object is supposed to be updated
on the next access by performing a fake get callback request.
Unfortunately, this did not always occur because of a race. If another
Freelance object is updated first, the root directory object would
never successfully get a fake callback.
This patchset ensures that the generation of the fake directory
buffer content and the callback are obtained under the same set
of locks thereby removing the race.
Andrew Deason [Mon, 2 Aug 2010 05:44:37 +0000 (00:44 -0500)]
SOLARIS: let xlator load if amd64/nfssrv is loaded
The NFS translator-enabled kernel module refuses to load if
misc/nfssrv is not also loaded. We were only checking misc/nfssrv and
misc/sparcv9/nfssrv, though, not misc/amd64/nfssrv. Check that, too,
as it may be loaded on amd64 machines.
Skip over 'fragments' directory when scanning for PODs
The generate-html script scans the directories to compile a list of
POD files. The list of candidates include the 'fragments' directory,
which causes an error when the script attempts to open it as a file.
Andrew Deason [Fri, 30 Jul 2010 17:03:06 +0000 (12:03 -0500)]
ptserver: Allow longer foreign user names
The ptserver was restricting all names to be less than PR_MAXNAMELEN -
pr_realmNameLen - 1, so that the local realm and a '@' can be safely
appended for foreign user registration. This check is overly
restrictive for foreign users, since the local realm will never be
appended to the user name (it already has the foreign realm name
appended). So, just check for PR_MAXNAMELEN for foreign users.
Andrew Deason [Thu, 29 Jul 2010 17:43:25 +0000 (12:43 -0500)]
Remove bless-related options from vos manpages
'vos online' and 'vos offline' were documented as taking -bless and
-unbless options, respectively. They do not actually take these
options, and since adding that functionality, while useful, will
require protocol changes, they are likely to take some time to appear.
Andrew Deason [Wed, 28 Jul 2010 22:10:10 +0000 (17:10 -0500)]
viced: Correct unblessed attach2 errors
Don't set the vp to NULL; instead just go to the general error
handling code. When a volume is not blessed, we just want it to go
offline, not go into an error state. Furthermore, we must free the
volume header when nUsers is set to 0, so manually do so when we do
not call VRequestSalvage_r.
Andrew Deason [Wed, 28 Jul 2010 22:47:21 +0000 (17:47 -0500)]
vol-bless: Detach, not put, volumes on completion
vol-bless was just calling VPutVolume when it was done blessing or
unblessing a volume. Instead call VDetachVolume, so we actually give
the volume back to the fileserver when we are done if !nofssync.
Andrew Deason [Thu, 22 Jul 2010 18:43:17 +0000 (13:43 -0500)]
salvage: Zero root/readme vnodes before writing
Previously we were writing out the root and readme vnodes with
uninitialized 'lock' structures, when we create a new root dir for
attaching orphans. Just use calloc so we ensure that everything is
zeroed before writing it out.
Andrew Deason [Thu, 22 Jul 2010 17:21:14 +0000 (12:21 -0500)]
autoconf: Force absolute INSTALL
Force using an absolute path for install-sh. Autoconf normally prefers
using a relative path, which confuses (at least) part of the libafs
build system.
Andrew Deason [Wed, 21 Jul 2010 22:30:39 +0000 (17:30 -0500)]
Log lex/flex detection errors in the config log
When we detect if lex is flex, we run 'lex --version', which may
complain to stderr if lex is not flex. Instead of printing such errors
to the person running 'configure', redirect stderr to config.log along
with stdout.
install-man is a config.status-generated script, so Autoconf will
substitute in the path to our install-sh script, but Autoconf prefers
relative paths that are only valid in the directory in which
install-man is generated. We therefore must avoid changing directories
before calling install-man.
Instead of cd, use relative paths including the directory and adjust
the installation path accordingly.
Andrew Deason [Wed, 21 Jul 2010 16:34:39 +0000 (11:34 -0500)]
libafs: fix IOPEN for amd64 solaris
Solaris afs_syscall_iopen was returning the fd in r_val2 for 64-bit
architectures (for 5.7 and beyond). If we are little-endian, though,
we want the return value in r_val1; otherwise we just always return fd
0. So, put the fd in r_val1 if we are little-endian.
Andrew Deason [Tue, 20 Jul 2010 17:46:00 +0000 (12:46 -0500)]
ubik: Make ugen_ClientInit honor noAuthFlag
ugen_ClientInit was still trying to use tokens to make an
authenticated connection, even if noAuthFlag was set. Make it so we do
not attempt authenticated connections with noAuthFlag, and suppress
the "Could not get afs tokens" message if noAuthFlag was set.
Andrew Deason [Tue, 20 Jul 2010 17:32:10 +0000 (12:32 -0500)]
bos: Do not assume DAFS just if DAFS bnode exists
For salvaging purposes, we were assuming that if a DAFS bnode existed,
we should perform a DAFS salvage. Since it is possible to have a
disabled DAFS bnode alongside an enabled non-DAFS fs bnode, we should
perform a regular non-DAFS salvage if the DAFS bnode is disabled. Do
that.
Andrew Deason [Tue, 20 Jul 2010 17:06:57 +0000 (12:06 -0500)]
bozo: Clean up bnode parms for each bnode
bosserver was remembering the parms for past bnodes, and just
overwriting parms for new bnodes. This is a problem if we have a
'dafs' bnode followed by an 'fs' bnode, since the 'fs' bnode will get
the 'dasalvager' parm, and bosserver will think it is its scanner
program.
So instead keep track of a separate array of the parms that we
actually pass to bnode_Create, so we only pass parms that we saw for
this specific bnode.
Andrew Deason [Tue, 6 Jul 2010 17:42:40 +0000 (12:42 -0500)]
vos status: report human-readable last*Time
Make 'vos status' print the lastReceiveTime and lastSendTime in a
human-readable format, instead of just printing the number of seconds
since the epoch as an integer. As suggested by Jeffrey Altman.
Andrew Deason [Tue, 6 Jul 2010 17:36:27 +0000 (12:36 -0500)]
vos status: actually show created time
The 'created' field in 'vos status' output was being reported as
something else. Make 'vos status' actually report the time the
transaction was created in that field.
Simon Wilkinson [Sat, 17 Jul 2010 17:23:30 +0000 (18:23 +0100)]
dir: Add printf format checks to log
salvage.c uses the Log() function defined by vol/common.c. At the
moment, this isn't defined in a way that we can easily grab its prototype,
so the code has an extern definition at the beginning. For now, just add
format checks to this definition.
Fix all of the fallout from this - we were casting to intptr, and
printing with %x - use AFS_PTR_FMT as nature intended.
Simon Wilkinson [Fri, 16 Jul 2010 22:20:27 +0000 (23:20 +0100)]
vol: Fix logging functions
Fix the Log, Abort and Quit functions used by the vol package so
that they are all defined in a common header file, rather than
prototyped in each file which uses them.
Use the appropriate macros to flag those functions which never
return, and mark them all as taking printf style input.
Fix all of the callers which had mismatched format strings and
arguments.
Simon Wilkinson [Fri, 16 Jul 2010 20:58:33 +0000 (21:58 +0100)]
Linux: Load exportfs first
The changes to use the exportfs interface to access cache files
require that the exportfs module is loaded before our module.
In 'normal' operation depmod, and modprobe, would take care of
this for us, however our legacy installation format where we
ship the kernel module outside of /lib/modules stops modprobe from
working, and our init script uses insmod. So, explicitly load
exportfs first.
Note: I'm aware of just how much this sucks, and the fact that we
really should just tidy up all of the packaging and init scripts
around our kernel module - but this close to 1.6 branch is probably
not the time for those kinds of changes.
Rename configure.in and configure-libafs.in to use the *.ac extension
instead, which is preferred by current Autoconf versions for input
files to Autoconf. *.in can then be more consistently used for files
that are input into config.status.
Add a preprocessor for POD documentation that handles a custom
=include directive. Demonstrate how to use the preprocessor by
factoring out all the standard PTS options into a separate POD
fragment and including that fragment in all the PTS commands that
take the standard options instead of including that documentation
in each separate file.
Remove obsolete configure options and document all remaining options
other than some provided by Autoconf and some that are currently not
very interesting.
Document that, on modern Linux systems, configure can find the kernel
build system and headers by itself and doesn't need the flag.
Include some more information in README about changing the default
installation paths, and mention that the da* versions of the file server
and volserver also aren't stripped.
Remove the generic GNU installation instructions, which aren't useful
for OpenAFS.
Now that we have a build-tools directory, move the various support
files used by Autoconf and Automake into it as well to reduce clutter
at the top level.
Marc Dionne [Thu, 15 Jul 2010 02:43:01 +0000 (22:43 -0400)]
afspag version of rx_knet.o
in order to correctly generate KBUILD_MODNAME, each object
file needs to be built only once. in this case it matters because the
pr_debug macro, called as a result of including errqueue.h, needs it
and things which depend on it, and when it's built into 2 .kos,
the wrong thing happens.
Debian packaging can deal with the full version number that we
generate using git-version, so base the version we put into
src/packaging/Debian/changelog on that version instead of the
LINUX_PKGVER that we use for other packaging.
The source package we would get by running dpkg-buildpackage in the
source tree without further preparation is basically useless, since
it's a native source package for a non-native package and will contain
any random dirty cruft in the current source tree. Since the purpose
of make dpkg is to provide quick Debian packages for testing purposes,
only build the *.deb files and don't bother to build the source
package.