Ensure we set up debian/control before doing module builds
In the openafs-modules-source package, we have to be sure to generate
a debian/control file listing our module package before we run any
dh commands, since otherwise dh gives up and quits.
Remove bison and flex dependencies for module builds
* Remove bison and flex dependencies for the module build packages. We
now ship the results of rxgen, so don't need all the tools required to
build the full source tree.
* Add ${perl:Depends} to openafs-modules-dkms and perl to the
dependencies of openafs-modules-source, since Perl is used as part of
the module build system now.
Fix the sample CellServDB entry output by afs-newcell
* Fix the sample CellServDB entry printed by afs-newcell if the cell
isn't found in /etc/openafs/CellServDB to include the correct server
syntax. Thanks, Peter Palfrader.
* Add a dependency on libc6-dev to openafs-modules-dkms. dkms doesn't
depend on it because most kernel modules don't need it, but openafs
builds userspace helper programs. Thanks, Peter Palfrader.
the file propagation "out of band" changes should not hardcode recovery
on file 0, but instead work on any file the interface is acting on.
use the provided file number.
Windows: Improve SMB detection of Local System account
Depending on the authentication method, the smb session authenticated
name for the "local system" account may be the nul string. In this
case it is impossible to use the name to determine if the authenticated
entity is the "local system" account as required by smb_SetToken.
To work around this problem, smb_AuthenticateUserExt() will now obtain
the Security Identifier (SID) for the authenticated account. The string
representation of the SID will be used in place of the name by
smb_ReceiveV3SessionSetupX() when constructing the smb_user_t object.
A new flag, SMB_USERNAMEFLAG_SID, indicates when the name is in fact
a SID.
smb_userIsLocalSystem() checks for the SMB_USERNAMEFLAG_SID flag and
performs a SID comparison when it is set.
smb_SetToken() will accept either MACHINE\user or a SID string as
the smbname. It will obtain the SID if possible and create a SID-based
smb_user_t.
It is possible that a SYSTEM service will use an anonymous (S-1-5-7)
SMB connection. In that case, we also check the RPC Impersonation
SID to see if it is SYSTEM. If so, the RPC identity supercedes the
SMB identity for SetToken.
smb_IoctlRead, smb_IoctlV3Read and smb_IoctlRawRead are now all
consistent with regards to name processing.
Windows: Modify signature of buf_CleanAsync and buf_CleanAsyncLocked
The buf_CleanAsync() and buf_CleanAsyncLocked() signature does
not include a cm_scache_t pointer even though buf_CleanAsyncLocked()
needs a pointer to the matching cm_scache_t object. There are
some calls when the cm_scache_t object is already known. For those
cases it is more efficient to avoid the additional lookup especially
when buf_CleanAsync*() is being called on every buffer associated
with the cm_scache_t object.
At the same time add a flags field and a constant
CM_BUF_WRITE_SCP_LOCKED to permit the lock state of the cm_scache_t
to be passed in.
Finally, fix up the usage in buf_FlushCleanPages() which gains
the most from these changes.
Windows: Permit cm_scache rwlock to be dropped when "Stablized"
The cm_buf_opts_t cm_BufStabilize() function was implemented
such that holding the cm_scache_t.rw lock had to be exclusively
held until cm_BufUnstablize() was called. Unfortunately, this
prevents using Stabilize/Unstabilize to protect the cm_scache_t
during Flush operations as the cm_scache_t.rw lock must be
acquired after the cm_buf_t mutex and not before it.
This patchset reimplements the synchronization logic using
the new CM_SCACHEFLAG_SIZESETTING flag and cm_SyncOp().
Jeffrey Altman [Mon, 30 Aug 2010 03:41:02 +0000 (23:41 -0400)]
Windows: fail cm_CheckNTOpen if READ|DELETE for readonly file
If the readonly file attribute is set (stored as a unix mode)
then a CreateFile operation should fail if the file is opened
for DELETE in combination with any other privilege.
Jeffrey Altman [Thu, 26 Aug 2010 15:33:43 +0000 (11:33 -0400)]
Windows: Add validation for directory buffer contents
If the directory buffer contents are garbage we can crash
the service. Add some simple validation checks to ensure
that cm_dirEntry_t objects have the correct flag value and
that the name strings are not too long.
Jeffrey Altman [Tue, 24 Aug 2010 20:46:45 +0000 (16:46 -0400)]
Windows: cm_TryBulkStatRPC must process VIO errors
If the bulkStat errorCode indicates that a particular object
is inaccessible due to a VIO error, we must update the server
status appropriately in order to permit failover.
Jeffrey Altman [Tue, 24 Aug 2010 20:42:57 +0000 (16:42 -0400)]
Windows: better handle RX_MSGSIZE errors
An RX_MSGSIZE error is returned by the new PMTU detection
code. It is critical that such an error result in a retry of
the operation that failed. Otherwise, the PMTU detection can't
work and the server will be marked down.
Secondly, it is important that such errors not leak to the
application layer. Map them to CM_ERROR_RETRY in all cases.
Jeffrey Altman [Sat, 21 Aug 2010 04:23:45 +0000 (00:23 -0400)]
Windows: Log cell along with volume id for server errors
When logging server volume instance errors to the windows
application event log, be sure to log the cell as well.
Translating from server ip address is non-trivial. Make it
easier for administrators triaging issues to plug the volume
and cell info into vos commands.
Andrew Deason [Fri, 3 Sep 2010 20:20:10 +0000 (15:20 -0500)]
vos: Show after effects in dryrun mode
The dryrun mode of operation for 'vos syncvldb' and 'vos syncserv'
does not currently show the "status after" portion of its output, so
they don't really show what the commands will do. Change them so
"status after" is shown for -dryrun when sync'ing servers or
partitions, and count changes towards the count at the end.
Marc Dionne [Sun, 5 Sep 2010 14:48:52 +0000 (10:48 -0400)]
afs_DoBulkStat: don't call afs_Analyze without holding the GLOCK
Limit the scope of the GUNLOCK-GLOCK blocks to cover only the RX
calls. This prevents afs_Analyze from being called without the
GLOCK, which causes an oops in afs_icl_Event4() where there's
an ASSERT_GLOCK.
Andrew Deason [Wed, 1 Sep 2010 16:14:37 +0000 (11:14 -0500)]
RedHat: Do not force krb5-config path
If the %krb5config macro is not defined, do not force using
/usr/kerbers/bin/krb5-config, since sometimes that is not where it is
(RHEL6 puts it in /usr/bin). Instead only specify KRB5_CONFIG if
krb5config is defined; otherwise let configure find krb5-config for
us.
Andrew Deason [Wed, 1 Sep 2010 15:32:53 +0000 (10:32 -0500)]
RedHat: Update openafs.spec for configure changes
We no longer have the configure options --enable-disconnected and
--with-krb5-conf. Remove them from the spec file and instead specify
krb5-config via the KRB5_CONFIG variable.
Andrew Deason [Wed, 1 Sep 2010 15:18:17 +0000 (10:18 -0500)]
RedHat: Use git-version in makesrpm.pl
We no longer have the OpenAFS version in the AM_INIT_AUTOMAKE. Get the
version from the equivalent AC_INIT version, which is determined by
running build-tools/git-version. So, run git-version to get the
version.
Hartmut Reuter [Tue, 31 Aug 2010 11:30:41 +0000 (13:30 +0200)]
Let SRXAFS_GetStatistics64 return correct values for the workstations
h_GetWorkstats was called also for 64bit which let random contents
in the other half of the 64bit field. Worse: little and big endian
machines filled different parts of the field so that a later masking
in fsprobe would net help for all kinds of servers.
Now a small wrapper h_GetWorkstats64 is called which calls h_GetWorkstats
correctly.
Matt Benjamin [Sun, 29 Aug 2010 19:06:22 +0000 (15:06 -0400)]
cache bypass Also increment page refcount in readpage
As noticed by a commenter, afs_linux_bypass_readpage needs
the same get_page operation as in afs_linux_bypass_readpages,
as background page accounting assumes we have done it.
Matt Benjamin [Fri, 27 Aug 2010 23:11:32 +0000 (19:11 -0400)]
DFBSD update dfbsd userland
Add new sysnames. Fix some userland header inclusions,
defend against kernel-mode ioctl interpretation when
building UKERNEL. Add fragments missing from DFBSD
MakefileProto template.
Matt Benjamin [Sun, 29 Aug 2010 21:33:03 +0000 (17:33 -0400)]
FBSD try-relax child vnode locking (recurse only)
In cases where afs_vop_lookup would return a child vnode
locked, continue to take an exclusive lock, but allow
recursion (LK_CANRECURSE). Allow recursion also at
afs_vop_link, where we specifically encountered a conflict
due to recursion.
Matt Benjamin [Sun, 29 Aug 2010 00:43:41 +0000 (20:43 -0400)]
FBSD, DFBSD (future) vnode_pager_setsize updates
Based on review of bundled filesystems on FBSD and DFBSD,
call vnode_pager_setsize in three unhandled cases (getattr,
setattr, and io growing a file; truncation was handled
correctly already). Following up on a suggestion by Ben
Kaduk.
Matt Benjamin [Fri, 27 Aug 2010 02:54:20 +0000 (22:54 -0400)]
FBSD restore old syscall register logic for older kernels
The syscall_register code appears to depend on coordination
with FreeBSD upstream, which hopefully can be completed by
RELENG_9. Use the original code for installation of the AFS
syscall everything older than that.
Ben Kaduk [Thu, 26 Aug 2010 03:21:30 +0000 (23:21 -0400)]
FBSD: properly register our syscall
Use the provided interface, syscall_register(), instead of
manually tweaking the sysent table.
Starting afsd will still fail at present on FreeBSD HEAD
without an additional kernel patch to syscalls.master.
Matt Benjamin [Wed, 25 Aug 2010 20:19:18 +0000 (16:19 -0400)]
FBSD: give osi_NetReceive time to shutdown, reprise
The delay logic needs to follow soshutdown, and precede
soclose. The thread in osi_NetReceive is racing to do
another soreceive. That thread needs to win the race
and notice the socket is shut down before rx_socket is
torn down.
Matt Benjamin [Wed, 25 Aug 2010 07:34:35 +0000 (03:34 -0400)]
FBSD CM: don't call afs_close when recycling
Don't call afs_close when handling VOP_CLOSE on a recycled
vnode, since there was no matching open. This corrects the
opens count, which was seen to go have gone negative in the
reclaim vop. For clarity, assert if afs_vop_close is entered
with a VI_DOOMED vnode and avc->opens != 0.
Andrew Deason [Mon, 23 Aug 2010 17:55:21 +0000 (12:55 -0500)]
venus: make cacheout build again
Make src/venus/cacheout buildable again, by fixing several compiler
errors and warnings. Also clean up a few small things, like adding
'static' qualifiers.
Simon Wilkinson [Sat, 21 Aug 2010 11:05:37 +0000 (12:05 +0100)]
Don't include afsconfig.h in rxgen headers
Some headers generated by rxgen are installed. We can't use
afsconfig.h in installed headers, as it isn't installed (and it
shouldn't be, as it contains autoconf defines which will almost
certainly have namespace conflicts with other packages)
Revert the portion of 972a407 that added afsconfig.h to the
h_output function. This should now be safe as stds.h no longer
relies on the result of autoconf tests.
Marc Dionne [Fri, 20 Aug 2010 20:11:59 +0000 (16:11 -0400)]
s390x: only declare afs_sys_setgroups32_page where needed
Variable afs_sys_setgroups32_page is only used when __NR_setgroups32
is not defined. Make the declaration depend on it as well to clear
up an unused variable warning.
Russ Allbery [Sat, 28 Aug 2010 00:52:36 +0000 (17:52 -0700)]
Use dpkg --print-architecture in openafs-fileserver.config
* Use dpkg --print-architecture, not --print-installation-architecture,
in the openafs-fileserver config script. The latter is deprecated.
Thanks, Peter Palfrader. (Closes: #594488)
* The openafs-fileserver init script now depends on $named since
apparently the volserver requires DNS during startup. Thanks, Jaap
Winius. (Closes: #589783)
* Add a status command to thet openafs-fileserver init script.
Jeffrey Altman [Mon, 16 Aug 2010 14:09:22 +0000 (10:09 -0400)]
Windows: prevent buffer overrun in cklog
The Windows version of klog.exe will overwrite the realm and
password buffers if the command line input is too long. Generate
an error and terminate the program instead.
Chaz Chandler [Wed, 4 Aug 2010 18:17:03 +0000 (11:17 -0700)]
autoconf detection of label support
acinclude.m4 now has struct label support detection and sets
HAVE_STRUCT_LABEL_SUPPORT in afsconfig.h. Obviates complicated
ifdefs in various src/afs/ and src/rx/ files. Must run regen.sh
to generate new configure and afsconfig.h.in, then configure will
detect label support and set afsconfig.h appropriately. Not sure
what to do for Windows, but should be a step in the right
direction.
Fixes issue with compilation of libuafs on IRIX and sunpro by accurately
detecting label support.
Marc Dionne [Thu, 12 Aug 2010 20:33:04 +0000 (16:33 -0400)]
Linux: avoid oops in memcpy_toiovec
With ADAPT_PMTU enabled, kernel_recvmsg can be called to receive
errors. The call is made with no iovec supplied (we pass a NULL
pointer), but with a size of 256. In the kernel, the memcpy_toiovec
function tests for size > 0, and proceeds to check iovec->iov_len,
which causes an oops. Fix by setting the size to 0.
Marc Dionne [Wed, 11 Aug 2010 23:28:53 +0000 (19:28 -0400)]
Linux: Rework statfs super block operations configure test
The configure test to detect if the statfs super block operation
needs a dentry argument is based on vfs_statfs, and assumes that
its signature matches the one of the operation. In 2.6.36 this is
no longer true and the test fails.
Rework the test to actually test the operation we're interested in.
Marc Dionne [Wed, 11 Aug 2010 22:55:29 +0000 (18:55 -0400)]
Linux: switch to evict_inode
In 2.6.36, the delete_inode and clear_inode inode operations
are replaced by evict_inode.
Rename our current clear_inode to evict_inode, and add a few
things that were previously handled by the generic delete_inode.
Marc Dionne [Wed, 11 Aug 2010 22:20:59 +0000 (18:20 -0400)]
Linux: adapt to truncate sequence changes
As part of changes to the truncate sequence, inode_setattr() no
longer exists, and all filesystems have to define the setattr op
so we can assume that it is not NULL.
Introduce a compat inline function afs_inode_setattr that hides
the tests and the different versions from the main code.
Note that the existing test for the inode_setattr() return type
will fail, but the value is no longer used in that case.
Marc Dionne [Wed, 11 Aug 2010 21:18:32 +0000 (17:18 -0400)]
Linux: use %pI4 if NIPQUAD is not available
The definition of NIPQUAD has been removed from the kernel headers
in the mainline kernel. Replace it by using the %pI4 format
specifier which takes the IP address as a single argument.
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.