openafs.git
8 years agoafs: Clarify vcache->mvid accesses
Andrew Deason [Sat, 14 Feb 2015 00:02:44 +0000]
afs: Clarify vcache->mvid accesses

Currently, numerous places in the code treat the 'mvid' field in
struct vcache as a few different things:

 - If the vcache is a mountpoint, mvid points to the fid of the root
   dir of the target volume.

 - If the vcache is a volume root dir, mvid points to the fid of the
   parent dir for the mountpoint.

 - If the vcache is a sillyrenamed file, mvid points to a string,
   which is the name the vcache was renamed to.

Despite these three things being very different (and one of them is a
completely different type than the others), everywhere in the code
just accesses mvid as 'avc->mvid'. This can make it very confusing as
to what the field actually means at any particular part of the code,
and makes it very difficult to search the code for places that use
mvid in any one of these specific ways.

So, to aid in code clarity, make mvid into a union, with the following
members:

 - target_root: For the "mountpoint" case.

 - parent: For the "root dir" case.

 - silly_name: For the "sillyrename" case.

This should have no effect on code behavior, but just makes the code a
bit clearer.

Change-Id: I45391bb7a99d6f8e35c44873b677d157ea681900
Reviewed-on: http://gerrit.openafs.org/11748
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agoafs: Use named constants for mvstat
Andrew Deason [Fri, 13 Feb 2015 23:31:37 +0000]
afs: Use named constants for mvstat

Currently the vcache 'mvstat' field is assigned three magic values: 0
for normal files and directories, 1 for mountpoint objects, and 2 for
volume root dirs. These values are clearly defined in comments, but
everywhere we actually assign or compare these values, we use the bare
numbers.

Stop this nonsense and use named constants, to make the code less
inscrutable.

Change-Id: Ic1b133109d619b70317141431f163e552bafd109
Reviewed-on: http://gerrit.openafs.org/11747
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>

8 years agovol: Avoid FDH_SEEK/FDH_READ
Andrew Deason [Mon, 11 Aug 2014 18:51:39 +0000]
vol: Avoid FDH_SEEK/FDH_READ

All code in the tree except for this uses positional i/o
(FDH_PREAD/FDH_PWRITE). For consistency and to ensure that we do not
mix positional and non-positional i/o, just use the positional i/o
functions here. It's simpler, too.

Change-Id: Ib65f81dde7532631cd7d642c9ef814d47c71581a
Reviewed-on: http://gerrit.openafs.org/11377
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Hans-Werner Paulsen <hans@mpa-garching.mpg.de>
Tested-by: Hans-Werner Paulsen <hans@mpa-garching.mpg.de>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agoreadme: remove README.PTHREADED_UBIK
Michael Meffie [Mon, 31 Mar 2014 18:25:54 +0000]
readme: remove README.PTHREADED_UBIK

We enabled pthreaded ubik by default in commit 27cb0d38885428474b0d4287,
and it is no longer considered beta or experimental.  There is no longer
a need for separate documentation of it, and adjust the options
listing in INSTALL accordingly.

[kaduk@mit.edu: adjust for the changed default behavior.]

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

8 years agoreadme: Rename README to INSTALL
Michael Meffie [Mon, 31 Mar 2014 18:03:58 +0000]
readme: Rename README to INSTALL

Create a new top level README to introduce OpenAFS.

Move the old README to a file called INSTALL for information about
building and installing OpenAFS on various platforms.

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

8 years agoreadme: move the LICENSE file to the top level directory
Michael Meffie [Mon, 31 Mar 2014 17:02:00 +0000]
readme: move the LICENSE file to the top level directory

Move the LICENSE file to the top directory to make it
more visible and to clean up the src directory.

Update the top level make file and redhat packaging
to accomodate the new path to the LICENSE file.

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

8 years agovlserver: ListAttributesN2 volume name safety
Jeffrey Altman [Sat, 1 Aug 2015 13:32:35 +0000]
vlserver: ListAttributesN2 volume name safety

The vlserver ListAttributesN2 RPC permits filtering the result set
by volume name in addition by site or volume id.

Two issues identified by Andrew Deason (Sine Nomine Associates) are
addressed by this patch.  First, the size of the volumename[] buffer
is insufficient to store the valid input read over the network.  The
buffer needs to be able to store VL_MAXNAMELEN characters of the volume
name, two characters for the regular expression '^' and '$', and the
trailing NUL.

Second, sprintf() is used to write to the buffer and even with valid
input from the caller SVL_ListAttributesN2 can overflow the buffer
when ".backup" and ".readonly" are appended to the volume name.  If
there is an overflow the search name is invalid and there can not be
a valid match.

This patch increases the size of volumename[] to VL_MAXNAMELEN+3.

It also uses snprintf() instead of sprintf() and performs error
checking.  The error VL_BADNAME is returned when the network input is
invalid.

Change-Id: Id65b83e0dd14c6f41af73c6868975ae53c4975a7
Reviewed-on: http://gerrit.openafs.org/11969
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Nathaniel Filardo <nwfilardo@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agovlserver: limit use of regex to admins always
D Brashear [Fri, 18 Jul 2014 20:00:12 +0000]
vlserver: limit use of regex to admins always

allow regexes only if the querying user is a superuser.
if the superuser uses up all the resources, well, they could just do
whatever damage directly anyway. means even in unrestricted mode
we are not vulnerable

Change-Id: Ib35d649f31e752ba5ae8373a06b67ea76f97425c
Reviewed-on: http://gerrit.openafs.org/11968
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agoRevert "vlserver: Disable regex volume name processing in ListAttributesN2"
Jeffrey Altman [Mon, 3 Aug 2015 19:03:00 +0000]
Revert "vlserver: Disable regex volume name processing in ListAttributesN2"

This change reverts commit 22481ab3705522ac1988b7de038c4dbc1e5009a9 which
by disabling regex queries of volume names breaks some backup software
including TSM.

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

8 years agokas: remove @CFLAGS_NOERROR@ in favor of specific pragma
Anders Kaseorg [Mon, 3 Aug 2015 01:26:13 +0000]
kas: remove @CFLAGS_NOERROR@ in favor of specific pragma

Change-Id: Icf07c63a0e5a59da19a9db4edf7ac3c346349088
Reviewed-on: http://gerrit.openafs.org/11966
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agotests/volser/vos-t.c: Don’t ignore return value of pipe
Anders Kaseorg [Sat, 1 Aug 2015 03:28:49 +0000]
tests/volser/vos-t.c: Don’t ignore return value of pipe

Resolves this warning:

vos-t.c: In function ‘TestListAddrs’:
vos-t.c:60:5: warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result [-Wunused-result]
     pipe(outpipe);
     ^

Change-Id: I7eb58a91b5a7d9df18a4952400f74c79299e857d
Reviewed-on: http://gerrit.openafs.org/11958
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agotests/opr/jhash-t.c: Fix unsigned constant warning
Anders Kaseorg [Sat, 1 Aug 2015 09:05:11 +0000]
tests/opr/jhash-t.c: Fix unsigned constant warning

Resolves this warning on 32-bit GCC:

jhash-t.c: In function ‘main’:
jhash-t.c:60:4: warning: this decimal constant is unsigned only in ISO C90
    is_int(3704403432, opr_jhash(test, 2, 0),
    ^
jhash-t.c:62:4: warning: this decimal constant is unsigned only in ISO C90
    is_int(3704403432, opr_jhash_int2(test[0], test[1], 0),
    ^

Change-Id: Ie3ab0f5aacdc719fa63f32e545b5863ec351f5eb
Reviewed-on: http://gerrit.openafs.org/11961
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agoSquash a frightening number of warnings from XBSA-related code
Anders Kaseorg [Sat, 1 Aug 2015 07:15:39 +0000]
Squash a frightening number of warnings from XBSA-related code

Mostly missing prototypes and mismatched format strings, but also some
more disturbing bugs.

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

8 years agoAdd XBSA_XLIBS to XLIBS after it’s computed
Anders Kaseorg [Sat, 1 Aug 2015 07:58:19 +0000]
Add XBSA_XLIBS to XLIBS after it’s computed

Commit 353aa7ef2c172f574998480d6d051b3f4e95ae7b (after 1.6 was
branched) reordered things such that XBSA_XLIBS was being added to
XLIBS before it was computed, which caused link failures with
--enable-tivoli-tsm.

Change-Id: I791add1b916c845d975d1ee21652c13244c50736
Reviewed-on: http://gerrit.openafs.org/11959
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agotests/opr/time-t.c: Use labs instead of abs for long argument
Anders Kaseorg [Sat, 1 Aug 2015 09:54:42 +0000]
tests/opr/time-t.c: Use labs instead of abs for long argument

Resolves this warning with clang:

time-t.c:46:8: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause
      truncation of value [-Wabsolute-value]
    ok(abs(osTime - osNow) < 2, "opr_time_Now returns a reasonable value");
       ^
time-t.c:46:8: note: use function 'labs' instead
    ok(abs(osTime - osNow) < 2, "opr_time_Now returns a reasonable value");
       ^~~
       labs

Change-Id: Ib98069e1349161d936c8ada0e69f9b33d2f71ce3
Reviewed-on: http://gerrit.openafs.org/11965
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agosrc/kauth/krb_udp.c: Remove redundant NULL check for array address
Anders Kaseorg [Sat, 1 Aug 2015 09:52:59 +0000]
src/kauth/krb_udp.c: Remove redundant NULL check for array address

Resolves this warning with clang:

krb_udp.c:302:13: warning: address of array 'tentry.misc_auth_bytes' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if (tentry.misc_auth_bytes) {
        ~~  ~~~~~~~^~~~~~~~~~~~~~~

Change-Id: I0656b055090654eada2cd63476330fb288490acc
Reviewed-on: http://gerrit.openafs.org/11964
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agorfc3961: prototype _krb5_internal_hmac
Anders Kaseorg [Fri, 31 Jul 2015 05:35:05 +0000]
rfc3961: prototype _krb5_internal_hmac

Resolves this warning:

src/external/heimdal/krb5/crypto-arcfour.c: In function ‘_oafs_h__krb5_HMAC_MD5_checksum’:
src/external/heimdal/krb5/crypto-arcfour.c:82:5: warning: implicit declaration of function ‘_oafs_h__krb5_internal_hmac’ [-Wimplicit-function-declaration]
     ret = _krb5_internal_hmac(context, c, signature, sizeof(signature),
     ^

Change-Id: I10f028b8a0e1756cb1f1638a061616db0e76779e
Reviewed-on: http://gerrit.openafs.org/11953
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agomake distclean: clean doc/xml/*/Makefile
Anders Kaseorg [Sat, 1 Aug 2015 01:27:42 +0000]
make distclean: clean doc/xml/*/Makefile

These files are conditionally generated by configure.ac.
(Conditionally is okay because this is an ‘rm -f’ line.)

Change-Id: I7ade07e09b5e378b2abf6481dc8ffac26b574eed
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/11952
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agolibadmin: #define UBIK_LEGACY_CALLITER 1 in afs_kasAdmin.c
Anders Kaseorg [Sat, 1 Aug 2015 00:47:35 +0000]
libadmin: #define UBIK_LEGACY_CALLITER 1 in afs_kasAdmin.c

Replaces this warning:

afs_kasAdmin.c: In function ‘GetPrincipalLockStatus’:
afs_kasAdmin.c:710:6: warning: implicit declaration of function ‘ubik_CallIter’ [-Wimplicit-function-declaration]
      ubik_CallIter(KAM_LockStatus, kaserver->servers, UPUBIKONLY,
      ^

with these marginally less alarming warnings:

In file included from ../adminutil/afs_AdminInternal.h:17:0,
                 from afs_kasAdmin.c:21:
/home/anders/wd/openafs/include/ubik.h:627:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern afs_int32 ubik_CallIter(int (*aproc) (), struct ubik_client *aclient,
 ^
/home/anders/wd/openafs/include/ubik.h:632:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern afs_int32 ubik_Call_New(int (*aproc) (), struct ubik_client
 ^

Change-Id: I49dbc5f6bb9199764c73c6ee8449d62518f377e6
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/11954
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovlserver: Disable regex volume name processing in ListAttributesN2
Andrew Deason [Wed, 8 Jul 2015 18:37:16 +0000]
vlserver: Disable regex volume name processing in ListAttributesN2

For the interim and until it is needed, this is most prudently
simply disabled.

FIXES 131890

Change-Id: Ib52da4ba38b579e51a0d8571e2da1307ae50a06f

8 years agoSolaris: setpag should verify that ngroups will not overflow
Mark Vitale [Wed, 8 Jul 2015 18:28:50 +0000]
Solaris: setpag should verify that ngroups will not overflow

Our ngroups management (since PAGs are still encoded as 2 groups) needs
to ensure that we do not overflow what we are prepared to handle,
and do not panic due to misheld mutexes if we have to return an error
when handling it.

FIXES 131878 (CVE-2015-3286)

Change-Id: I044d5e7d3161de815b3c2dace9c211fbb4b51ffa

8 years agoafs: Use correct output buffer for FSCmd pioctl
Andrew Deason [Wed, 8 Jul 2015 18:20:13 +0000]
afs: Use correct output buffer for FSCmd pioctl

MRAFS added the FsCmd pioctl for passing messages to the fileserver;
a bug causes it to write into the wrong memory and potentially panic
clients.

FIXES 131896 (CVE-2015-3285)

Change-Id: Ic3a81fe06edc886f24bbc0537ea53e994b086c9e

8 years agoafs: Clear pioctl data interchange buffer before use
Daria Brashear [Wed, 8 Jul 2015 18:16:41 +0000]
afs: Clear pioctl data interchange buffer before use

Avoid leaking data in pioctl interchange buffers; clear the memory
when one is allocated.

FIXES 131892 (CVE-2015-3284)

Change-Id: I880bbaa75b07b491a08c62fb17527b9fff47ec8c

8 years agobos: Use crypt for commands where spoofing could be a risk
Daria Brashear [Wed, 8 Jul 2015 18:11:33 +0000]
bos: Use crypt for commands where spoofing could be a risk

bos defaults to not requiring crypt in a lot of cases, instead using clear.

As the simplest way to secure the channel is to enable crypt, do so.

FIXES 131782 (CVE-2015-3283)

Change-Id: I354fcbb5db37db225391a47b59d99518d1d0b2f9

8 years agovos: Clear nvldbentry before sending on the wire
Daria Brashear [Wed, 8 Jul 2015 17:51:47 +0000]
vos: Clear nvldbentry before sending on the wire

Don't leak stack data onto the wire. Clear nvldbentry before use.

FIXES 131907 (CVE-2015-3282)

Change-Id: I18ea2c6ce21b6462277d067de329f4fb44dfb3ae

8 years agovos: changeaddr refuse to change mh entries without -force
Michael Meffie [Wed, 17 Dec 2014 00:25:06 +0000]
vos: changeaddr refuse to change mh entries without -force

Add a client side check to vos changeaddr -oldaddr -newaddr
to refuse to change multihomed server entries, unless -force
is given.

Change-Id: I1428e94f0c2fc19bb6ba3b2c53468f4587283bbc
Reviewed-on: http://gerrit.openafs.org/11638
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agoLinux 4.2: Changes in link operation APIs
Marc Dionne [Mon, 6 Jul 2015 16:01:38 +0000]
Linux 4.2: Changes in link operation APIs

The follow_link and put_link operations are revised.
Test for the new signature and adapt the code.

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

8 years agoLinux: Add AC_CHECK_LINUX_OPERATION configure macro
Marc Dionne [Mon, 6 Jul 2015 15:00:10 +0000]
Linux: Add AC_CHECK_LINUX_OPERATION configure macro

Add a new macro to check the signature of a particular
operation against a provided typed argument list.
One of the arguments is an arbitrary label that is used
to construct the pre-processor define name.  This will
allow for testing of different forms for the same
operation.

This can be used to replace many of the remaining odd
checks in src/cf/linux_test4.m4.

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

8 years agoLinux 4.2: total_link_count is no longer accessible
Marc Dionne [Mon, 6 Jul 2015 14:00:13 +0000]
Linux 4.2: total_link_count is no longer accessible

The value is now stored in the nameidata structure which
is private to fs/namei.c, so we can't modify it here.

The effect is that using a path that contains 40+ directories
may fail with ELOOP, depending on which directories in the
path were previously used.  After a directory is accessed once
its D_AUTOMOUNT flag is reset and it will no longer count
against the symlink limit in later path lookups.

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

8 years agoLinux 4.2: Pass namespace to sock_create_kern
Marc Dionne [Wed, 8 Jul 2015 17:32:31 +0000]
Linux 4.2: Pass namespace to sock_create_kern

sock_create_kern gains an additional network namespace
argument.

Pass in the default system namesapce.

Change-Id: I640e9497510242788e5060759779785ffb563a81
Reviewed-on: http://gerrit.openafs.org/11925
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agodoc: bosserver runs in the background
Michael Meffie [Fri, 26 Jun 2015 13:09:18 +0000]
doc: bosserver runs in the background

Since OpenAFS 1.0 bosserver automatically puts itself into the
background and removes it's controlling terminal. Update the examples in
the Admin and Quick Start Guides to remove the unneeded '&' on the
command line to start the bosserver.

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

8 years agotests: fix typo in softsig test helper
Michael Meffie [Fri, 12 Jun 2015 16:38:49 +0000]
tests: fix typo in softsig test helper

Change-Id: I74183a04b54b70bf3593a53fdb5f164cbd6c3b98
Reviewed-on: http://gerrit.openafs.org/11893
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agovos: desupport -stayonline
Daria Brashear [Wed, 4 Mar 2015 22:25:14 +0000]
vos: desupport -stayonline

roll back -stayonline support for volume releases for now.

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

8 years agolibafs: reset all the volumes with fs flushall
Michael Meffie [Fri, 12 Jun 2015 00:28:43 +0000]
libafs: reset all the volumes with fs flushall

Fix a logic bug in fs flushall in which only the first volume in each
hash chain is reset (invalidated).  Instead, reset all the volumes in
the volume hash.

This bug was introduced in commit 4197bbecd9d0b2ff0b8eaec75a0df9a64f713cf0
(libafs: fs flushall for unix cm)

Also, when flushing a single volume with fs flushvolume, don't bother
searching all the hash chains, instead start on the hash chain
containing the volume being flushed.

Change-Id: I7be67fdb310b4845d02dc916f4400f83cc649cb8
Reviewed-on: http://gerrit.openafs.org/11892
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agopagsh: do not call set[ug]id()
Benjamin Kaduk [Mon, 9 Feb 2015 17:09:32 +0000]
pagsh: do not call set[ug]id()

Supposedly calling setuid(getuid()) and setgid(getgid()) would
help pick up a new group list on some systems, in the depths
of history.  In the absence of reason to believe this is still
the case, drop the calls to avoid scary warnings about unchecked
return values.

Change-Id: I39e87a27fb52f5a6868b867c9325d4a5fa93ef58
Reviewed-on: http://gerrit.openafs.org/11759
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoAvoid unsafe scanf("%s")
Benjamin Kaduk [Mon, 9 Feb 2015 15:38:04 +0000]
Avoid unsafe scanf("%s")

Reading user input into a fixed-length buffer just to check the
first character is silly and an easy buffer overrun.  gcc on
Ubuntu 13.03 warns about the unchecked return value for scanf(),
but scanf("%s") is guaranteed to either succeed or get EOF/EINTR/etc..

In any case, we don't need to use scanf() at all, here -- reuse an
idiom from BSD cp(1) and loop around getchar to read the user's
response, eliminating the fixed-length buffer entirely.  A separate
initial loop is needed to skip leading whitespace, which is done
implicitly by scanf().

Change-Id: Ic5ed65e80146aa3d08a4b03c213f748ef088156b
Reviewed-on: http://gerrit.openafs.org/11758
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoafs: Do not supply bogus poll vnodeops for FBSD
Benjamin Kaduk [Wed, 27 May 2015 20:13:13 +0000]
afs: Do not supply bogus poll vnodeops for FBSD

We currently provide one which just always returns 1, but the
kernel provides a vop_nopoll which conceptually is the same thing.
That one, however, provides some feature checks and fails when
consumers ask for fancy features that are not portable.

Change-Id: Iba03904aac2883e18a1abdd4f09289b6c6f907c0
Reviewed-on: http://gerrit.openafs.org/11882
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoIgnore return values more harder
Benjamin Kaduk [Fri, 6 Feb 2015 19:15:11 +0000]
Ignore return values more harder

Building on Ubuntu 14.04 with gcc 4.8.2-19ubuntu1, we encounter
fatal warnings about unchecked return values in uss, which is
now always built, as of 00a33b26d74aa067086ddc340efb82184715857f.

Change-Id: I997dcb683e33902c2765121c70bdcf21e9d5e892
Reviewed-on: http://gerrit.openafs.org/11757
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoLinux: mmap: Apply recursion check only to recursion cases
Marc Dionne [Wed, 22 Apr 2015 18:06:12 +0000]
Linux: mmap: Apply recursion check only to recursion cases

The CPageWrite flag was originally added to prevent a scenario
where a thread doing "writepage" would realize that the cache
was too full and that some of its contents need to be written
back to the server.  Before writing back it would ask the OS to
flush any dirty VM associated with the vcache entries that are
to be written, to make sure the data is not stale.  This flush
could itself trigger writeback, leading to deadly recursion.
One such scenario is a process doing mmap writes to a file larger
than the cache.

With some kernel versions and some callers of writepage, this
can cause the mapping to be marked as being in an error state,
leading to EIO errors passed back to user space.

Make the recursion check more specific to only bail when the
calling thread is one that was originally seen writing.  A list
of current writers is maintained instead of a single state flag.

This lets other threads (like the flusher thread) go on with
writeback to the same file, and limits the WRITEPAGE_ACTIVATE
return case to call sites that can deal with it.

In testing this helps avoid EIO errors when writing large
chunks of data through mmap.

Thanks to Yadav Yadavendra for extensive analysis and testing.

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

8 years agoopr: Add new softsig implementation
Simon Wilkinson [Fri, 23 Mar 2012 21:26:14 +0000]
opr: Add new softsig implementation

Signals and pthreaded applications are a poor match. OpenAFS has had
the softsig system (currently in src/util/softsig.c) in an attempt to
alleviate some of these problems. However, that implementation itself
has a number of problems. It uses signal functions that are unsafe in
pthreaded applications, and uses pthread_kill within its signal
handlers. Over the years it has been responsible for a number of
portability bugs.

The old implementation continues to receive signals in the main thread
of the application. However, the handler code is run within a seperate
signal handler thread. When the main thread receives a signal a stub
handler is invoked, which simply pthread_kill()s the signal handler
thread.

The new implementation simplifies things by only receiving signals in
the handler thread. It uses only pthread-compatible signal functions,
and invokes no code from within async signal handlers.

A complete test suite is supplied.

Change-Id: I4bac68c2f853f1e7578b54ddced3833a97dd3f82
Reviewed-on: http://gerrit.openafs.org/6947
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>

8 years agoafsio: switch BreakUpPath to strdup
Benjamin Kaduk [Wed, 20 May 2015 14:57:53 +0000]
afsio: switch BreakUpPath to strdup

The current version of BreakUpPath is slightly broken, since
commit 4e68282e26b0c4569d25d076d54274f0da47a691 -- it has two
output parameters but takes only one length parameter for the
size of the output buffers passed in.  The callers ended up using
the shorter of the buffer lengths in question, so there is not
a risk of a buffer overrun, but long paths would not be properly
handled.

There is not really any need to pass in a length at all, since
what is going on is conceptually strdup, and there is no real
need to use strlcpy at all.  Make the change from strlcpy to
str(n)dup, and adjust callers to free the outputs as appropriate.

While here, convert writeFile() to use goto and a cleanup handler
to avoid leaks.

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

8 years agoAdd defines for recent darwin sysctl constants
Daria Brashear [Thu, 21 May 2015 20:34:09 +0000]
Add defines for recent darwin sysctl constants

These were accidentally omitted from commit
ab9bb6363ca95f658764fbb9fb68ec88f89a5b3f.

Change-Id: Ic3374484eb79fe44a4032def1484c9ed733f9422
Reviewed-on: http://gerrit.openafs.org/11875
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agoLinux 4.1: Don't define or use ->write directly
Marc Dionne [Mon, 20 Apr 2015 13:41:53 +0000]
Linux 4.1: Don't define or use ->write directly

We no longer have to define a ->write operation, and we can't
expect the underlying disk cache filesystem to have one.  Use
the new __vfs_read/write helpers that will select the operation
to use based on what's available for that particular filesystem.

Change-Id: Iab923235308ff57348ffc2dc6d718dd64040656b
Reviewed-on: http://gerrit.openafs.org/11849
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoLinux 4.1: No need for do_sync_read
Marc Dionne [Mon, 20 Apr 2015 13:37:40 +0000]
Linux 4.1: No need for do_sync_read

Make the test here a bit more specific. do_sync_read no longer
exists, but we don't use it for new kernels.  Trying to define it
here in terms of generic_file_read is not helpful as that doesn't
exist anymore.

Change-Id: Iffb059716165436c3439e66db15002cdec5dfc16
Reviewed-on: http://gerrit.openafs.org/11848
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agokauth: fix clock skew detection
Benjamin Kaduk [Wed, 22 Apr 2015 17:43:43 +0000]
kauth: fix clock skew detection

Commit 5b3c1042969daec38ccb260e61d665eda0c713ea changed/removed some
uses of abs() on unsigned time values. While the previous use of abs()
was indeed incorrect, the result wasn't necessarily much better, even
though it built with recent compilers, since it only checked for skew
in one direction.

Define and use a  macro to correctly evaluate the conditionals in 64-bit
precision, avoiding C's integer promotion rules which prefer unsigned types
(Date) to signed types of the same width (time_t on 32-bit systems).

Change-Id: Ifcbe59e73942a52a8635cb0f43cce94fdeea85a3
Reviewed-on: http://gerrit.openafs.org/11850
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoafsd: Update list of supported flags
Perry Ruiter [Wed, 22 Apr 2015 16:58:48 +0000]
afsd: Update list of supported flags

afsd.c starts with a block comment listing the flags supported by the
afsd command.  As the code has evolved this list has not been kept up
to date.  Bring the list up to date.  Some obsolete options no longer
have any backing code.  These are marked OBSOLETE.  Some obsolete
options have code that says they are now deprecated.  These are
marked IGNORED.

Additionally fix a typo in backuptree's help text.

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

8 years agolibafs: remove extraneous solaris headers from afs_util.c
Michael Meffie [Thu, 30 Apr 2015 13:47:11 +0000]
libafs: remove extraneous solaris headers from afs_util.c

Remove several solaris specific headers from afs_util.c which are no
longer needed.

Change-Id: Id3874c90448215dc506b7ab9b5e695c2aeef50f3
Reviewed-on: http://gerrit.openafs.org/11856
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agoosx: update afssettings for yosemite
Daria Brashear [Thu, 16 Apr 2015 17:12:05 +0000]
osx: update afssettings for yosemite

handle deprecated functions

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

8 years agoAllocate pathname buffers dynamically
Jeffrey Hutzelman [Tue, 18 Jun 2013 01:08:14 +0000]
Allocate pathname buffers dynamically

This change reworks numerous places which formerly used potentially
large on-stack buffers (of size AFSDIR_PATH_MAX) for constructing or
storing pathnames.  Instead, these buffers are now allocated from the
heap, either by using asprintf() to build a pathname in a correctly
sized buffer or, where necessary, using malloc() to allocate a buffer
of size AFSDIR_PATH_MAX.

A few occurrances of AFSDIR_PATH_MAX-sized buffers are not changed;
these are generally either globals or are contained within another
data structure that is already allocated on the heap.

[kaduk@mit.edu convert to cleanup-handler memory management where
appropriate]

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

8 years agovol: use ffs from opr instead of inline
Benjamin Kaduk [Wed, 14 Jan 2015 20:32:47 +0000]
vol: use ffs from opr instead of inline

volume.c defined its own ffs() macro if AFS_HAVE_FFS was not
defined.  Now that ffs() is in opr, just use it from there always.

Change-Id: Ia80a439924541be236b3221b9480143b511c885a
Reviewed-on: http://gerrit.openafs.org/11674
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoRemove Linux 2.4 compat from RedHat packaging
Benjamin Kaduk [Mon, 13 Apr 2015 16:05:12 +0000]
Remove Linux 2.4 compat from RedHat packaging

You can't package what you can't build.

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

9 years agoRemove linux24 conditionals from mcas/Makefile.osi
Benjamin Kaduk [Wed, 18 Mar 2015 17:36:26 +0000]
Remove linux24 conditionals from mcas/Makefile.osi

Linux 2.4 has been desupported by OpenAFS.

Change-Id: I7803d718ca9d2760a799f1ac2c438f8e6df8b9b9
Reviewed-on: http://gerrit.openafs.org/11806
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Daria Brashear <shadow@your-file-system.com>

9 years agoRemove stale MakefileProto.LINUX.in conditionals
Benjamin Kaduk [Wed, 18 Mar 2015 17:34:49 +0000]
Remove stale MakefileProto.LINUX.in conditionals

Linux 2.4 and older are no longer supported; there's no need to
keep the noise in this file.

Change-Id: Ia1a968e0cdc1180e66bdedd0aa0638eadfd897fb
Reviewed-on: http://gerrit.openafs.org/11805
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Daria Brashear <shadow@your-file-system.com>

9 years agoRemove LINUX24 from src/rx
Benjamin Kaduk [Wed, 18 Mar 2015 17:23:43 +0000]
Remove LINUX24 from src/rx

These files are no longer used.

Change-Id: Iebf85590e18c2542663ebdd279b126a3ab058213
Reviewed-on: http://gerrit.openafs.org/11803
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Daria Brashear <shadow@your-file-system.com>

9 years agoRemove LINUX24 from src/afs
Benjamin Kaduk [Wed, 18 Mar 2015 17:23:16 +0000]
Remove LINUX24 from src/afs

These files are no longer used.

Change-Id: I4a7e0cc8c308399004c999b3769c77388794cfdd
Reviewed-on: http://gerrit.openafs.org/11802
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Daria Brashear <shadow@your-file-system.com>

9 years agoRemove linux22 and linux24 param files
Benjamin Kaduk [Wed, 18 Mar 2015 17:20:07 +0000]
Remove linux22 and linux24 param files

They are no longer used.

Change-Id: I1337bf0e1239336e7ae39f88f484cb8237002302
Reviewed-on: http://gerrit.openafs.org/11801
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Daria Brashear <shadow@your-file-system.com>

9 years agoRemove osconf conditionals for linux24
Benjamin Kaduk [Wed, 18 Mar 2015 17:17:59 +0000]
Remove osconf conditionals for linux24

They are no longer triggerable now that linux 2.4 is desupported,
so make the code easier to read.

Change-Id: I77b48d30db66b635cfdc06e977f9884dd2825713
Reviewed-on: http://gerrit.openafs.org/11800
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Daria Brashear <shadow@your-file-system.com>

9 years agoMark Linux 2.4 as unsupported
Benjamin Kaduk [Wed, 18 Mar 2015 17:11:44 +0000]
Mark Linux 2.4 as unsupported

The Linux 2.4 series (and older) will not be supported platforms
for OpenAFS 1.8 and later.  Detect these systems at configure time
and direct users of those systems to the OpenAFS 1.6 series of releases.

These systems are believed to not be in common use with OpenAFS,
and retaining support for the LinuxThreads threading implementation
they require presents a maintenance burden that the project is
not equipped to deliver.  The project will be able to move forward
more quickly by desupporting these systems.

Code conditional on these old systems can be removed in subsequent
commits.

Change-Id: I679fc2390b35851f3b0457a846047c812bc03dba
Reviewed-on: http://gerrit.openafs.org/11799
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Daria Brashear <shadow@your-file-system.com>

9 years agoaklog: swap order of roken and hcrypto
Ben Kaduk [Thu, 12 Feb 2015 21:01:28 +0000]
aklog: swap order of roken and hcrypto

hcrypto depends on roken, so roken must come after it.

Change-Id: Ic63de1f9095555a6c3e83f2f6d2f9d024ad00006
Reviewed-on: http://gerrit.openafs.org/11743
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agovos: remaddrs sub-command
Michael Meffie [Mon, 17 Nov 2014 16:23:38 +0000]
vos: remaddrs sub-command

Introduce the vos remaddrs sub-command for removing multi-homed server
entries from the vldb.  The remaddrs sub-command completes the listaddrs
and setaddrs command suite and allows vos changeaddr to be deprecated
completely.

Change-Id: I98e92e776a153591a617a5b04037c3b6139d4732
Reviewed-on: http://gerrit.openafs.org/11606
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoDo not redeclare mutexes for darwin
Benjamin Kaduk [Wed, 18 Mar 2015 14:35:33 +0000]
Do not redeclare mutexes for darwin

Partially revert commit e2e93aa8920c0b1bfc672a555a59eb4e15dbeaae,
which added local declarations for des_init_mutex, des_random_mutex,
and rxkad_random_mutex to a number of files in libadmin, apparently
to fix the build on macos 10.3.  That OS is long EoL-ed, and
more recent versions of OS X include toolchains that do not
need these extra declarations.  In particular, the extra declarations
can be harmful when these files start to pull in more symbols
from our libraries (e.g., libafscp), since the details of the
linking process can cause that to generate duplicate symbol errors.

There is no longer any need to have local declarations of these
symbols for OS X, so just remove them.

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

9 years agoaklog: Correct size used for strlcpy()
Nathan Dobson [Fri, 20 Mar 2015 22:32:22 +0000]
aklog: Correct size used for strlcpy()

When copying into the 'cell' array, use the size of cell, not
the size of some other array that is copied into a few lines previously.

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

9 years agopioctl.c: restore required result variable
Mark Vitale [Mon, 9 Feb 2015 23:16:16 +0000]
pioctl.c: restore required result variable

Commit b9fb9c62a6779aa997259ddf2a83a90b08e04d5f refactored lpioctl()
so that LINUX would have its own implementation. This also simplified
the other lpioctl() implementations by removing superfluous variable
'rval'.

Unfortunately, 'rval' was actually required for both DARWIN and SUN511.
On both of these platforms, the address of 'errcode' is passed
to the respective ioctl_*() routine so its value may be passed back
to lpioctl().   Therefore, 'errcode' must not also be used for the
return value from these functions;  doing so results in the return
value from the function overwriting the intended value of 'errcode' upon
return to lpioctl().

In the case of Solaris 11, ioctl_sun_afs_syscall() always returns zero
(as long as the ioctl device 'dev/afs' opened successfully).
So 'errcode' was always being set to zero, even if the pioctl had
actually failed.  For example, without this fix, 'fs listcells'
loops forever on Solaris 11, listing an infinite number of "cells",
because it will never "see" the EDOM that informs it of the last defined
cell.

Partially revert b9fb9c62a6779aa997259ddf2a83a90b08e04d5f by restoring
the 'rval' variable and logic for DARWIN and SUN511.

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

9 years agobos, pts: emit error messages on stderr
Christof Hanke [Thu, 5 Feb 2015 11:07:50 +0000]
bos, pts: emit error messages on stderr

as one expects.

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

9 years agoNamespace-clean some more heimdal symbols
Ben Kaduk [Thu, 12 Feb 2015 00:02:00 +0000]
Namespace-clean some more heimdal symbols

We get linker conflicts if we try to statically link against the
system libkrb5 when it is heimdal, from both hcrypto and rfc3961.

While here, add an include guard to hcrypto's config.h.

Change-Id: Ib5fcd9291b295415325a4ed230bd35d496961367
Reviewed-on: http://gerrit.openafs.org/11740
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 agoFix incorrect uses of abs()
Ben Kaduk [Fri, 13 Feb 2015 14:47:20 +0000]
Fix incorrect uses of abs()

abs(3) is a function of one variable of type int returning int.
labs(3) is a function of one variable of type long returning long.

labs(3) should be used when the input is of type long, as in
kaprocs.c.

Calling anything from the abs(3) family on a variable of unsigned
type is a bogus type pun, and a logical operation which is a no-op.
(Unsigned values are never negative and thus the absolute value
function is the identity over the entire range of values representable
in an unsigned type.)  Just remove the use of abs() for unsigned
values, as in kaprocs.c, krb_udp.c, and vldb_check.c

While in kaprocs.c, wrap a long line that was touched for the
conversion to labs(3), spell the argument to time(3) as NULL
instead of 0, remove unneeded parentheses, and correct the spelling
of "reserved".

Change-Id: I0897b250fd885a1230d1622015eec9afe3450b46
Reviewed-on: http://gerrit.openafs.org/11745
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoRemove spurious NULL checks
Ben Kaduk [Wed, 11 Feb 2015 22:47:10 +0000]
Remove spurious NULL checks

clang 3.5 is more aggressive about these checks than the previous
FreeBSD system compiler, so new warnings (which became errors)
appeared on FreeBSD 11-CURRENT.

In afs_dcache.c, checking &tdc->f for NULL-ness has no effect.
The struct fcache f member of struct dcache is an ordinary structure
element; its address will be the value of tdc plus the offset of
f within struct dcache, which will not be NULL even if tdc is NULL.

In ubik_db_if.c, udbHandle is a file-scope global and thus has
allocated storage; the address of a member variable will never
be NULL.  The 0 it was compared against was spelled RX_SECIDX_NULL,
which shows the intended check, which is for the value of the
uh_scIndex member variable, not its address.

In afscp_server.c, srv->conns can never be NULL since conns is a member
variable of struct afscp_server (of array type, containing pointers
to struct rx_connection).  Comparing the array member variable against
NULL is comparing the address of the array, which is never NULL since
it is not allocated separately from struct afscp_server.

In fssync-debug.c, state.vop->partName is never NULL because
common_volop_prolog always allocates for state.vop, and the
partName member variable of struct fssync_state is of array type,
and thus is not separately allocated from the containing structure.

Change-Id: I03e1332d8a3320f1a4d303b444985648a207116e
Reviewed-on: http://gerrit.openafs.org/11739
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoUpdate CellServDB to 20150119 snapshot
Stephan Wiesand [Thu, 26 Feb 2015 09:13:50 +0000]
Update CellServDB to 20150119 snapshot

Update all remaining copies of CellServDB in the tree, and make the
Red Hat packaging use it by default too.

Change-Id: Id915a82b1364ef6e301921e4d3873c7203aef91c
Reviewed-on: http://gerrit.openafs.org/11764
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agovlserver: do not perform ChangeAddr on mh entries, except for removal
Michael Meffie [Tue, 16 Dec 2014 21:13:01 +0000]
vlserver: do not perform ChangeAddr on mh entries, except for removal

Fix a long standing bug in the ChangeAddr RPC which damages the vldb,

When vos changeaddr is run with -oldaddr and -newaddr, and the -oldaddr
is present in an multi-homed entry, instead of changing the address in
the mh entry, the server slot is "downgraded" to a single homed entry
and the mh entry is orphaned in the vldb.

Instead, if the -oldaddr is in a multi-home entry, refuse to change the
address with a VL entry not found error and log the event.

Multi-homed addresses can be changed manually using the vos setaddrs
command which calls the RegisterAddrs() RPC.

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

9 years agoubik: DISK_UpdateInterfaceAddr == server restart
Jeffrey Altman [Wed, 11 Feb 2015 06:25:04 +0000]
ubik: DISK_UpdateInterfaceAddr == server restart

If a DISK_UpdateInterfaceAddr RPC is received the server that sent
it restarted.  Force the urecovery code to verify the server state.

Change-Id: I465863dc3a52d844b56d576bd55229435556cfd6
Reviewed-on: http://gerrit.openafs.org/11738
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Hutzelman <jhutz@cmu.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoubik: SDISK_Begin no quorum, wrong db, no transaction
Jeffrey Altman [Thu, 22 Jan 2015 06:14:28 +0000]
ubik: SDISK_Begin no quorum, wrong db, no transaction

When processing an DISK_Begin RPC verify that there is an active quorum
and that the local database is current.  Otherwise, fail the RPC with
a UNOQUORUM error.

The returned error must be UNOQUORUM instead of USYNC becase the returned
error code will be returned by the coordinator's ContactQuorum_iterate()
to the client that triggered the write transaction.  Most ubik clients
will only retry if the error is UNOQUORUM.

FIXES 131997

Change-Id: Icaa30e6aca82e7e7d33e9171a4f023970aba61df
Reviewed-on: http://gerrit.openafs.org/11689
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Hutzelman <jhutz@cmu.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoLinux 4: struct address_space no longer has backing_dev_info
Anders Kaseorg [Mon, 23 Feb 2015 05:13:05 +0000]
Linux 4: struct address_space no longer has backing_dev_info

The backing_dev_info is only stored in the super_block now.

Change-Id: I57e147100bd47a8d1f5e97224ceb3322ea102a48
Reviewed-on: http://gerrit.openafs.org/11756
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoTreat Linux 4 (and greater) as Linux 2.6/3
Anders Kaseorg [Mon, 23 Feb 2015 04:43:49 +0000]
Treat Linux 4 (and greater) as Linux 2.6/3

In an age where Linux version numbers are determined by Google+ polls,
it’s clear that they aren’t going to be very useful for marking major
API compatibility boundaries like they were in the days of 2.2/2.4.

Change-Id: I56e0e88eb178573c3eb280d5a5a01d8b8a20a363
Reviewed-on: http://gerrit.openafs.org/11755
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoDocument --enable-linux-d_splice_alias-extra-iput
Stephan Wiesand [Tue, 17 Feb 2015 14:34:33 +0000]
Document --enable-linux-d_splice_alias-extra-iput

Even though we hope no one will actually ever need to use it, explain
this configure switch in the same place as the others.

Change-Id: Ib59f963b9000c3e66dc84c7b18eb220f0e108bd5
Reviewed-on: http://gerrit.openafs.org/11749
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: Daria Brashear <shadow@your-file-system.com>

9 years agovos: preserve cloneId and backupId when restoring
Michael Meffie [Mon, 29 Sep 2014 16:14:24 +0000]
vos: preserve cloneId and backupId when restoring

Preserve the volume clone and backup ids in the volume header when
restoring over an existing volume, instead of always setting the clone
and backup ids to zero.

For example, before this change, restoring over a volume resets the
ROnly and Backup ids reported in the volume header section of vos
examine.

    $ vos examine xyzzy
    xyzzy                          536871023 RW          3 K  On-line
        myhost /vicepa
        RWrite  536871023 ROnly  536871024 Backup  536871025
     ...
     RWrite: 536871023     ROnly: 536871024     Backup: 536871025
        number of sites -> 2
           server myhost partition /vicepa RW Site
           server myhost partition /vicepa RO Site

    $ cat /tmp/xyzzy.dump | vos restore myhost a xyzzy -overwrite incremental
    Restoring volume xyzzy Id 536871023 on server myhost partition /vicepa .. done
    Restored volume xyzzy on myhost /vicepa

    $ vos examine xyzzy
    xyzzy                          536871023 RW          3 K  On-line
        myhost /vicepa
        RWrite  536871023 ROnly          0 Backup          0
     ...
     RWrite: 536871023     ROnly: 536871024     Backup: 536871025
        number of sites -> 2
           server myhost partition /vicepa RW Site
           server myhost partition /vicepa RO Site

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

9 years agoHandle backupDate of zero
Benjamin Kaduk [Wed, 10 Dec 2014 19:07:14 +0000]
Handle backupDate of zero

In older versions of OpenAFS (prior to 2001), the backupDate was
never set.  Try to provide somewhat more reasonable behavior in
this case, by using a different date in that case.

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

9 years agolibafscp: Remove comment with dead code
Andrew Deason [Thu, 30 Jan 2014 19:38:01 +0000]
libafscp: Remove comment with dead code

You're not supposed to write the length of the submitted data on the
split rx stream for a StoreData operation; the fileserver knows how
much data to read from the "Length" parameter of the StoreData RPC.

For a FetchData, putting the data length over the split rx stream is
required, since we can't get the "OUT" arguments before reading the
file data. But for a StoreData, this is unnecessary, since the length
is right there in the arguments.

So just get rid of this commented-out code; it's clearly wrong and
this commit explains why.

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

9 years agorx: Set lastBusy on RX_CALL_TIMEOUT
Andrew Deason [Thu, 30 Jan 2014 06:02:24 +0000]
rx: Set lastBusy on RX_CALL_TIMEOUT

Currently, if a server RPC hangs forever, the client call will error
out with RX_CALL_TIMEOUT (if idle/dead timeouts are configured). If we
later try to make a new call on that conn, the server will respond
with BUSY packets, and we'll have to wait until we RX_CALL_TIMEOUT
again. After that we'll set lastBusy and avoid the call channel, but
that extra delay with the BUSY packets is avoidable.

So, avoid this extra delay by setting lastBusy when we kill a call
with RX_CALL_TIMEOUT, so a future rx_NewCall will avoid the call
channel. It makes sense to set lastBusy here, since the call channel
is more likely to be busy than the other call channels.

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

9 years agorx: Remove RX_CALL_BUSY
Andrew Deason [Thu, 30 Jan 2014 06:40:57 +0000]
rx: Remove RX_CALL_BUSY

Commit 23d6287f7f494383891a497038e8c0e870e824bf introduced the
behavior where a client can immediately retry a call if it receives a
"busy" packet from the server (meaning, the call channel is already in
use). This happened via Rx returning the error code RX_CALL_BUSY, and
the caller was supposed to immediately retry the call, so Rx could
reissue the RPC on a different call channel.

However, this behavior makes it more likely for the server to process
an RPC that the client thinks has not been processed. Say the client
issues an RPC, the server replies with a "busy" packet, and the client
resends the original packet before it sees the "busy" packet. In
this case, the server will get the resent packet for the RPC request
and process it, but the client will think the call has failed (and
presumably will retry the call on a new channel). For calls that are
non-idempotent (e.g. MakeDir), this can result in incorrect errors
(e.g. EEXIST) as well as incorrect cache state in the client.

There may be some ways to mitigate at least some of the problems here,
but this kind of "instant" retry behavior is often not really that
helpful. Calls that take a very long time to run on the server are
very rare (and usually indicate some other problem), while the
occasional short-lived "busy" packet is relatively common (sometimes
the server just hasn't cleaned up the call by the time we issue a new
call). So just get rid of the retrying behavior to ensure we don't
continue to encounter any problems like this.

To get rid of this behavior, we remove the RX_CALL_BUSY code, and all
code dealing with processing it. This means removing the RX_CALL_BUSY
handling from the client, as well as removing
rx_SetBusyChannelError(). This effectively reverts most of
23d6287f7f494383891a497038e8c0e870e824bf, and a few other commits
related to RX_CALL_BUSY.

With this change, if all we get from the server are BUSY packets when
we try to issue an RPC, the call will eventually error out with
RX_CALL_TIMEOUT (or hang forever, if no timeouts are configured). This
can be thought of intuitively as similar to "idle dead" behavior,
since we are just waiting for the server to proceed with processing
the call. So, if "idle dead" is configured, we still timeout after the
"idle dead" timeout. And if no idle or hard dead timeout is
configured, we will hang forever; just like if the server started
processing the call but then hangs forever.

Note that not all of 23d6287f7f494383891a497038e8c0e870e824bf is
reverted. Namely, the logic to have rx_NewCall try to pick the "least
busy" channel is retained.

Thanks to Simon Wilkinson for bringing up and discussing this issue in
this thread:
<http://thread.gmane.org/gmane.comp.file-systems.openafs.devel/10931>
<https://lists.openafs.org/pipermail/openafs-devel/2013-April/019297.html>

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

9 years agorx: Remove RX_CALL_IDLE
Andrew Deason [Thu, 30 Jan 2014 06:39:39 +0000]
rx: Remove RX_CALL_IDLE

After change Ie0497d24f1bf4ad7d30ab59061f96c3298f47d17, RX_CALL_IDLE
is not generated by Rx anymore; "idle dead" timeouts just cause
RX_CALL_TIMEOUT errors. Any code dealing with it is thus now dead code
(this value was deliberately never sent over the wire), so remove the
dead code.

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

9 years agorx: Remove idleDeadDetection
Andrew Deason [Thu, 30 Jan 2014 06:36:22 +0000]
rx: Remove idleDeadDetection

After change Ie0497d24f1bf4ad7d30ab59061f96c3298f47d17,
testing for idleDeadDetection is equivalent to testing if idleDeadTime
is non-zero. The idleDeadDetection field is thus redundant, so remove
it.

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

9 years agorx: Rely on remote startWait idleness for idleDead
Andrew Deason [Mon, 27 Jan 2014 06:36:14 +0000]
rx: Rely on remote startWait idleness for idleDead

This commit removes the functionality introduced in
c26dc0e6aaefedc55ed5c35a5744b5c01ba39ea1 (which is also modified by a
few later commits), as well as
05f3a0d1e0359f604cc6162708f3f381eabcd1d7. Instead we modify the
startWait check in rxi_CheckCall to apply to both "reading" and
"writing" to enforce "idle dead" timeouts.

Why do this? First, let's start out with the following:

If an Rx call gets permanently "stuck", what happens? What should
happen?

Here, "stuck" means that either the server or client hangs while
processing the call. The server or client is waiting for something to
complete before it issues the next rx_Read() or rx_Write() call. In
various situations over the years, this has happened because the
server or client is waiting for a lock, waiting for local disk I/O to
complete, or waiting for some other arbitrary event to occur.

Currently, what happens with such a "hanging" call is a little
complex, and has several different results in different situations.
The behavior of a call in this "stuck" situation is handled by the
"idle dead" timeout of an Rx call/connection. This timeout is enforced
in rxi_CheckCall, in two different conditionals (if an "idle dead"
timeout is configured):

    if (call->startWait && ((call->startWait + idleDeadTime) < now) &&
        (call->flags & RX_CALL_READER_WAIT)) {
        if (call->state == RX_STATE_ACTIVE) {
            cerror = RX_CALL_TIMEOUT;
            goto mtuout;
        }
    }

and

    if (call->lastSendData && ((call->lastSendData + idleDeadTime) < now)) {
        if (call->state == RX_STATE_ACTIVE) {
            cerror = conn->service ? conn->service->idleDeadErr : RX_CALL_IDLE;
            idle_timeout = 1;
            goto mtuout;
        }
    }

The first of these handles the case where we are waiting to rx_Read()
from a call for too long (the other side of the call needs to give us
more data). The second handles the case where we are waiting to
rx_Write() for too long (the other side of the call needs to read some
of the data we sent previously).

This second case was added by commit
c26dc0e6aaefedc55ed5c35a5744b5c01ba39ea1, but it has the general
problem that this check does not check if anyone is actually trying to
write to the call, and just tries to keep track of the last time we
wrote to the call. So, we may have written some data to the call
successfully, and then we went off to do something else. We can then
kill the call later for taking too long to write to, even though
nobody is trying to write to it. This results in a few problems:

 (1) When the fileserver is writing to the client, it may need to wait
     for various locks and it may need to wait for local disk I/O to
     complete. If this takes too long for any reason, the fileserver
     will kill the call (currently with VNOSERVICE), but the thread
     for servicing the call will still keep running until whatever the
     fileserver was waiting for finishes.

 (2) lastSendData is set whenever we send any ACK besides an
     RX_ACK_PING_RESPONSE (as of commit
     658d2f47281306dfd46c5eddcecaeadc3e3e7fa9). If we are the server,
     and we send any such ACK (in particular, RX_ACK_REQUESTED is
     common), the "idle dead" timer starts. This means the server can
     easily kill a call for idleness even if the server has never sent
     the client anything, and even if the server is still actively
     reading from the client.

 (3) When a client tries to issue an RPC for the server, the "idle
     dead" timeout effectively becomes a hard dead timeout, since we
     will write the RPC arguments to the Rx stream, and then wait for
     the server to respond with the output arguments. During this
     time, our 'lastSendData' is the last time we sent our arguments
     to the server, and so the call must finish before
     'call->lastSendData + idleDeadTime' is in the past.

In addition to this "idle dead" processing, commit
05f3a0d1e0359f604cc6162708f3f381eabcd1d7 appears to attempt to provide
"idle dead"-like behavior by disabling Rx keepalives at certain points
(when we're waiting for disk I/O), controlled by the application
process (currently only the fileserver). The idea is that if
keepalives are disabled, the server will just appear unreachable to
the client, and so if disk I/O takes too long, the client will just
kill the call because it looks like the server is gone. However, this
also has some problems:

 (A) Clients send their own keepalives, and the server will still
     respond to them. So, the server will not appear to be
     inaccessible anyway. But even if it did work:

 (B) This approach only accounts for delays in disk I/O, and not
     anywhere else (we could hang for a wide variety of reasons). It
     also requires the fileserver to decide when it's okay for a call
     to be killed due to "idle dead" and when it's not, which
     currently seems to be decided somewhat arbitrarily.

 (C) This doesn't really let the client dictate its own "idle dead"
     timeout for idleness specifically; it just looks like the server
     went away.

 (D) The fileserver would appear to be unreachable in this situation,
     but it's not actually unreachable. This can be confusing to
     clients, since distinguishing between a server that is completely
     down vs just taking too long is an important distinction.

 (E) As noted in (1) above, the fileserver thread will still keep
     waiting for whatever it has been waiting for, even though the
     call has been killed and is thus useless.

So instead of all of this stuff, just modify the rxi_CheckCall "idle
dead" check to depend on the call->startWait parameter instead. This
parameter will be set whenever anyone is waiting for something to
proceed in the call, whether that is waiting to read data or write
data. This should make "idle dead" processing much simpler, as it is
reduced to effectively: if we've been waiting for longer than N
seconds, kill the call.

This involves ripping out much of the code related to lastSendData and
rx_KeepAlive*. This means removing the call->lastSendData field and
the rx_SetServerIdleDeadErr function, since those were only used for
the behavior in c26dc0e6aaefedc55ed5c35a5744b5c01ba39ea1. This also
means removing rx_KeepAliveOn and rx_KeepAliveOff, since those were
only used for the behavior in
05f3a0d1e0359f604cc6162708f3f381eabcd1d7. This commit also removes the
only known use of the VNOSERVICE error code, so add some comments
saying what this code was used for (especially since it is quite
different from other V* error codes).

Note that the behavior in (1) could actually be desirable in some
situations. In environments that have clients without "idle dead"
functionality, and those clients cannot be upgraded or reconfigured,
this commit means those clients may hang forever if the server hangs
forever. Some sites may want the fileserver to be able to kill such
hanging calls, so the client will not hang (even if it doesn't free up
the fileserver thread). However, such behavior should really be a
special case for such sites, and not be the default behavior (or only
behavior) for all sites. The fileserver should just be concerned with
maintaining its own threads and availability, and clients should
manage their own timeouts and handle hanging servers.

Thanks to Markus Koeberl, who originally brought attention to some of
the problematic behavior here, and helped investigate what was going
on in the fileserver.

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

9 years agoWindows: Fake status info on EACCES
Jeffrey Altman [Tue, 10 Feb 2015 07:36:03 +0000]
Windows: Fake status info on EACCES

When enumerating a directory if status info for an entry cannot be
obtained, fake it.  Do not return STATUS_ACCESS_DENIED to the redirector
as that will be interpreted as the directory not being listable.

Change-Id: I488f5d8d244c363135e00e156a685cd56fd060c8
Reviewed-on: http://gerrit.openafs.org/11736
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: foo.backup -> foo.backup too many symlinks
Jeffrey Altman [Fri, 23 Jan 2015 00:48:32 +0000]
Windows: foo.backup -> foo.backup too many symlinks

In the case where an explicit mount point to a .backup volume is
resolved from a .backup volume the cache manager refuses to evaluate
the mount point target.  This is meant to address unwanted recursion
in the directory tree searches.

Change the error code to ERROR_TOO_MANY_SYMLINKS and propagate that
error to the AFS redirector.  That will result in the application
receiving STATUS_ACCESS_DENIED instead of
STATUS_REPARSE_POINT_NOT_RESOLVED.

The STATUS_REPARSE_POINT_NOT_RESOLVED error causes cmd.exe and
powershell.exe to terminate recursive directory searches.

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

9 years agoIgnore return values harder
Jeffrey Hutzelman [Sun, 16 Jun 2013 20:28:22 +0000]
Ignore return values harder

In various places where we intentionally ignore the return values of system
calls and standard library routines, this changes the way in which we do so,
to avoid compiler warnings when building on Ubuntu 12.10, with gcc 4.7.2 and
eglibc 2.15-0ubuntu20.1.

Change-Id: I41f806a686d68b02aec2847886bd5d787cbff3d3
Reviewed-on: http://gerrit.openafs.org/9980
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agorx: Zero unitialized uio structs
Andrew Deason [Wed, 4 Feb 2015 16:25:38 +0000]
rx: Zero unitialized uio structs

We use some uio structures that were allocated on the stack, but we
only initialize them by initializing individual fields. On some
platforms (Solaris is one known example, but probably not the only
one), there are additional fields we do not initialize. Since we
cannot be certain of what any additional fields there may be, just
zero the whole thing.

This is basically the same change as
I0eae0b49a70aee19f3a9ec118b03cfb3a6bd03a3, but in the rx subtree.

Change-Id: I400144143bb1f47409eccb931daacc8a5058e074
Reviewed-on: http://gerrit.openafs.org/11711
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>

9 years agoDeorbit AIX-specific QuickStartGuide bits
Benjamin Kaduk [Wed, 5 Nov 2014 19:26:36 +0000]
Deorbit AIX-specific QuickStartGuide bits

Although there are still servers deployed on AIX systems,
there may not be any clients in use, and it is unlikely that
there will be new deployments which require this documentation.

Change-Id: Id6554e120cb01c5d4de5c7de67e74e802b7ea217
Reviewed-on: http://gerrit.openafs.org/11592
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoDeorbit HP-UX-specific QuickStartGuide bits
Benjamin Kaduk [Wed, 5 Nov 2014 19:26:36 +0000]
Deorbit HP-UX-specific QuickStartGuide bits

Get the rest of them all at once.

Change-Id: Idb33746d43a4a1a9f41e21d7f6d81360ecdd952e
Reviewed-on: http://gerrit.openafs.org/11591
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoLINUX: ensure mvid is set on root vnodes
Daria Brashear [Wed, 14 Jan 2015 15:22:25 +0000]
LINUX: ensure mvid is set on root vnodes

it shoudn't happen that we aren't setting mvid on root vnodes,
so assert so we notice if the invariant is violated

Change-Id: I32c8aa4dced8751d11817d74508b87ff44261837
Reviewed-on: http://gerrit.openafs.org/11669
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoafs: refactor afs_linux_dentry_revalidate
Jeffrey Altman [Fri, 23 Jan 2015 00:36:59 +0000]
afs: refactor afs_linux_dentry_revalidate

No functional change.   Separate the

  if (locked && vcp->mvstat == 1) { ... }

conditional into

  if (locked) {
    if (vcp->mvstat == 1) { ... }
  }

in preparation for another change.

Change-Id: I1fe42ed7771882ce365d9359a4e6187c283592a8
Reviewed-on: http://gerrit.openafs.org/11692
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agobozo: do not exit when the client config already exists
Michael Meffie [Wed, 21 Jan 2015 19:58:35 +0000]
bozo: do not exit when the client config already exists

The bosserver creates symlinks for the client CSDB and ThisCell config
files during initialization.  Avoid exiting if the client CSDB or
ThisCell configuration already exists, otherwise the bosserver cannot be
restarted with bos restart.

This fixes an error introduced with commit
720363fa9bf7cfbebdc485104b74ca6bac1895f6, Fix unchecked return values.

Change-Id: Ie6ecf126d1ed663f161c26da2a8c4d568369d99d
Reviewed-on: http://gerrit.openafs.org/11684
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agodoc: backup manpage fix
Perry Ruiter [Tue, 20 Jan 2015 03:35:41 +0000]
doc: backup manpage fix

While reviewing gerrit 11678 I noticed the -n flag was
duplicated.  Remove the duplicate flag.

Change-Id: I4a63a50199e1564a0b0394445e9dc1569bb08a0c
Reviewed-on: http://gerrit.openafs.org/11688
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoafs: Zero uninitialized uio structs
Andrew Deason [Fri, 30 Jan 2015 19:29:57 +0000]
afs: Zero uninitialized uio structs

In several places in the code, we allocate a 'struct uio' on the
stack, or allocate one from non-zeroed memory. In most of these
places, we initialize the structure by assigning individual fields to
certain values. However, this leaves any remaining fields assigned to
random garbage, if there are any additional fields in the struct uio
that we don't know about.

One such platform is Solaris, which has a field called uio_extflg,
which exists in Solaris 11, Solaris 10, and possibly further back.
One of the flags defined for this field in Solaris 11 is UIO_XUIO,
which indicates that the structure is actually an xuio_t, which is
larger than a normal uio_t and contains additional fields. So when we
allocate a uio on the stack without initializing it, it can randomly
appear to be an xuio_t, depending on what garbage was on the stack at
the time. An xuio_t is a kind of extensible structure, which is used
for things like async I/O or DMA, that kind of thing.

One of the places we make use of such a uio_t is in afs_ustrategy,
which we go through for cache reads and writes on most Unix platforms
(but not Linux). When handling a read (reading from the disk cache
into a mapped page), a copy of our stack-allocated uio eventually gets
passed to VOP_READ. So VOP_READ for the cache filesystem will randomly
interpret our uio_t as an xuio_t.

In many scenarios, this (amazingly) does not cause any problems, since
generally, Solaris code will not notice if something is flagged as an
xuio_t, unless it is specifically written to handle specific xuio_t
types. ZFS is one of the apparent few filesystem implementations that
can handle xuio_t's, and will detect and specially handle a
UIOTYPE_ZEROCOPY xuio_t differently than a regular uio_t.

If ZFS gets a UIOTYPE_ZEROCOPY xuio_t, it appears to ignore the uio
buffers passed in, and supplies its own buffers from its cache. This
means that our VOP_READ request will return success, and act like it
serviced the read just fine. However, the actual buffer that we passed
in will remain untouched, and so we will return the page to the VFS
filled with garbage data.

The way this typically manifests is that seemingly random pages will
contain random data. This seems to happen very rarely, though it may
not always be obvious what is going on when this occurs.

It is also worth noting that the above description on Solaris only
happens with Solaris 11 and newer, and only with a ZFS disk cache.
Anything older than Solaris 11 does not have the xuio_t framework
(though other uio_extflg values can cause performance degradations),
and all known non-ZFS local disk filesystems do not interpret special
xuio_t structures (networked filesystems might have xuio_t handling,
but they shouldn't be used for a cache).

Bugs similar to this may also exist on other Unix clients, but at
least this specific scenario should not occur on Linux (since we don't
use afs_ustrategy), and newer Darwin (since we get a uio allocated for
us).

To fix this, zero out the entire uio structure before we use it, for
all instances where we allocate a uio from the stack or from
non-zeroed memory. Also zero out the accompanying iovec in many
places, just to be safe. Some of these may not actually need to be
zeroed (since we do actually initialize the whole thing, or a platform
doesn't have any additional unknown uio fields), but it seems
worthwhile to err on the side of caution.

Thanks to Oracle for their assistance on this issue, and thanks to the
organization experiencing this issue for their patience and
persistence.

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

9 years agoSOLARIS: Avoid uninitialized caller_context_t
Andrew Deason [Fri, 30 Jan 2015 19:08:19 +0000]
SOLARIS: Avoid uninitialized caller_context_t

Currently we pass a caller_context_t* to some of Solaris' VFS
functions (VOP_SETATTR, VOP_READ, VOP_WRITE, VOP_RWLOCK,
VOP_RWUNLOCK), but the pointer we pass is to uninitialized memory.

This code was added in commit 51d76681, and this particular argument
is mentioned in
<https://lists.openafs.org/pipermail/openafs-info/2004-March/012657.html>,
where the author doesn't really know what the argument is for.

Over 10 years later, it's still not obvious what this argument does,
since I cannot find any documentation for it. However, browsing
publicly-available Illumos/OpenSolaris source suggests this is used
for things like non-blocking operations for network filesystems, and
is only interpreted by certain filesystems in certain codepaths.

In any case, it's clear that we're not supposed to be passing in an
uninitialized structure, since the struct has actual members that are
sometimes interpreted by lower levels. Other callers in
Illumos/OpenSolaris source seem to just pass NULL here if they don't
need any special behavior. So, just pass NULL.

I am not aware of any issues caused by passing in this uninitialized
struct, and browsing Illumos source and discussing the issue with
Oracle engineers suggest there would currently not be any issues with
the cache filesystems we would be using.

However, it's always possible that issues could arise from this in the
future, or there are issues we don't know about. Any such issues would
almost certainly appear to be non-deterministic and be a nightmare to
track down. So just pass NULL, to avoid the potential issues.

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

9 years agouse V_creationDate in DumpHeader for R/O volumes
Hans-Werner Paulsen [Wed, 17 Sep 2014 07:41:16 +0000]
use V_creationDate in DumpHeader for R/O volumes

This patch modifies a patch committed as 1e6fb1b7b7, the dumpTimes.to is now
set to creationDate for R/O volumes. The old value copyDate is wrong, if the
R/O volumes is re-cloned. This does not happen with "vos dump -clone", but
may happen with dumping a R/O volume directly: "vos dump <R/O volume>".

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

9 years agoOpenBSD: Clean up use of LK_CANRECURSE in call to lockmgr()
Antoine Verheijen [Wed, 28 Jan 2015 02:49:04 +0000]
OpenBSD: Clean up use of LK_CANRECURSE in call to lockmgr()

The LK_CANRECURSE and LK_RECURSEFAIL flags in the call to lockmgr()
are mutually exclusive. Previous version of OpenBSD didn't really
check well for this but more recent versions look for the conflict
and take a kernel panic when they're both set.

The OpenBSD kernel module currently just blindly sets the
LK_CANRECURSE flag in its call to lockmgr(). This patch changes
that behaviour so that it checks to make sure that the LK_RECURSEFAIL
flags is not set before it actually applies the LK_CANRECURSE flag.
That removes the kernel panics that have started to arise.

This behaviour is more consistent with other OpenBSD code that makes
use of the LK_CANRECURSE flag.

Change-Id: Ie435559f4b88195136e09c6184543861f06257da
Reviewed-on: http://gerrit.openafs.org/11699
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoOpenBSD: Remove obsolete parameter in call to osi_VM_FlushVCache()
Antoine Verheijen [Wed, 28 Jan 2015 02:44:56 +0000]
OpenBSD: Remove obsolete parameter in call to osi_VM_FlushVCache()

The second parameter in the call to osi_VM_FlushVCache() in the kernel
module is obsolete and has been removed. However, one call in the
OpenBSD module still contains that parameter in its call. This patch
removes it, eliminating the compile error.

Change-Id: Ia3f79c74e86b8038301459e1adbf17a58056e8b1
Reviewed-on: http://gerrit.openafs.org/11698
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoLinux: d_splice_alias may drop inode reference on error
Marc Dionne [Thu, 18 Dec 2014 13:43:22 +0000]
Linux: d_splice_alias may drop inode reference on error

d_splice_alias now drops the inode reference on error, so we
need to grab an extra one to make sure that the inode doesn't
go away, and release it when done if there was no error.

For kernels that may not drop the reference, provide an
additional iput() within an ifdef.  This could be hooked up
to a configure option to allow building a module for a kernel
that is known not to drop the reference on error.  That hook
is not provided here.  Affected kernels should be the early
3.17 ones (3.17 - 3.17.2); 3.16 and older kernels should not
return errors here.

[kaduk@mit.edu add configure option to control behavior, which
is mandatory on non-buildbot linux systems]

Change-Id: Id1786ac2227b4d8e0ae801fe59c15a0ecd975bed
Reviewed-on: http://gerrit.openafs.org/11643
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoIRIX: remove mention of unsupported sgiefs from Makefile.in
Chas Williams (CONTRACTOR) [Mon, 15 Dec 2014 16:04:06 +0000]
IRIX: remove mention of unsupported sgiefs from Makefile.in

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

9 years agoIRIX: Move src/sgistuff to platform/IRIX
Chas Williams (CONTRACTOR) [Mon, 15 Dec 2014 15:58:02 +0000]
IRIX: Move src/sgistuff to platform/IRIX

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