openafs.git
9 years agoafs: remove cruft from Solaris afs_freevfs
Mark Vitale [Sun, 29 Jun 2014 20:27:37 +0000]
afs: remove cruft from Solaris afs_freevfs

Remove some unused variables left behind in a previous
refactor of flushing vcaches during afs_shutdown
(commit 80fe111f0044aa7a67215ad92210dc72cb7eb2c0).

Change-Id: Ie0a23cb08fc2946f1c400b8ce8e15ef3dc22ec20
Reviewed-on: http://gerrit.openafs.org/11310
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agovolinfo: fix documenting comments
Stephan Wiesand [Wed, 23 Jul 2014 11:57:50 +0000]
volinfo: fix documenting comments

As pointed by Andrew deason during review of the 1.6 pullup of
commit ae27283550dab33704f30e18975722e0ed2c5424, psize is not
a parameter of HandleHeaderFiles, and in function HandleSpecialFile
it is of type inout since the value is first read by the += operation.
Fix this, and try to improve the description of psize too.

Change-Id: Ia728b20475f0c44b6104dc954aaa04d5f0f098b5
Reviewed-on: http://gerrit.openafs.org/11319
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoLINUX: Check afs_lookup return code explicitly
Andrew Deason [Thu, 24 Jul 2014 16:07:45 +0000]
LINUX: Check afs_lookup return code explicitly

Checking if the returned vcache is NULL or not is a bit of an indirect
way to check if an error occurred. Just check the return code itself,
to make sure we notice if any kind of error is reported.

Suggested by Chas Williams.

Change-Id: I61cc7304e9885ddaaebe96db3b12457cb6224420
Reviewed-on: http://gerrit.openafs.org/11321
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoFBSD: adhere to gop_lookupname() semantics
Ben Kaduk [Fri, 18 Jul 2014 19:19:24 +0000]
FBSD: adhere to gop_lookupname() semantics

The current semantics are that gop_lookupname() returns an unlocked
vnode; the previous code was written to a different semantic that
a locked vnode should be returned.

This makes a disk cache more likely to work on FreeBSD, but such
configurations remain not very tested.

Change-Id: I12ac77cd271be72af2fa4045c2ebf576847b625e
Reviewed-on: http://gerrit.openafs.org/11317
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: remove stray "-v 2" argument to afs_compile_et
Stephan Wiesand [Thu, 31 Jul 2014 18:50:04 +0000]
libafs: remove stray "-v 2" argument to afs_compile_et

Commit 4e6b7ab904d38d38da1b80a7342bd815668a8c09 separated the
compile_et rules for creating the source and header files using
the new -emit functionality. During review for inclusion in 1.6,
Chas Williams spotted a stray "-v 2" carried over to the rule
for creating the header file, where it doesn't apply. Remove it.

Change-Id: I554354eae0fa018e56fe7b78df69a43e5b5a0b07
Reviewed-on: http://gerrit.openafs.org/11347
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: fix vrequest leak in afs_lookup
Michael Meffie [Tue, 29 Jul 2014 00:57:01 +0000]
libafs: fix vrequest leak in afs_lookup

Fix vrequest leak introduced in commit
9930567bcf9655d3f562b210b2dc4b4a99226691.

Thanks to Andrew Deason for finding this error.

Change-Id: I8fc1391ab43f33c5a8208ff58d1d0641292cf63e
Reviewed-on: http://gerrit.openafs.org/11337
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agolibafs: do not allow NULL creds for afs_CreateReq
Michael Meffie [Mon, 28 Jul 2014 21:27:40 +0000]
libafs: do not allow NULL creds for afs_CreateReq

Do not allow callers to pass a NULL cred to afs_CreateReq.  This
avoids setting the uid of zero in the vrequest when no cred is
passed.  Update callers to pass afs_osi_credp for an anonymous cred
when no cred is available.

Thanks to Andrew Deason for pointing out afs_osi_credp should be
used.

Change-Id: I05f694026ec72ab701160d9920e47c16cda46cd7
Reviewed-on: http://gerrit.openafs.org/11336
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfig: Refactor the FreeBSD configuration files
Chas Williams (CONTRACTOR) [Thu, 31 Jul 2014 15:45:14 +0000]
config: Refactor the FreeBSD configuration files

Use a common file for most of the platform specific settings.

Change-Id: If95ad44de99fc3320570d53d706fed4d760fe67d
Reviewed-on: http://gerrit.openafs.org/11346
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfig: AFS_SHORTGID no longer in use
Chas Williams (CONTRACTOR) [Thu, 31 Jul 2014 15:40:23 +0000]
config: AFS_SHORTGID no longer in use

Remove the AFS_SHORTGID macro from the param header files.  There
are no usages in the rest of the source tree.

Change-Id: I417b6e90fa9a094bfef727134b640964596eceb3
Reviewed-on: http://gerrit.openafs.org/11345
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfig: Updates to AFS_HAVE_STATVFS for FreeBSD
Chas Williams (CONTRACTOR) [Thu, 31 Jul 2014 15:14:57 +0000]
config: Updates to AFS_HAVE_STATVFS for FreeBSD

Always define AFS_HAVE_STATVFS.  According to the man page, statvfs()
appeared in FreeBSD 5.0.  Additionally, this macro is only used for
userspace which eliminates all disables except for FreeBSD 5.0 which
appears to have just been an oversight when the param file was created
from the 4.x param files.

Also fixes the comment so it reflects the actual choice.

Change-Id: Ibdcd694e9c4a0d0cecccd91a51962af6fb11ff36
Reviewed-on: http://gerrit.openafs.org/11344
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfig: Remove deprecated macro from FreeBSD configuration files
Chas Williams (CONTRACTOR) [Mon, 28 Jul 2014 12:24:48 +0000]
config: Remove deprecated macro from FreeBSD configuration files

The macro STDLIB_HAS_MALLOC_PROTOS was deprecated in commit
daff4006627fc88be85dade3d72aa45e57a6804a.

Change-Id: I9c2129f6f3d5be6a00ef6ddd358967e0fd4f7ec9
Reviewed-on: http://gerrit.openafs.org/11333
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: fix error location code in LINUX/osi_export
Michael Meffie [Fri, 1 Aug 2014 22:27:35 +0000]
libafs: fix error location code in LINUX/osi_export

Fix the missing error location code introduced in commit
40fb2650b783fbafe51aefd3d0af7a6b0536c265
libafs: allocate vattrs in LINUX to reduce stack used

Use location number 104, which is the next in the sequence.

The code in this module is compiled when building the
nfs translator, which is only built under linux when
configure detects it is possible.

Thanks to Andrew Deason for spotting this error.

Change-Id: I00c834bc915fa3be7d5f27467895930e4f62aa76
Reviewed-on: http://gerrit.openafs.org/11351
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoLINUX: Drop dentry if lookup returns new file
Andrew Deason [Wed, 23 Jul 2014 16:54:47 +0000]
LINUX: Drop dentry if lookup returns new file

Background: when an entry is looked up after its parent changes,
afs_linux_dentry_revalidate re-looks-up the entry name in its parent.
If we get an ENOENT back, we d_drop the dentry, and in any other
situation we just d_invalidate it. As discussed in prior commits
997f7fce437787a45ae0584beaae43affbd37cce and
389473032cf0b200c2c39fd5ace108bdc05c9d97, we cannot simply d_drop the
dentry in all cases, because that would cause legitimate directories
to be reported as "deleted" if we just failed to lookup the entry due
to e.g. transient network errors (this causes, among other things,
'getcwd' to fail with ENOENT).

However, this logic has problems if the dentry name still exists, but
points to a different file; the case where 'tvc != vcp' in
afs_linux_dentry_revalidate. If that case happens, and the dentry is
still held open by some process, we will continue to try to reference
the vcache pointed to by the 'old' dcache entry, which is incorrect.

To maybe more clearly illustrate the issue, consider the following
cases:

  $ sleep 9999 < /afs/localcell/testvol.ro/dir1/file1 &
  $ rm -rf /afs/localcell/testvol.rw/dir1
  $ mkdir /afs/localcell/testvol.rw/dir1
  $ vos release testvol
  $ ls -l /afs/localcell/testvol.ro
  ls: cannot access /afs/localcell/testvol.ro/dir1: No such file or directory
  total 0
  d????????? ? ? ? ?            ? dir1

Here, on the last 'ls', afs_linux_dentry_revalidate will afs_lookup
'dir1', and notice that it points to a different file (tvc != vcp),
and will d_invalidate the dentry. But since the file is still held
open, the dentry doesn't go away, and so we are still pointing to the
vcache for the old, deleted 'dir1'. That file doesn't exist anymore on
the fileserver, so we get an ENOENT when actually trying to stat() it
(we get a VNOVNODE from the fileserver, whcih gets translated to an
ENOENT).

A possibly more serious case is when the file is just renamed:

  $ sleep 9999 < /afs/localcell/testvol.ro/dir1/file1 &
  $ mv /afs/localcell/testvol.rw/dir1 /afs/localcell/testvol.rw/dir1.moved
  $ mkdir /afs/localcell/testvol.rw/dir1
  $ touch /afs/localcell/testvol.rw/dir1/file2
  $ vos release testvol
  $ ls -l /afs/localcell/testvol.ro/dir1
  total 0
  -rw-rw-r--. 1 1235 adeason 0 Jul 23 11:09 file1
  $ kill %1
  $ ls -l /afs/localcell/testvol.ro/dir1
  total 0
  -rw-rw-r--. 1 1235 adeason 0 Jul 23 11:10 file2

In this situation, the same code path applies, but the old file still
exists, so we will continue to use it without error. But since we are
still pointing at the old file, of course the results are incorrect.
Once we kill the process holding the file open, the bad dentry finally
goes away and the results are valid again.

To fix this behavior, d_drop the dentry in all cases, except when we
encounter an error preventing the lookup from being done. This ensures
that the dentry is unhashed from the parent directory in the scenarios
above, and so cannot be used for a subsequent lookup.

With this change, the only afs_lookup response that causes a simple
d_invalidate is when we encounter actual errors during the lookup
(such as transient network failures). This is correct, since in those
cases we don't _know_ that the dentry is wrong. For all other cases,
we do know that the dentry is wrong and so we must force it to be
unhashed.

Change-Id: I11a2db1e05d68a755a77815ec5e8d01ac7b36129
Reviewed-on: http://gerrit.openafs.org/11320
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoptserver: Fix RemoveFromSGEntry hentry memcpy
Andrew Deason [Wed, 30 Jul 2014 16:12:39 +0000]
ptserver: Fix RemoveFromSGEntry hentry memcpy

In this function, hentry is the "previous" continuation entry that we
looked at, and centry is the "current" continuation entry. We keep
track of the previous continuation entry in case we need to update its
'next' pointer, which we do if we free one of the continuation entries
because it is empty after the removal.

So, this memcpy is supposed to copy the current entry to the previous
one, but the arguments are flipped, so we just copy zeroes to centry
(since hentry is initialized to zeroes early on in the function), and
hentry never gets set to anything besides zeroes.

The effect of this is that whenever a ptdb entry has more than one
continuation entry, and we free up any of them after the first one via
RemoveFromSGEntry, the previous continuation entry becomes blanked
(though the 'next' pointer should still be correct). This means the
membership information for that group is not recorded correctly, as it
loses a chunk of the IDs that it is a member of. The reverse mapping
should still be intact (the parent groups have a pointer to the
sub-group), but the group probably doesn't function correctly.

The reason this happened is because of the confusing conversion from
bcopy to memcpy. Most of the instances of bcopy/bcmp/bzero/etc were
converted (correctly) back in commit c5c521af, but the supergroups
implementation was added afterwards, in 8ab7a909, and contained a
bcopy reference. This bcopy was converted to memcpy in 58d5f38b, but
the argument order was not corrected, causing this bug.

To fix this, just flip the first two arguments of the memcpy. Just get
rid of the casts here, too, to match the code in the non-supergroups
RemoveFromEntry and elsewhere.

Change-Id: Ibcbbdcb13ef5c033ea3452555832a0fd3f916efd
Reviewed-on: http://gerrit.openafs.org/11340
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoMove VLOP_RESTORE and VLOP_ADDSITE home
Nathaniel Wesley Filardo [Fri, 25 Jul 2014 15:50:16 +0000]
Move VLOP_RESTORE and VLOP_ADDSITE home

Change-Id: I19c04ea1762eec349b0e9645fa9777e6a6c5263a
Reviewed-on: http://gerrit.openafs.org/11325
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoFBSD: 10.1 is coming out soon
Garrett Wollman [Sat, 26 Jul 2014 04:43:10 +0000]
FBSD: 10.1 is coming out soon

The 10.1 release cycle is starting in a month, so let's get ahead of
the curve by adding the config bits now.

Change-Id: Ia17e1267dafee5c80d87a6bfc5e423982f83306d
Reviewed-on: http://gerrit.openafs.org/11328
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoFBSD: 9.3 has been released, so add config bits and sysname
Garrett Wollman [Sat, 26 Jul 2014 04:22:09 +0000]
FBSD: 9.3 has been released, so add config bits and sysname

Change-Id: I453a457d5311dfea04fd7e8173f1296a0db74902
Reviewed-on: http://gerrit.openafs.org/11327
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoptserver: fix errant debug message log level
Michael Meffie [Wed, 9 Jul 2014 15:37:21 +0000]
ptserver: fix errant debug message log level

Fix the log level a debugging message introduced
in commit 9ddf9eca56e02be978ff7d065ee16c85de2cfb06.
Thanks to Ben Kaduk for reporting this issue.

Change-Id: I8913472aba8fe5247a29e31e3f04090bc0fce64e
Reviewed-on: http://gerrit.openafs.org/11314
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoauth: Fix library dependencies so that tests build again
Chas Williams (CONTRACTOR) [Thu, 3 Jul 2014 15:02:40 +0000]
auth: Fix library dependencies so that tests build again

Change-Id: Ia95a94a77290baea419beb942ea60cd1b89c22fa
Reviewed-on: http://gerrit.openafs.org/11311
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoLinux 3.16: Convert to new write_iter/read_iter ops
Marc Dionne [Wed, 18 Jun 2014 13:06:39 +0000]
Linux 3.16: Convert to new write_iter/read_iter ops

Change read/write operations to the new write_iter/read_iter
operations.

Change-Id: Ia58e5f90182f3968d1a81cfc2f831e7a9cf35d93
Reviewed-on: http://gerrit.openafs.org/11303
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoLinux 3.16: Switch to iter_file_splice_write
Marc Dionne [Wed, 18 Jun 2014 12:53:48 +0000]
Linux 3.16: Switch to iter_file_splice_write

Users of generic_file_splice_write need to switch to
using iter_file_splice_write.

Change-Id: If4801d27e030e1cb986f483cf437a2cfa7398eb3
Reviewed-on: http://gerrit.openafs.org/11302
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoUse an unsigned type for bitmask values
Benjamin Kaduk [Mon, 16 Jun 2014 16:44:08 +0000]
Use an unsigned type for bitmask values

As noted by clang -Wshift-sign-overflow, the expression "1<<31"
overflows the signed int type, giving undefined behavior.

Use an unsigned type to make the result of the shift defined
behavior by the C99 standard.

Also change an instance of "1<<31" that was checking for whether the
most significant bit was set, as it's still undefined behavior.

Change-Id: I8cf9443aa92470181044fc3b63d491da18ff5e34
Reviewed-on: http://gerrit.openafs.org/11301
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoauditU: also report for rxkad-always-encrypt
Ben Kaduk [Wed, 27 Nov 2013 22:06:33 +0000]
auditU: also report for rxkad-always-encrypt

The logic that works for security index 2 also works for index 3.

While here, update a comment in preparation for rxgk.

Change-Id: Ifd868fa8d9d0ba2f422fa1fac43e4f583d27a1ff
Reviewed-on: http://gerrit.openafs.org/10527
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoUse the RX_SECIDX_* enums in more places
Ben Kaduk [Wed, 27 Nov 2013 22:01:39 +0000]
Use the RX_SECIDX_* enums in more places

Add symbols for security indices 1 (rxvab, unused) and 3 (rxkad with
always-encrypt, maybe-used).

kauth and bubasics defined macros for RX_SCINDEX_*; replace those
with the common core rx enums as well.

Use the global symbols instead of custom defines like BULK_NULL and
SAMPLE_NULL, which can now be removed.

Reformat a comment to match current style, since we're changing it anyway.

Change-Id: I82bbb0016a5c3129dfd18ff7dc77ff7839501ad8
Reviewed-on: http://gerrit.openafs.org/10526
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoafs: maintain afs_users buckets in sorted order
Mark Vitale [Mon, 7 Apr 2014 22:56:26 +0000]
afs: maintain afs_users buckets in sorted order

Modify afs_GetUser() to insert a new unixuser into an afs_users
hash bucket in sorted order, by uid/PAG.  This is in support of
other small optimizations in future commits.

Change-Id: I68c51ab38733575290aa0c8aa2a306168c5483c0
Reviewed-on: http://gerrit.openafs.org/11071
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoafs: only reset access caches for the matching cell
Mark Vitale [Thu, 3 Apr 2014 20:37:51 +0000]
afs: only reset access caches for the matching cell

When an AFS user's tokens change (unlog, aklog) or expire,
afs_ResetAccessCache() is called to reset all the access caches
for that uid/PAG.

However, a user/PAG may have tokens for multiple cells, and they
may expire or be set/reset at different times.  Therefore, it is
incorrect to assume that all access caches for a uid/PAG should
be discarded when only one cell's tokens have changed.

Modify afs_ResetAccessCache() to acccept a new argument 'cell',
and only reset the access caches for a uid/PAG if the vcache
resides in the specified cell.  If the caller really wants to
reset all a user's access caches, specify cell=-1.

For cache managers that are running with multiple PAGs and multiple
cells, this should improve performance because 1) it avoids
scanning access caches chains for vcaches that are not part of the
current cell and 2) it avoids deleting access caches that may still
good, thus preventing unnecessary FetchStatus calls.

Change-Id: Id4c138dab45fd48265a4029880a5d57947e67a52
Reviewed-on: http://gerrit.openafs.org/11070
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoroken: configure checks for getaddrinfo and friends
Michael Meffie [Sat, 11 Jan 2014 03:17:57 +0000]
roken: configure checks for getaddrinfo and friends

Change-Id: Icb2ace89332024668c9dc4326b967a1015afc1e9
Reviewed-on: http://gerrit.openafs.org/11199
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoImport of code from heimdal
Heimdal Developers [Wed, 4 Jun 2014 20:04:19 +0000]
Import of code from heimdal

This commit updates the code imported from heimdal to
5dfaa0d10b8320293e85387778adcdd043dfc1fe (git2svn-syncpoint-master-311-g5dfaa0d)

New files are:
roken/freeaddrinfo.c
roken/gai_strerror.c
roken/getaddinfo.c
roken/getnameinfo.c

Change-Id: I4a80dfd0d95cfd252af5ce3228fb824b4aacb961
Reviewed-on: http://gerrit.openafs.org/11198
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoroken: add getaddrinfo and friends the imported file list
Michael Meffie [Sat, 11 Jan 2014 03:12:08 +0000]
roken: add getaddrinfo and friends the imported file list

Change-Id: I2203bf9ab45feb47df760b404727d23d1fa15381
Reviewed-on: http://gerrit.openafs.org/11197
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolinux: dont ignore kmod build errors
Michael Meffie [Tue, 3 Jun 2014 03:24:45 +0000]
linux: dont ignore kmod build errors

Errors from the linux kmod build are not propagated, since make is
run as the first command in a pipeline, and the shell returns the
exit code of the last command in the pipeline.  Run the make command
in a subshell to detect errors, and exit afterwards.  (This method
is more portable than bash specific pipeline processing options.)

Thanks to Mark Vitale for pointing out this build system defect
to me.

Change-Id: If3e204fe31dbdc9e7416d52fae897f792d27d678
Reviewed-on: http://gerrit.openafs.org/11186
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agobozo: Ignore ListKeys ka_KeyCheckSum return value
Andrew Deason [Wed, 4 Jun 2014 14:42:46 +0000]
bozo: Ignore ListKeys ka_KeyCheckSum return value

With commit c04de52da4e89e15b211b4a19a3d9bc4d612b209, an error in
ka_KeyCheckSum here makes the entire BOZO_ListKeys RPC to fail. This
caused two changes:

 - That commit makes the RPC fail in situations where it did not
   before. But even if we cannot calculate the checksum, we can still
   return other information about the key, so this is undesirable.

 - It masks the previous 'code' value, returned from stat(). The
   return code of stat() is now effectively ignored, except for the
   purposes of setting st_mtime, whereas previously a failure caused
   the RPC to fail. This is a behavior change.

So, effectively revert c04de52da4e89e15b211b4a19a3d9bc4d612b209.
Explicitly cast the return value of ka_KeyCheckSum to void, to make it
clear that we are intentionally ignoring the return value, so
hopefully this will not be flagged as a warning by code analysis tools
such as coverity.

Change-Id: Iac745d7c88ed7c2d97660e6949caa63580eef6e2
Reviewed-on: http://gerrit.openafs.org/11194
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agorx: Do not try to cancel nonexistent events
Benjamin Kaduk [Thu, 5 Jun 2014 00:41:57 +0000]
rx: Do not try to cancel nonexistent events

Unconditionally cancelling the resend event and releasing the
reference it was supposed to have on the call, can cause the
call reference count to go negative.

In particular, the call chain when a new rx_call structure is
allocated would cause its reference count to become negative.

Behave similarly to all the other rxevent_Cancel calls touched
by 20034a815750beff262d49b37fba225c72dd0ab1, and only cancel the
event and drop a reference when the event is present on the call.

Change-Id: Icf2dd58c2545814ac17bb960077621c6d3209da0
Reviewed-on: http://gerrit.openafs.org/11201
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoafs/VNOPS: use osi_AllocSmallSpace() correctly
Chas Williams (CONTRACTOR) [Fri, 23 May 2014 11:48:11 +0000]
afs/VNOPS: use osi_AllocSmallSpace() correctly

Send the size down to the allocator so it can perform some
consistency checks.

Change-Id: I6c089ab912014c639888b744a92a28813fb4b3c4
Reviewed-on: http://gerrit.openafs.org/11168
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agofstrace: Don't read uninitialised data on other platforms either
Stephan Wiesand [Mon, 2 Jun 2014 14:15:15 +0000]
fstrace: Don't read uninitialised data on other platforms either

Commit 908105fe8d51551e45692de4e145022138a0356c fixed an off-by-one
error potentially causing a buffer overread in CheckTypes, but only
in the IRIX/AIX version of the function. Apply the same fix to the
code for the other platforms.

Spotted by Andrew Deason.

Change-Id: I5f70c072e609337b39064ba48353b4fdf23acf17
Reviewed-on: http://gerrit.openafs.org/11185
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoafs: Delete unneeded duplicate code
Perry Ruiter [Fri, 30 May 2014 02:24:24 +0000]
afs: Delete unneeded duplicate code

Delete a memory release and a goto since natural code flow will
result in exactly the same thing.

Change-Id: I8fe1400aa2db0e15cbbd577ba18cc1fcdec18447
Reviewed-on: http://gerrit.openafs.org/11179
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfig: Move AFS_LRALLOCSIZ to afs_args.h
Perry Ruiter [Tue, 27 May 2014 08:26:59 +0000]
config: Move AFS_LRALLOCSIZ to afs_args.h

AFS_LRALLOCSIZ is currently defined in afs/afs.h.  Other memory
related definitions such as AFS_SMALLOCSIZ and AFS_MDALLOCSIZ
are defined in config/afs_args.h.  Move AFS_LRALLOCSIZ to
config/afs_args.h for consistency.

Change-Id: Ie1e286c24be6a2def404a54355a2fa4b2c42330d
Reviewed-on: http://gerrit.openafs.org/11174
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: Speed up afs_CheckTokenCache
Marc Dionne [Tue, 29 Apr 2014 16:48:03 +0000]
libafs: Speed up afs_CheckTokenCache

On systems with a large number of PAGs and files in use, the
periodic daemon job that checks for expired credentials and
cleans up the axs cache can run for a very long time.  This
can lead to kernel soft lockups and eventually hang processes
and file access because of unavailable locks.

Rework the scanning logic in afs_CheckTokenCache to make the
scanning more efficient in most real world cases.  On a test
system accessing ~4000 files from processes in 1000 PAGs, this
has been observed to reduce the runtime of afs_CheckTokenCache
from a problematic ~70s down to about 0.7s.

Additionally, this changes the conditions in which an axscache is
discarded. uid+cell (rather than just uid) must now match, and
if no matching unixuser is found, it will also be discarded.

Adapted from code from Jeffrey Altman who provided the original
loop algorithm and code.

Change-Id: I65b275b4244b3b6ab65453623bb8729530a9e1a6
Reviewed-on: http://gerrit.openafs.org/11123
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoDummy Makefile for rxgk
Ben Kaduk [Fri, 4 Jan 2013 21:16:04 +0000]
Dummy Makefile for rxgk

Include a libtool export symbol list for the shared library, which
only has the client RPC calls and the NewFooSecurityObject primitives
for now, since that's all that's stubbed out.

Also connect the rxgk directory up to be buildable from the root, but
nothing depends on it yet so it will not be built.

Looking ahead, build a libafsrpc_rxgk.la object.

Change-Id: I12ddefbdaa1ad4845649e3a32efdeaaa21b5e9b7
Reviewed-on: http://gerrit.openafs.org/10563
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoAdd rxgk boilerplate
Ben Kaduk [Fri, 6 Dec 2013 20:24:58 +0000]
Add rxgk boilerplate

Just the skeleton of what needs to be there.  The actual import is split
over multiple commits, to make the reviewer's burden more manageable.

Error table, protocol description, and stubs for the security object
routines, with header to declare them.

The public header rxgk.h currently only contains a few typedefs and the
NewSecurityObject prototypes, and includes the RPC interface and com_err
code headers.

Change-Id: I7893f78119bb4aef12112cc1e51e1ec69de326c2
Reviewed-on: http://gerrit.openafs.org/10562
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoAdd some configure bits for GSS-API
Ben Kaduk [Fri, 6 Dec 2013 19:56:25 +0000]
Add some configure bits for GSS-API

rxgk will require gss_pseudo_random and might want a couple other
krb5-specific bits.  We'll also need substvars to tell whether or
not we can try building these things.

Change-Id: Id18eb3f554605875696095eb40c25ec54df1f74b
Reviewed-on: http://gerrit.openafs.org/10561
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoLinux: Drop PageReclaim AOP_WRITEPAGE_ACTIVATE case
Marc Dionne [Mon, 5 May 2014 17:33:10 +0000]
Linux: Drop PageReclaim AOP_WRITEPAGE_ACTIVATE case

The exit case here seems to have been added to avoid recursion into
the writeback code and eventual deadlock (see RT #15239).  One issue
is that the PageReclaim check can trigger in code paths that don't
deal with the AOP_WRITEPAGE_ACTIVATE code correctly, leading to EIO
errors when multiple threads are doing large mmap writes and memory
pressure is sufficient to trigger reclaim.

The check could be improved to check wbc.for_reclaim which seems to
indicate more reliably when it is safe to return ACTIVATE, but given
that the CPageWrite flag already provides more targeted recursion
prevention, it seems safer to just drop this special case.

Note that many kernel filesystems used to have a similar check mainly
to prevent excessive stack usage, but as more recent kernels have
moved away from doing any writeback during direct reclaim this is a
case that should no longer occur.  Partly as a result of this there
are very few users of AOP_WRITEPAGE_ACTIVATE left in the kernel,
which may be a motivation to find a better mechanism for OpenAFS
eventually.

This has been shown to help avoid EIO errors with multiple processes
doing intensive mmap writing.

Thanks to Yadav Yadavendra for identifying the issue and providing
extensive analysis and testing.

Change-Id: I88d9ef6e6e7a8f666f82c5ca481254839c2ba1e5
Reviewed-on: http://gerrit.openafs.org/11125
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agovolser: log message for cross-device link errors
Michael Meffie [Tue, 18 Feb 2014 18:59:59 +0000]
volser: log message for cross-device link errors

Add a log entry to the volume server to help diagnose those pesky
'Invalid cross-link device' errors returned by vos, which occur when
a clone volume is located in a different partition than the parent
read-write volume, or when a read-only volume is on the incorrect
partition on the server.

With this change, a new log entry is added when the volume server
fails to create a clone or a read-write volume because a volume with
the target volume id already exists on a different partition.  For a
clone volume, this would be a different partition than the
read-write volume. For a read-only volume, this would be a different
partition than indicated in the vldb.

Examples:

Volume foobar is on /vicepb, but foobar.backup is incorrectly on
partition /vicepa.

$ vos backup foobar
Failed to clone the volume 536870934
: Invalid cross-device link

VolserLog:
 VCreateVolume: volume 536870936 for parent 536870934 found on /vicepa; unable to create volume on /vicepb.
 1 Volser: Clone: Couldn't create new volume 536870936 for parent 536870934; clone aborted
 ...

The vldb indicates a read-only volume should be on /vicepa on a
remote site, but the actual volume is on /vicepb.

$ vos release xyzzy
Failed to create the ro volume: : Input/output error
The volume 536870921 could not be released to the following 1 sites:
                             mantis /vicepa
VOLSER: release could not be completed
...

VolserLog on mantis:
 VCreateVolume: volume 536870922 for parent 536870921 found on /vicepb; unable to create volume on /vicepa.
 ...

Change-Id: Iaa471c46059d598a5095d59580e3b0b8ac6e1992
Reviewed-on: http://gerrit.openafs.org/10849
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agovol: Fix gcc 4.9 warnings
Marc Dionne [Wed, 28 May 2014 13:53:58 +0000]
vol: Fix gcc 4.9 warnings

gcc 4.9 complains here because the trailing 0 in these macros
has no effect, the value having already been set to NULL.
Just remove the offending 0s, nothing uses the return value
anyway, even if there were platforms where 0 != NULL.

Change-Id: Ic9a79d51419726c0c823a9228c21c13dea918dc8
Reviewed-on: http://gerrit.openafs.org/11176
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: allocate vattrs in LINUX to reduce stack used
Michael Meffie [Sun, 18 May 2014 23:28:16 +0000]
libafs: allocate vattrs in LINUX to reduce stack used

Allocate temporary vattrs in LINUX to reduce the amount
of stack space used.

Change-Id: Iafa8d920b7149486f1ea8fb1999c1f4c9a935615
Reviewed-on: http://gerrit.openafs.org/11170
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: api to create and free vattrs
Michael Meffie [Sun, 18 May 2014 21:17:38 +0000]
libafs: api to create and free vattrs

Add a pair of functions to allocate and free struct vattrs,
to avoid having struct vattrs on the stack.

Change-Id: Ia5a148ebcdf8a2f1e3a2aa9d8fd3c0e0cd0e25e9
Reviewed-on: http://gerrit.openafs.org/11169
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoUse a separate toplevel target for venus/tests
Benjamin Kaduk [Wed, 28 May 2014 14:41:02 +0000]
Use a separate toplevel target for venus/tests

There's no particular reason to lump them in with the venus target,
and we have reports that it causes parallel build failures on some
systems.

Just use a separate 'venustests' target akin to rxtests and ubiktests
and the like, instead.

Some of these lines are now long and should be wrapped, but leave
that for a follow-up commit.

Change-Id: Idd50c02d3c0c88dc2788ecfd221bbc5cbf8cba19
Reviewed-on: http://gerrit.openafs.org/11177
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibadmin: Remove redundant memset call
Stephan Wiesand [Fri, 30 May 2014 13:05:28 +0000]
libadmin: Remove redundant memset call

Commit bf78bf2c115659b78c34d3bc9d1934bcff21c8cc added initialisation
of the nbulkentries structure to 0, to avoid freeing garbage due to a
goto fail_... before the structure is initialised. As pointed out by
Andrew Deason, there already is an equivalent memset call later in the
code which is now redundant. Remove it.

Change-Id: I236e6de2a79f4f483be314654225bd52316f5a02
Reviewed-on: http://gerrit.openafs.org/11180
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoaudit: Delete va_copy kludge
Perry Ruiter [Fri, 30 May 2014 21:28:53 +0000]
audit: Delete va_copy kludge

When I developed fix c3d4c109305b2db8a63b754c1894ad37326dc340 I used
va_copy.  I was nervous because it required C99, but I had no
problem with any of the buildbots, nor did any reviewer comment.
audit/audit.c contains a local hack to simulate va_copy in the
pre C99 days.  There are no uses of va_copy in audit.c but
presumably at some point there was.  Delete the local va_copy.

Change-Id: I5e30c7e3052aeffe56e366888c5a3db3a705fd00
Reviewed-on: http://gerrit.openafs.org/11184
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoDelete several unused memory management constants
Perry Ruiter [Tue, 27 May 2014 08:16:26 +0000]
Delete several unused memory management constants

Change 412854593cf368006c18e6c0dc607a9ecd76a0e0, removed from
the code base the last usage of:
AFS_SALLOC_LOW_WATER (defined in afs/afs.h)
AFS_MALLOC_LOW_WATER (defined in config/afs_args.h)
AFS_MDALLOCSIZ (defined in config/afs_args.h)
This patch deletes these constants.

Change-Id: I1333aed508875e9b13dc3f36f3ff0d5eadfb2cfd
Reviewed-on: http://gerrit.openafs.org/11173
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agobcrypt keys are on the rxkad list, not rxgk
Ben Kaduk [Fri, 13 Dec 2013 18:19:04 +0000]
bcrypt keys are on the rxkad list, not rxgk

Make the code match the comment.

Change-Id: If891b9a4b33eafc93816077c321790f5af10803f
Reviewed-on: http://gerrit.openafs.org/10582
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoSuppress nonliteral format string warning/error
Ben Kaduk [Wed, 8 May 2013 16:51:31 +0000]
Suppress nonliteral format string warning/error

Clang doesn't like a nonliteral format string, and some kernel
builds (e.g., freebsd) are done with -Werror.  Use the standard
workaround for FreeBSD and UKERNEL builds by calling vsnprintf()
into a fixed buffer.

Remove the !defined(AFS_LINUX26_ENV) check, as it duplicates a
conditional around the entirety of osi_Panic().

Change-Id: If6287dd19604b78150c81febba8a59b73f56783c
Reviewed-on: http://gerrit.openafs.org/9880
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agocmd: List version in help for commands
Georg Sluyterman [Wed, 26 Mar 2014 21:48:56 +0000]
cmd: List version in help for commands

List version in help for commands using cmd library

Change-Id: I4da64be11244e64d961e8de47cecb24cbbadce32
Reviewed-on: http://gerrit.openafs.org/10956
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agobuild: separate source and header compile_et rules
Michael Meffie [Sun, 27 Oct 2013 03:35:14 +0000]
build: separate source and header compile_et rules

Generate source and header files separately to support parallel make
without contortions.

Add a complete list of dependencies for each generated header file
to avoid build errors during parallel make.

Change-Id: I804ff553e08d411a1cfe20a4ef4e57da9d321837
Reviewed-on: http://gerrit.openafs.org/10370
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agorxkad: fix include quotes for generated headers
Michael Meffie [Sun, 2 Mar 2014 19:54:00 +0000]
rxkad: fix include quotes for generated headers

Change-Id: I36f7df2205fb4e655c3f342b864df5b877469aec
Reviewed-on: http://gerrit.openafs.org/10871
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoauth: fix include quotes for generated headers
Michael Meffie [Sun, 2 Mar 2014 17:26:24 +0000]
auth: fix include quotes for generated headers

Change-Id: If4786c30b0b448ea4ff663d62d5e0f8623736084
Reviewed-on: http://gerrit.openafs.org/10870
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: separate source and header compile_et rules
Michael Meffie [Sun, 19 Jan 2014 22:04:08 +0000]
libafs: separate source and header compile_et rules

Use the new compile_et -emit flag to generate source and header
files separately to support parallel make.

Export afs_trace.h since it is required to build libafs.  Before the
compile_et -emit flag was available, The afs_trace.h file was
generated as a side-effect of creating afszcm.cat.

Change-Id: I4e93691dda34ddc8600d6a818503e0c9e75e618a
Reviewed-on: http://gerrit.openafs.org/10729
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibadmin: separate source and header compile_et rules
Michael Meffie [Tue, 21 Jan 2014 18:45:32 +0000]
libadmin: separate source and header compile_et rules

Use the new compile_et -emit option to generate source
and header files separately for parallel make support.

Remove unneed -h options, since there are no prolog
files and the header names match the error table names.

Change-Id: Ib94bf2cd34e9102d4047d8f1ae0b108af3299cc4
Reviewed-on: http://gerrit.openafs.org/10730
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agodoxygen: make dox
Michael Meffie [Sun, 30 Mar 2014 09:53:16 +0000]
doxygen: make dox

Add an optional make target (make dox) and doxygen configuration to
generate doxygen output files.  Auto-detect when the doxygen and
graphviz dot tools are available.  When dot is present, configure
doxygen to create dependency graphs.

Since the graph generation can take a very long time, a new
configure option has been added to override the dot tool
auto-detection. To disable the graph generation (even if dot is
installed), run configure with the option: --without-dot

When graph generation is desired, but graphviz dot is not present in
the PATH, specify the path to dot with the configure option
--with-dot=<path-to-dot>.

The configure summary has been updated to show when doxygen document
and graph generation is configured.

Thank you Jason Edgecombe for providing the doxygen configuration
for OpenAFS.

Change-Id: Ie875fc2961877ee76e4c17631bbb95c29ef20b9e
Reviewed-on: http://gerrit.openafs.org/10970
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoconfigure: fix comment about unix variants
Michael Meffie [Sun, 30 Mar 2014 12:02:17 +0000]
configure: fix comment about unix variants

Remove vulgar comment, and remove commented out checks for
aix and minix.

Change-Id: I1ee6948bab3185a7855f1d9dc0e9557e27d4e1d2
Reviewed-on: http://gerrit.openafs.org/10969
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agorxgen: use unsigned type for max array length
Benjamin Kaduk [Fri, 25 Apr 2014 19:23:16 +0000]
rxgen: use unsigned type for max array length

Plain '0' is of type int, i.e., signed, and therefore so is '~0'.
The length of an XDR array is unsigned, so this constant should
be of an unsigned type.

Change-Id: I13f5f94b2f54bc0adcdf2ded1696b797b5205057
Reviewed-on: http://gerrit.openafs.org/11107
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoSome rx type cleanup for signedness
Benjamin Kaduk [Fri, 25 Apr 2014 19:24:22 +0000]
Some rx type cleanup for signedness

The epoch, Cid, and security header/trailer sizes are all fundamentally
unsigned quantities.  Change the types exposed in some API signatures
to match this reality, and also change the global variables for the
epoch and Cid to match.  (Per-connection variables were already of
an unsigned type.)

Change-Id: I4a56736ef7d78028d1d0b980cda0b4c37d694388
Reviewed-on: http://gerrit.openafs.org/11106
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoInstall afscp.h from srcdir, not the build dir
Benjamin Kaduk [Wed, 21 May 2014 19:58:17 +0000]
Install afscp.h from srcdir, not the build dir

That header is not a generated file, and is not found in the
object directory.  make install would fail from a separate objdir
prior to this change.

Change-Id: I31041c793bd930cfe2fc3c5f8a754ba1b91c26e5
Reviewed-on: http://gerrit.openafs.org/11160
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agolibafs: reduce stack space in LINUX
Michael Meffie [Wed, 9 Apr 2014 12:40:21 +0000]
libafs: reduce stack space in LINUX

Allocate temporary vrequests to reduce the amount
of stack space used.

Change-Id: I71ed86b6345ce69a70f33cdbaf5eed2abb2cef19
Reviewed-on: http://gerrit.openafs.org/11005
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: api to create and free vrequests
Michael Meffie [Mon, 14 Apr 2014 20:07:53 +0000]
libafs: api to create and free vrequests

Add a pair of functions to allocate and free struct vrequests, which
are to be used to avoid having struct vrequests on the stack.

Change-Id: I6cbfe2ed21beb1ba500975188bb76608fdee4bc7
Reviewed-on: http://gerrit.openafs.org/11074
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoLogfiles: open with O_APPEND
Christof Hanke [Thu, 24 Apr 2014 04:19:32 +0000]
Logfiles: open with O_APPEND

This does not change the current (normal) behaviour, but allows
logrotation via "copy and truncate" as offered by logrotate.
Otherwise the processes will remember the offset of the last write
and a truncated file is filled with '\0' until the current offset.
The mrafsStyleLogs are untouched, since they can be rotated by a
kill -HUP and are deprecated anyway.

Change-Id: I09437aac63205fee3d97850507531e6833fed14f
Reviewed-on: http://gerrit.openafs.org/11092
Reviewed-by: Nathaniel Filardo <nwfilardo@gmail.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

9 years agoAdd a small string formatting utility to opr
Nathaniel Wesley Filardo [Sun, 30 Mar 2014 02:56:21 +0000]
Add a small string formatting utility to opr

This is to be used by the (coming next) vos-foreach utility, but it seemed
sufficiently general and useful to break out into its own free-standing
component.

Change-Id: I92c3a615fecb80e1766f78492b229a826a23e18a
Reviewed-on: http://gerrit.openafs.org/10965
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoreadme: move README.WARNINGS to CODING
Michael Meffie [Mon, 31 Mar 2014 18:01:37 +0000]
readme: move README.WARNINGS to CODING

Move the information about compiler warnings to the CODING
readme file.

Change-Id: I0be752c76ddee809fe80bd1f97048953eeee89ee
Reviewed-on: http://gerrit.openafs.org/10975
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoreadme: move git info to CODING
Michael Meffie [Mon, 31 Mar 2014 17:57:33 +0000]
readme: move git info to CODING

Move the REAME.GIT information to the CODING readme file.

Change-Id: I3013e03ebfe003dce23f0e2d808ab6905dd2b452
Reviewed-on: http://gerrit.openafs.org/10974
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoreadme: rename README.DEVEL to CODING
Michael Meffie [Mon, 31 Mar 2014 17:06:03 +0000]
readme: rename README.DEVEL to CODING

Rename the developer's readme file to CODING as a home
for developer related information.

Change-Id: I8c2cf70258671387b926ef3d666f6476056ef06e
Reviewed-on: http://gerrit.openafs.org/10973
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agomakefile: remove comment about washtool
Michael Meffie [Sun, 30 Mar 2014 12:11:00 +0000]
makefile: remove comment about washtool

Once upon a time, AFS used something called washtool as part
of the build system. Remove the remnant comment about it.

Change-Id: I566920b98c03d3cc65a6e2974a78a9247fd79842
Reviewed-on: http://gerrit.openafs.org/10968
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: reduce stack space in VNOPS
Michael Meffie [Tue, 8 Apr 2014 20:10:36 +0000]
libafs: reduce stack space in VNOPS

Allocate temporary vrequests to reduce the amount
of stack space used.

Change-Id: Ic14cc4f657f7c7e97ef396601bd6c8c7f91abe55
Reviewed-on: http://gerrit.openafs.org/11004
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: reduce stack space
Michael Meffie [Thu, 27 Mar 2014 23:36:29 +0000]
libafs: reduce stack space

Allocate temporary vrequests to reduce the amount
of stack space used.

Change-Id: I8c50a3af3028512003a02e46a2960b9b135213a5
Reviewed-on: http://gerrit.openafs.org/11003
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agolibafs: check afs_InitReq return code
Michael Meffie [Thu, 24 Apr 2014 19:27:38 +0000]
libafs: check afs_InitReq return code

Do not ignore the return code from afs_InitReq everywhere it is
called. If afs_InitReq fails, the vrequest could not be initialized
for some reason.

Change-Id: Ibae9f93c1e20a9fcae812f047da14106e6717454
Reviewed-on: http://gerrit.openafs.org/11097
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoredhat: Use the right path to depmod
Stephan Wiesand [Wed, 7 May 2014 13:20:51 +0000]
redhat: Use the right path to depmod

As of Fedora 17 and RHEL 7, depmod has moved from /sbin to /usr/sbin.
The full path to depmod is used in package scripts and as a dependency.
This hasn't caused problems in most cases because on an installed
system a link /sbin -> /usr/sbin is present and during ordinary package
installations yum/rpm correctly then figure out that /sbin/depmod is
actually provided. But in other situations, the dependency check is not
that clever and (incorrectly) fails.

Add a macro to the spec defining the full path to depmod, use the macro
rather than plain /sbin/depmod throughout the spec, and also pass it to
kmodtool when required to generate the kmod package scripts and
requirements.

FIXES 131860

Change-Id: I1f2e4f7100d244477c2cb9087d2f48bbcea27fdc
Reviewed-on: http://gerrit.openafs.org/11128
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoOpenBSD: Add support for OpenBSD 5.4
Antoine Verheijen [Wed, 7 May 2014 20:57:26 +0000]
OpenBSD: Add support for OpenBSD 5.4

Add param header files and other config info to provide
support for OpenBSD 5.4.

Change-Id: I56d2e716bd7fa4dee699f8d190cb4b60bb0f67a8
Reviewed-on: http://gerrit.openafs.org/11130
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoafs: Suppress duplicate message on Linux
Perry Ruiter [Mon, 31 Mar 2014 11:42:22 +0000]
afs: Suppress duplicate message on Linux

Update afs_util.c to call afs_warnall in places where afs_warn and
afs_warnuser are called back to back with identical parameters.

Change-Id: I529344dea12149d8f18ec38bb17418c703f7d26b
Reviewed-on: http://gerrit.openafs.org/11006
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoafs: Define afs_warnall routine
Perry Ruiter [Sat, 22 Mar 2014 07:52:32 +0000]
afs: Define afs_warnall routine

In a Linux environment afs_warn and afs_warnuser both go to
the same spot, resulting in duplicated messages if both are
invoked back to back.  Define a new function afs_warnall
for use when identical messages are directed to both warn
and warnuser.  In a Linux environment it will do the right
thing and present only one copy of the message.

Change-Id: I1abdc63adc74fe5b08d3872d48698ec9dcc7a40c
Reviewed-on: http://gerrit.openafs.org/10943
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoafs: restructure afs_warn and afs_warnuser
Perry Ruiter [Sat, 22 Mar 2014 06:31:21 +0000]
afs: restructure afs_warn and afs_warnuser

Restructure afs_warn.c to provide an afs_vwarn and afs_vwarnuser
that accepts a va_list rather than a variadic parameter
specification.  afs_warn and afs_warnuser continue to be
variadic functions but now call afs_vwarn and afs_vwarnuser.
This is a preparatory change.  A subsequent update will
further exploit afs_vwarn and afs_vwarnuser.

Change-Id: I8e740c4db311582bda6422e6600f1503dfbd0f5a
Reviewed-on: http://gerrit.openafs.org/10942
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agosolaris: help fs_conv_sol26 build cleanly
Chas Williams (CONTRACTOR) [Fri, 9 May 2014 17:25:55 +0000]
solaris: help fs_conv_sol26 build cleanly

handleit(), being static, should be declared before usage.

Change-Id: I5cf9767ed2fc552f7a22c7570d0a4d256a4111b1
Reviewed-on: http://gerrit.openafs.org/11134
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agovos: vos release -force-reclone option
Michael Meffie [Fri, 1 Feb 2013 22:46:45 +0000]
vos: vos release -force-reclone option

Add a new vos release option called -force-reclone to force the
reclone of the release clone and a release to all of the remote
sites, regardless of the state of the VLDB flags on the remote
sites, but does not force full volume dumps when distributing the
volume.

Provide an alias -f for -force for compatibility with the original
IBM vos, in case scripts were written to use the old '-f' option,
and for users with muscle memory.

Change-Id: I0ebebc5e8099299781e8da57579d91848bb2ad19
Reviewed-on: http://gerrit.openafs.org/9020
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoNetBSD: update kernel module glue for NetBSD 6.99.x
Jonathan A. Kollasch [Thu, 17 Apr 2014 17:55:34 +0000]
NetBSD: update kernel module glue for NetBSD 6.99.x

Change-Id: I4fe5ccb33ec823a6df3a73e94247a0a42b970e57
Reviewed-on: http://gerrit.openafs.org/11089
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoRestrictedQuery feature
Gergely Risko [Wed, 19 Mar 2014 09:56:26 +0000]
RestrictedQuery feature

Make vlserver and volserver suppport a new command line parameter,
"-restricted_query admin".  When this is on, the query RPCs that
are not needed for normal cache manager operations are restricted
to administrators listed in UserList.  This is off by default.

Change-Id: I2a23a4e99cabd46b19ed491a6520773731a5994e
Reviewed-on: http://gerrit.openafs.org/10927
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agouss: add missing include
Michael Meffie [Thu, 17 Apr 2014 13:31:18 +0000]
uss: add missing include

Fix a build error when configured with --enable-uss. The
added include defines the VolumeId which is needed by
the volser.h.

Change-Id: Ifbdaadf4de726ff1da54e93ba47124c5b5eb9cfb
Reviewed-on: http://gerrit.openafs.org/11084
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoaklog: double get_credv5 in retry logic
Michael Meffie [Fri, 9 May 2014 15:43:35 +0000]
aklog: double get_credv5 in retry logic

Fix a bug where get_credv5() is called twice, even if the first one
succeeded, in the aklog retry logic.

(This bug uncovers another bug where get_credv5_akimpersonate
crashes in the krb5 libs when get_credv5 is called back to back.)

Change-Id: Ie6cac3b4522946c87c30ad3cd6939738234800bf
Reviewed-on: http://gerrit.openafs.org/11133
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agodoc: Clarify some BosConfig.new text
Andrew Deason [Tue, 15 Apr 2014 17:30:19 +0000]
doc: Clarify some BosConfig.new text

It is not always clear to users whether BosConfig.new is noticed
during an automatic restart, or if it requires stopping and starting
the bosserver. Slightly reword the relevant text and add a small note
that a "general restart" does cause BosConfig.new to be noticed, so
this is explicitly clear.

Change-Id: Iab3eaff176305b0b2991a6636e70204b5072b1b0
Reviewed-on: http://gerrit.openafs.org/11076
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: Restrict redir trace buffer to 10240KB
Jeffrey Altman [Wed, 14 May 2014 10:42:40 +0000]
Windows: Restrict redir trace buffer to 10240KB

Define macro AFS_DBG_LOG_MAXLENGTH to 10240 and then use it to
enforce the 10MB trace buffer limit.

Change-Id: I98b759d9f51d24d402bfdc56570c0f0de93926a0
Reviewed-on: http://gerrit.openafs.org/11146
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: Fix uninitialized variables
Rod Widdowson [Tue, 13 May 2014 01:50:48 +0000]
Windows: Fix uninitialized variables

VS2013 spotted two cases where we do not set up the
Iosb.Status when we catch an exception from Cc.
Fix them.

Change-Id: I93b8a48863f22fd1dc2d7dba4d9de18454f35fe0
Reviewed-on: http://gerrit.openafs.org/11140
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoLinux: Prevent some fakestat data inconsistencies
Marc Dionne [Fri, 2 May 2014 18:10:06 +0000]
Linux: Prevent some fakestat data inconsistencies

When fakestat is enabled for a mount point, the parent vcache
entry is not the right place to find the DataVersion of
the target volume root directory.  This can lead to data
inconsistency since the revalidation checks rely on the parent's
DataVersion to determine if a file entry is still valid.  If the
file was replaced or deleted remotely, the only callback we
get is for the parent directory, and in that case the client
will think the file entry is still valid and give back stale
data to the user.

If fakestat is enabled and we have a mountpoint, always use
the parent vcache pointer returned by FakeStat before using it
to either store (in the lookup and create ops) or compare
(in the revalidate op) the DataVersion.

FIXES 131855

Change-Id: I03c05c1dab39e663b74635700e80ba70861b1c2e
Reviewed-on: http://gerrit.openafs.org/11118
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoWindows: cm_Analyze retries vs CM_REQ_NORETRY (2)
Jeffrey Altman [Thu, 8 May 2014 13:06:07 +0000]
Windows: cm_Analyze retries vs CM_REQ_NORETRY (2)

Commit a1b5a1d42280753de13094006dcc130fede978a1 left out a critical
part of the patch.  The check for "retry < 2" when determining whether
retries should be skipped due to CM_REQ_NORETRY.

Change-Id: I9b750e2bab11d28813447b2ee92287b8dcfbbba3
Reviewed-on: http://gerrit.openafs.org/11131
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agolibafs: fix lock leak during shutdown
Michael Meffie [Thu, 24 Apr 2014 17:40:06 +0000]
libafs: fix lock leak during shutdown

afs_getattr returns EIO when afs is in the process of shutting
down.  Be sure to unlock the locks taken before returning.
The bozon lock leak has been present since IBM AFS.

Change-Id: Id3e330c458996abf1519de6364060cc0b8828e6a
Reviewed-on: http://gerrit.openafs.org/11096
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: Adjust Last Write time handling for -1
Rod Widdowson [Sun, 4 May 2014 18:33:11 +0000]
Windows: Adjust Last Write time handling for -1

The "what date/time gets changed when and by whom" in Windows is badly
defined, but all filesystems support the semantic that if a date is set
using a specific file object (or the timestamp is set to the magic number
-1)
then other changes provoked by that file object will be ignored.

AFS redirector timestamp handling does not support this behavior.
For the LastWrite timestamp (other timestamps are pretty much advisory and
maintained on a best effort basis) the timestamp would be updated by a
write operation even after -1 is set via the file handle.

This patchset implements the -1 behavior for LastWrite.  It also follows
the standard Windows practice of setting the LastWrite timestamp to be the
time of close of the handle that performed the write, not the time of the
write itself.

Finally, it should be noted that since RX*FS_StoreXXX operations update
the last write time on the server the client must restore the LastWrite
timestamp at handle close if -1 was specified.

Change-Id: Ica0c566fabb6b3046eb51f827402d622190daea8
Reviewed-on: http://gerrit.openafs.org/11110
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: RDR AFSSubtituteName invalid UNICODE_STRING
Jeffrey Altman [Tue, 21 Jan 2014 10:44:41 +0000]
Windows: RDR AFSSubtituteName invalid UNICODE_STRING

The 'ComponentName' parameter to AFSSubstituteName() is a UNICODE_STRING
pointer.  Its address should not be passed to AFSDbgTrace when used
in conjunction with a %wZ format.

Change-Id: I12ead951b1ae376e42da12b21e32f65e736375ab
Reviewed-on: http://gerrit.openafs.org/11090
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoFix buffer length validation in ktc_GetToken and knfs
Anders Kaseorg [Sun, 4 May 2014 09:30:25 +0000]
Fix buffer length validation in ktc_GetToken and knfs

The signed int tktLen is checked against a maximum size, then passed
as the unsigned size_t argument to memcpy.  So we need to make sure it
isn’t negative.

This doesn’t appear to be exploitable: tktLen comes from the kernel,
which should have previously validated the length within the SETTOK
pioctl.

This bug was found with STACK <http://css.csail.mit.edu/stack/>.

Change-Id: I781bd300cad3d725d3517e7f6ac9e6423c417087
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/11109
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agodoc: recommend cleanup steps in "vos convertROtoRW" man page
Ken Dreyer [Wed, 6 Mar 2013 20:53:29 +0000]
doc: recommend cleanup steps in "vos convertROtoRW" man page

vos convertROtoRW leaves the older RW copy on the original fileserver,
although it is no longer in the VLDB. Provide the user with some hints
regarding clean up.

Change-Id: I5f6fcf7d5a516b59438d84e60f163a567d3a64fd
Reviewed-on: http://gerrit.openafs.org/9408
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: Ken Dreyer <ktdreyer@ktdreyer.com>

9 years agoFix typo in rfc3961 namespace-cleaning
Ben Kaduk [Mon, 9 Dec 2013 19:54:18 +0000]
Fix typo in rfc3961 namespace-cleaning

Change-Id: If93119ce4345ab8d1eccb9df7196b1681d2762cb
Reviewed-on: http://gerrit.openafs.org/10550
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agovol: Fix build with separate objdir
Benjamin Kaduk [Mon, 7 Apr 2014 21:55:09 +0000]
vol: Fix build with separate objdir

The volscan-main and volinfo-main source files are in the source
tree, not the object tree; refer to the objects in the Makefile
as dependencies, so that they will be picked up properly.  The
objects will be made just fine by the implicit .c.o rule.

Change-Id: Ieec4b32cfbe5d260e1560a08d4ed8162720f9222
Reviewed-on: http://gerrit.openafs.org/10988
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agolinux: make reading unixusers from proc actually work
D Brashear [Tue, 22 Apr 2014 15:38:44 +0000]
linux: make reading unixusers from proc actually work

our indentation did not match our braces so we would never read all the
objects in each unixuser hash chain. add the missing braces

Change-Id: I001b55f0d43639124b06758095664a31e8230db6
Reviewed-on: http://gerrit.openafs.org/11094
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoNetBSD: fix rx_kmutex's CV_WAIT_SIG macro
Jonathan A. Kollasch [Thu, 17 Apr 2014 17:48:30 +0000]
NetBSD: fix rx_kmutex's CV_WAIT_SIG macro

Change-Id: I6550f5c71bafe03290c1dbda545ff3feea01a805
Reviewed-on: http://gerrit.openafs.org/11088
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

10 years agoWindows: Deny writes/truncation to files w RO attr
Jeffrey Altman [Fri, 4 Apr 2014 20:42:36 +0000]
Windows: Deny writes/truncation to files w RO attr

If the readonly file attribute is set on a file, refuse to process
writes, truncations or overwrites.   The afsd_service will do so
and this can lead to data corruption.

At the same time, writes from the redirector to afsd_service must
not be denied because of the readonly attribute.  That check was
performed during the CreateFile.   Otherwise, a new file can be
created with the readonly attribute and then not be writable.

Change-Id: I921a11eb8c1a3e642d60c23fc905b3febc0f0761
Reviewed-on: http://gerrit.openafs.org/10985
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

10 years agoWindows: NP Fail requests if AFSGetAuthenticationId fails
Jeffrey Altman [Wed, 12 Mar 2014 16:49:40 +0000]
Windows: NP Fail requests if AFSGetAuthenticationId fails

If during the processing of a network provider request the Logon
Session AuthenticationId is zero and the AFSGetAuthenticationId()
function is unable to obtain the current thread's AuthenticationId,
then fail the request.

Change-Id: If2aeba836d762f4f1b982d954fac720863a05c1f
Reviewed-on: http://gerrit.openafs.org/10900
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>