]> git.michaelhowe.org Git - packages/o/openafs.git/log
packages/o/openafs.git
13 years agoafs: Handle VNOSERVICE as a timeout
Andrew Deason [Wed, 14 Nov 2012 00:27:11 +0000 (18:27 -0600)]
afs: Handle VNOSERVICE as a timeout

For whatever reason, the fileserver uses VNOSERVICE to indicate that
an Rx call was killed due to an idledead timeout. It is not used for
any volume errors, so treat it like the idle dead error codes.

Reviewed-on: http://gerrit.openafs.org/8462
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 22da9ec896f651f066317a85268620a7d3ac46fa)

Change-Id: I58fc7aaba65683f987387ff406bd575018b46d6b
Reviewed-on: http://gerrit.openafs.org/8550
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoafs: Slight restructuring in afs_Analyze
Andrew Deason [Wed, 14 Nov 2012 00:15:21 +0000 (18:15 -0600)]
afs: Slight restructuring in afs_Analyze

We test for acode < 0 && acode != VRESTARTING, but then immediately
test for specific values for acode. Move this conditional down, and
remove a level of indentation for the next couple of acode checks.

This commit should introduce no functional change.

Reviewed-on: http://gerrit.openafs.org/8461
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit db57dfd3798f09e77b5c49bed304cacc0c448f91)

Change-Id: Idd836a5acba775c82f360ea1082ba50cc32914af
Reviewed-on: http://gerrit.openafs.org/8549
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: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
13 years agoLINUX: Always hold afs_xuser for unixuser read
Andrew Deason [Tue, 31 Jul 2012 18:40:41 +0000 (14:40 -0400)]
LINUX: Always hold afs_xuser for unixuser read

We were failing to hold the afs_xuser lock when we entered our
unixuser traversal for the first time (when the given position is 0).
This means we can release the lock without acquiring it, causing all
kinds of weird behavior.

Just always grab afs_xuser on entry. We could possibly do some tricks
to avoid grabbing this lock until after we've printed the column
headers, but it does not seem worth it.

Reviewed-on: http://gerrit.openafs.org/7916
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 351d3b8a19314027b30cdc499ef48c95ba7903b6)

Change-Id: I75e137e588fcbf973a5d564db3a077c4ec4f50e1
Reviewed-on: http://gerrit.openafs.org/8547
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
13 years agoptserver: Avoid inet_ntoa
Andrew Deason [Tue, 23 Oct 2012 20:47:06 +0000 (15:47 -0500)]
ptserver: Avoid inet_ntoa

The ptserver uses inet_ntoa in a few places, such as for calculating
host CPS. This isn't safe in pthreaded environments, so use
afs_inet_ntoa_r instead.

Reviewed-on: http://gerrit.openafs.org/8287
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 527f2ba00c1247ae7e8d6f355572c8635331bc0c)

Change-Id: I3740a294bd93b000842ccd791f2a11cef5092a9a
Reviewed-on: http://gerrit.openafs.org/8546
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
13 years agoafs: Never use GetNewDSlot after init
Andrew Deason [Wed, 31 Oct 2012 20:55:35 +0000 (15:55 -0500)]
afs: Never use GetNewDSlot after init

Currently there are two ways to get a dcache via a slot number:
afs_GetNewDSot and afs_GetValidDSlot. afs_GetValidDSlot assumes that
the given slot number refers to a dcache entry that is valid on disk;
with afs_GetNewDSlot, the given slot may not be valid, and if it is
not, an empty 'template' dcache is returned.

afs_GetNewDSlot is useful for initializing cache files, since if a
given dcache slot exists on disk and contains valid data, we use the
dcache like normal. If it does not already exist or does not contain
valid data, we fill in the missing data after afs_GetNewDSlot returns.

However, for all other uses, afs_GetNewDSlot is incorrect, and causes
various serious problems. After we have initialized our dcache
entries, any attempt to read a dcache by slot number should succeed,
since the number of dcache entries never changes after we are started,
and we initialized all of them during client startup.

Some code outside of afs_InitCacheFile was still using
afs_GetNewDSlot; code that reads in a dslot from the free or discard
list. In these cases, if there is any error reading the dcache slot
from disk, we will be given a dcache that has some of its fields not
filled in properly. Notably, we assume that the entry is not on the
global hash table (we set tdc->f.fid.Fid.Volume to 0), and the
tdc->f.inode field is not initialized at all, leaving it set to
whatever was in memory for that tdc before we tried to read the slot
from disk.

This can cause cache corruption, since tdc->f.inode can point to the
inoder for a different existing cache file, so writing to that dcache
modifies the data for another cached file.

To avoid this, modify the non-afs_InitCacheFile callers of
afs_GetNewDSlot to avoid afs_GetNewDSlot. Since these callers read
from the free/discard list, the contents of the dcache entries are not
valid (the cell, volume, dv, etc are not valid), though they must
exist on disk (we have a valid inode number for them). So, create a
new function, afs_GetUnusedDSlot, to get a dcache that must exist on
disk, but does not represent any valid data. Use this for callers that
must get a dslot from the free/discard list.

Add some comments to try and help explain what is going on.

Reviewed-on: http://gerrit.openafs.org/8370
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 20b0c65a289e2b55fb6922c8f60e873f1f4c6f97)

Change-Id: I0ed66c155ea5574fd88c288bdf9feb98161e5c45
Reviewed-on: http://gerrit.openafs.org/8545
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
13 years agoafs: Log slot for GetDSlot read errors
Andrew Deason [Wed, 31 Oct 2012 20:02:09 +0000 (15:02 -0500)]
afs: Log slot for GetDSlot read errors

When we log that a disk read error occurred during GetDSlot, log which
slot we were trying to read for convenience.

Reviewed-on: http://gerrit.openafs.org/8368
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit b5d9e29e89c2a63c857c47f1fb9accae90b0a3aa)

Change-Id: I0d5fffd3ef3af5d788db082e10c401afc0dd440a
Reviewed-on: http://gerrit.openafs.org/8544
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
13 years agoLINUX: Dir follow_link should set LAST_BIND
Andrew Deason [Wed, 21 Nov 2012 16:39:51 +0000 (10:39 -0600)]
LINUX: Dir follow_link should set LAST_BIND

For our faux-symlink directory follow_link operation, we leave the
given nameidata struct with an invalid 'last' component. That is,
nd->last is not changed or set to anything meaningful.

Usually the callers of our follow_link op do not care about the last
component of the nameidata. However, at least one caller does: the
caller near the do_link label in open_namei(). This is called during
processing for O_CREAT operations on symlinks, and since our
directories look like symlinks, it gets called. It tries to use
nd->last to look up the last component of the dereferenced path (so it
can try to create it, as necessary), but since our nd->last is not
set, this will not work.

Specifically, our nd->last.name is not pointing into the names cache,
so the subsequent putname/__putname on it will corrupt the names
cache. However, even if this were not a problem, the actual contents
of the last component do not seem meaningful so this would probably
result in incorrect behavior anyway.

To avoid all of this, set nd->last_type to LAST_BIND, so any callers
know that the last component of the given nd is not valid, and we are
pointing directly to the target component with a dentry.

Reviewed-on: http://gerrit.openafs.org/8489
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit bd57c7d64844ca26d80f2b29db470dacd134fc56)

Change-Id: I4defb55064a4452e437b8a6c3e600887b4749fff
Reviewed-on: http://gerrit.openafs.org/8543
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
13 years agoafs: Do not skip flushing pages for dv-0 files
Andrew Deason [Thu, 15 Nov 2012 00:29:35 +0000 (18:29 -0600)]
afs: Do not skip flushing pages for dv-0 files

If the dv for a file is 0, we know the file is empty. Currently we
skip flushing pages for such files, presumably the idea being there is
no data in the file, so there should be no pages to flush.

However, Linux seems to keep empty pages around for empty files. So, a
future read can result in the application reading a page full of
zeroes, unless we flush the page here. While this has only been found
to happen on Linux 2.6.22 and later (and distribution-specific
backports, like RHEL 2.6.18-128), other platforms could in theory also
choose to do this. It would be difficult to find out when another
platform started to behave like this, so just remove this skip for
everyone so we never have to deal with this again.

Replace this code with a comment with a quick explanation, in case
anyone tries to add a similar optimization here in the future.

Thanks to Richard Brittain.

Reviewed-on: http://gerrit.openafs.org/8465
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit ad4e634051e18fa5bd07016b6405e53e236c2f45)

Change-Id: I76aed81e0d8acdbf13bc952ac8557b051d2869bf
Reviewed-on: http://gerrit.openafs.org/8484
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
13 years agoWindows: cm_LookupInternal obtain type of target
Jeffrey Altman [Tue, 27 Nov 2012 05:16:58 +0000 (00:16 -0500)]
Windows: cm_LookupInternal obtain type of target

cm_LookupInternal needs to return the target of a mount point
if the matching directory entry is a mount point.  Therefore, if
the target type is unknown the status information must be queried.

Reviewed-on: http://gerrit.openafs.org/8528
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 9ed02a628afd700a0e3c47ac92fa9c89d0827301)

Change-Id: I02d09772df1ef32800736fd798f2f5f4b2997a86
Reviewed-on: http://gerrit.openafs.org/8532
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
13 years agovol: allow non-dafs volume utils to attach with V_READONLY again
Michael Meffie [Tue, 30 Oct 2012 14:22:40 +0000 (10:22 -0400)]
vol: allow non-dafs volume utils to attach with V_READONLY again

Allow non-fileserver, non-dafs, programs to attach volumes with the
V_READONLY mode again. This was lost during the code changes for
dafs.

The caller sends a fssync request to the fileserver, which updates the
on-disk contents of the volume headers, before the caller reads the
volume headers, allowing the caller to have the most recent info about
the volume. The fileserver still has the volume in use.

Later in the attachment process, the inUse check is skipped for the case
of a non-fileserver process which is attaching the volume using the
V_READONLY mode, otherwise the attachment would incorrectly mark the
volume as needing to be salvaged.

Note: The mode checks in VMustCheckOutVolume() are correct. We must
checkout the volume when attaching with the V_READONLY mode. This
fix updates the VShouldCheckInUse(), in which an additional
exception was added to cover the case for V_READONLY mode from a non-
fileserver process.

Note: A check is added in the dafs version of attach to avoid overwriting the
inUse field when a volume utility is attaching a volume in V_READONLY mode.
Currently, V_READONLY is not used by dafs, but this was done to avoid future
errors.

Reviewed-on: http://gerrit.openafs.org/8339
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 0eaa0d1baa8b8fe115301f188ce32176acc7b065)

Change-Id: I584027e2104fd4928b16b591a2ab9e2613e49ec7
Reviewed-on: http://gerrit.openafs.org/8458
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
13 years agofix stale volume info from vos examine (non-dafs)
Michael Meffie [Tue, 30 Oct 2012 14:41:12 +0000 (10:41 -0400)]
fix stale volume info from vos examine (non-dafs)

A volume examine on a non-dafs volume server/fileserver can show old
information, including old volume update time, for up to about 20
minutes. The non-dafs volume server reads the volume information
from the volume headers, which are updated by the fileserver only
periodically to avoid excessive i/o.

Before dafs, when the volume server performed a volume examine, the
volume server would send a fssync command to the fileserver with the
request FSYNC_NEEDVOLUME and mode V_READONLY. The fileserver writes
the current memory contents to disk on this fssync command. The
volume server would then attach the volume, reading the current
volume data.

The dafs volume/fileserver avoids this extra i/o by using a new set
of fssync commands to retrieve the volume information from the
fileserver. However, the non-dafs volume server does not use the new
fssync commands and reads the volume headers from disk.

Revert the volume attachment processing for the non-dafs volume
server to request the volume with the V_READONLY mode. This causes
the fileserver to update the volume headers, allowing the volume
server to read the up to date volume header data.

Sadly, this adds another dafs ifdef to the already twisty maze of
passages that all look alike.

This changes the volserver to use the V_READONLY attachment mode
only for the case of getting a single volume, as that what was
done in 1.4.x.

Reviewed-on: http://gerrit.openafs.org/8327
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit bcb077a00fb575e7beb92739646054ea67ca0b79)

Change-Id: I5b5982efd5ee3aea13515add83b71d424dbd3a60
Reviewed-on: http://gerrit.openafs.org/8459
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
13 years agoCatch up to FreeBSD non-MPSAFE deorbit
Ben Kaduk [Wed, 7 Nov 2012 15:08:33 +0000 (10:08 -0500)]
Catch up to FreeBSD non-MPSAFE deorbit

All filesystems must have their own locking now.
We have been MPSAFE for quite some time, but the preprocessor macro
"MPSAFE" has been removed and we must catch up in order to compile.

The MNTK_MPSAFE macro has not yet been removed, but it is toothless
now, so we can preemptively stop using it.

Reviewed-on: http://gerrit.openafs.org/8366
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit f749f17fe1a2bc56a8129f5579e5cf5009f12d95)

Change-Id: I35ad1c63bf3b1c91035bcdd29d7cfcb5603dfd12
Reviewed-on: http://gerrit.openafs.org/8374
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoFBSD: coalesce three assignments to the same variable
Garrett Wollman [Fri, 12 Aug 2011 04:39:54 +0000 (00:39 -0400)]
FBSD: coalesce three assignments to the same variable

Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5233
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit e3148c6bfad25fdcb86b7248bd6b05432502d4ce)

Change-Id: I549bbeb4397d357257497179cd459f6034f93113
Reviewed-on: http://gerrit.openafs.org/8373
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agorx: fix abort on missing service
Jeffrey Altman [Fri, 20 Jul 2012 14:20:02 +0000 (10:20 -0400)]
rx: fix abort on missing service

patchset 1fbe83f9aacfc36a9c426ba1fd18ad7c72869dc1 introduced
the possibility that a NULL connection pointer could be dereferenced.
Prevent it.

Reviewed-on: http://gerrit.openafs.org/7794
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 3ec1bdf9c74bd250d49065fa84475a5123461744)

Change-Id: I1e01005a34e5d373b6810052d94fac8d96f40e4f
Reviewed-on: http://gerrit.openafs.org/8371
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoconfigure: check for poll()
Derrick Brashear [Thu, 1 Nov 2012 18:15:27 +0000 (14:15 -0400)]
configure: check for poll()

if we have code which uses HAVE_POLL, check for poll().

Reviewed-on: http://gerrit.openafs.org/8357
Reviewed-by: Chaskiel Grundman <cg2v@andrew.cmu.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 7fe30bd28e62ad0ed717c24e8eccf5e563b9cd68)

Change-Id: I99a25d20d0d98e516d72f885feef2a4d15ca01fb
Reviewed-on: http://gerrit.openafs.org/8367
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoFreeBSD major version numbers are multi-character
Ben Kaduk [Thu, 13 Sep 2012 21:28:17 +0000 (17:28 -0400)]
FreeBSD major version numbers are multi-character

Do not assume that there is only a single character before the dot.

Reviewed-on: http://gerrit.openafs.org/8106
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit c4c51444ebd35fe0ceccde23512707ae693210ee)

Change-Id: I4b9016af301c4e9393e87fa59d6fa9d19dcd9843
Reviewed-on: http://gerrit.openafs.org/8342
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoPatch up FreeBSD-10 support
Ben Kaduk [Thu, 28 Jun 2012 02:04:24 +0000 (22:04 -0400)]
Patch up FreeBSD-10 support

The auto-guessing code for sysnames produces *_fbsd_100, so we can't
just claim that we'll be *_fbsd_1000 for kicks.
Revert back to the old behavior so as to be less disruptive.

Reviewed-on: http://gerrit.openafs.org/7595
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 44ca4aa90ef101fb13b3b5327ca19381b5464fb3)

Change-Id: I302b9f36913b6cd86f65b7263c85d91745330ae6
Reviewed-on: http://gerrit.openafs.org/8341
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoCatch up on fbsd releases
Ben Kaduk [Sat, 23 Jun 2012 01:33:50 +0000 (21:33 -0400)]
Catch up on fbsd releases

Pull in the changes needed to even have a chance at supporting
FreeBSD 8.3, 8.4, 9-stable, and 10-current.
Conditionals for changed interfaces in a follow-up commit.

Reviewed-on: http://gerrit.openafs.org/7581
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 58e7d52d0066a9f237971f39e7acdde02761172a)

[Edited param.*.h files to add AFS_64BIT_ENV for 1.6.x]

Change-Id: I3218a84a024011af573d64821a2599b1330b3f71
Reviewed-on: http://gerrit.openafs.org/8340
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoLinux: Rework handling of names in the lookup functions
Marc Dionne [Sat, 20 Oct 2012 16:59:01 +0000 (17:59 +0100)]
Linux: Rework handling of names in the lookup functions

Rework the name lookup functions in the kernel to deal more cleanly
with the change of API for kernel 3.7

Reviewed-on: http://gerrit.openafs.org/8278
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit eca04c7e52d1e777cde423cdf673d7bf579c342b)

Change-Id: I967c80fac754fbee1836b84dfb50dd5fdcba35f0
Reviewed-on: http://gerrit.openafs.org/8338
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoLinux: fix afs_putname wrapper for pre-3.7 kernels
Marc Dionne [Fri, 19 Oct 2012 17:31:53 +0000 (18:31 +0100)]
Linux: fix afs_putname wrapper for pre-3.7 kernels

Make the compatibility function use the right type for pre-3.7
kernels.

Reviewed-on: http://gerrit.openafs.org/8276
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 115850076c09625e37d75da6dc29a68b0a2d638e)

Change-Id: I820340058a6cdecbd438fdc13ed3d54a439340e0
Reviewed-on: http://gerrit.openafs.org/8337
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoLinux 3.7: putname is no longer exported
Marc Dionne [Mon, 15 Oct 2012 16:26:09 +0000 (12:26 -0400)]
Linux 3.7: putname is no longer exported

putname is unexported in kernel 3.7.  Add a compatibility inline
afs_putname function and open code it if necessary.

Reviewed-on: http://gerrit.openafs.org/8237
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit fa3116567e2998af73eb116751032713850c9459)

Change-Id: Icf0e249f87bfe80a262e5599ab9958355ed9a90f
Reviewed-on: http://gerrit.openafs.org/8336
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agolibafs: Correct afs_LoopServers flags
Andrew Deason [Thu, 5 May 2011 16:37:12 +0000 (11:37 -0500)]
libafs: Correct afs_LoopServers flags

AFS_LS_DOWN was actually checking up servers, and AFS_LS_UP was
checking down servers. Fix the handling of the 'adown' flag so we do
the right thing.

1.6-only: Note that this does not contain the change to afs_FlushVCBs,
since 1.6 does not contain change cee2c677, which introduced the
relevant afs_FlushVCBs afs_LoopServers call.

Reviewed-on: http://gerrit.openafs.org/4624
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 1f48bc7a30d5df88a1e5f539ee22df3952533a88)

Change-Id: Ibf56812134800a047642455a528dae488c52bcf9
Reviewed-on: http://gerrit.openafs.org/8309
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
13 years agolibafs: Fix second pass in ShakeLooseVCaches
Marc Dionne [Fri, 12 Oct 2012 20:31:24 +0000 (16:31 -0400)]
libafs: Fix second pass in ShakeLooseVCaches

Commit 3105c7ff introduced a two phase process for reclaiming
vcache entries.  First go through the list and do what's possible
without sleeping (skipping aliased dentries on Linux), then do
a second pass only if necessary, allowing sleeping.

Unfortunately the test for the end of the VLRU scan is incorrect
and can never trigger, so this second pass was effectively disabled
and any code that is conditional on defersleep=1 was never
exercised.  The code to start the second scan also has issues.

Fix the end of VLRU test, and also correctly set the variables
needed to restart the scan.

Change-Id: I8034cd3b79aab4f2976ab2559c13c102126480d7
Reviewed-on: http://gerrit.openafs.org/8234
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit a7828d50a82384e6d0fb0ad5b5a702f768029581)
Reviewed-on: http://gerrit.openafs.org/8247

13 years agoLinux: osi_vcache: Fix loop for the hlist case
Marc Dionne [Fri, 12 Oct 2012 20:25:43 +0000 (16:25 -0400)]
Linux: osi_vcache: Fix loop for the hlist case

An hlist is not circular, and the end is marked by a NULL next
pointer.

Reviewed-on: http://gerrit.openafs.org/8233
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 78ae01fb9837d79e7bbdb2918872ab106d4c7e98)

Change-Id: I7e4e3ed2515dd8c2ec765d8acbb97eba189d6aeb
Reviewed-on: http://gerrit.openafs.org/8239
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agolibuafs: enable 64 bit mode on linux
Derrick Brashear [Tue, 18 Sep 2012 18:46:37 +0000 (14:46 -0400)]
libuafs: enable 64 bit mode on linux

already safe and being used on other platforms; might as well
here too.

Reviewed-on: http://gerrit.openafs.org/8139
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 71a5f2965d6a6ff3113e7d2f9cab7d687b502793)

Change-Id: I61673c179617377020aa95aa8d8d659f240f04e7
Reviewed-on: http://gerrit.openafs.org/8238
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovlserver: use the logging function to log
Michael Meffie [Sat, 28 Jul 2012 17:17:55 +0000 (13:17 -0400)]
vlserver: use the logging function to log

Use the logging function to log instead of printf.

Change-Id: I377474881830152c93122bd3112e355ab5fd56ad
Reviewed-on: http://gerrit.openafs.org/7895
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit beb8f07496f59a19621bb0db14b401107888de35)

Change-Id: I246610abc3a6c2e164e0f368bc75a671f5f52e4d
Reviewed-on: http://gerrit.openafs.org/8208
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovlserver: fix logging of ip addresses
Michael Meffie [Wed, 4 Jul 2012 21:54:02 +0000 (17:54 -0400)]
vlserver: fix logging of ip addresses

Remove the spurious dates surrounding IP addresess in the VLLog.
Instead of multiple calls to the logging function for a given log
line, format a string containing the addresses and call the log
function once.

Changes the log output from,

  ...  The following fileserver is being registered in the VLDB:
  ...         [Tue Jul  4 14:11:43 2012 192.168.10.128Tue Jul  4 14:11:43 2012 ]
  ...  It will create a new entry in the VLDB.

to,

  ...  The following fileserver is being registered in the VLDB:
  ...         [192.168.10.128]
  ...  It will create a new entry in the VLDB.

Reviewed-on: http://gerrit.openafs.org/7750
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 65a5e3ce92c47a87c3dca54cec456ae0337c78ef)

Change-Id: I106556cda1046e6e8c971787ed8d056da70b77b9
Reviewed-on: http://gerrit.openafs.org/8207
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovldb_check: fix cross-linked mh entries
Michael Meffie [Wed, 15 Aug 2012 21:19:07 +0000 (17:19 -0400)]
vldb_check: fix cross-linked mh entries

When run with -fix, consolidate server numbers in vl entries which
point to the same multi-homed entry. Use the lowest server number
from the set of server numbers which point to the same multi-homed
entry.

Remove unreferenced address entries which are duplicate multi-homed
indexes.

Two passes of vldb_check -fix may be required; first to fix the
vl entry server numbers; then to remove the duplicate address
entries.

Reviewed-on: http://gerrit.openafs.org/7999
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 911f751d1edfb18ddd5f6a699746ba14730d553d)

Change-Id: Iec977e25344ce1d5f93e3f107cc1b7ebc81d2c26
Reviewed-on: http://gerrit.openafs.org/8212
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovldb_check: remove unreferenced mh entries with -fix
Michael Meffie [Thu, 28 Jun 2012 21:12:24 +0000 (17:12 -0400)]
vldb_check: remove unreferenced mh entries with -fix

When running vldb_check with -fix, clear any mh extent entries which
are set but are not referenced by an address entry in the
IpMappedAddr table.  These unreferenced entries already generated a
warning.  This commit adds the feature to clear the unreferenced mh
entries using vldb_check -fix option.

Reviewed-on: http://gerrit.openafs.org/7616
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit fdd3b0fb1f8e6948c651d7f1822d17a78668e5ff)

Change-Id: I79c79b3499fce448ebf662246de9f623b1565995
Reviewed-on: http://gerrit.openafs.org/8211
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovldb_check: warn about cross-linked mh entries
Michael Meffie [Fri, 29 Jun 2012 22:10:31 +0000 (18:10 -0400)]
vldb_check: warn about cross-linked mh entries

Warn if an mh extent entry is referenced by more than one server
number in the IpMappedAddr table.

The serveraddr table is used to determine which server numbers have
IP addresses.  If, for some reason, multiple server numbers
reference the same mh entry, currently, the correct serveraddr value
is calculated only for the lowest server number in the set of server
numbers which reference the same mh entry.  Handle this case, and
warn about the duplicated values in the IpMappedAddr table.

Warn about IpMappedAddr entries which reference non-existent mh
blocks.

Reviewed-on: http://gerrit.openafs.org/7615
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 08e803bce3375bb69a01715b026d844b7a8e0ab3)

Change-Id: I1d2a2d09ed468a247b4da6c07b5ecb4224a80c05
Reviewed-on: http://gerrit.openafs.org/8210
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovldb_check: off by one host address table error
Michael Meffie [Tue, 26 Jun 2012 19:09:07 +0000 (15:09 -0400)]
vldb_check: off by one host address table error

Fix several off-by-one errors when traversing the IpMappedAddr
table in vldb_check. The last index (254) was not checked
in several places.

Reviewed-on: http://gerrit.openafs.org/7614
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit a27a8a66c2c27a62afa566679ef9cf424e758d9f)

Change-Id: I5fd5b452cafe641765247bdf11ef1a1b08cc1529
Reviewed-on: http://gerrit.openafs.org/8209
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovos: convertROtoRW - prevent VLDB corruption
Mark Vitale [Mon, 27 Aug 2012 19:11:32 +0000 (15:11 -0400)]
vos: convertROtoRW - prevent VLDB corruption

vos convertROtoRW incorrectly marks the first VLDB entry as the
new RW if the converted RO is not in the VLDB.  Correct this
by creating a new valid RW site in the VLDB entry.

Change-Id: I683ac10db90c2c41717c11c0d86eadc81a935e52
Reviewed-on: http://gerrit.openafs.org/8037
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit f258e7dddeb4331d2cf4649541c1a3adfa7a416a)
Reviewed-on: http://gerrit.openafs.org/8216
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovos: convertROtoRW incorrect warning when RO not in VLDB
Mark Vitale [Tue, 4 Sep 2012 13:06:44 +0000 (09:06 -0400)]
vos: convertROtoRW incorrect warning when RO not in VLDB

vos convertROtoRW will issue an incorrect warning about a partition
mismatch if the RO to convert is not in the VLDB.  Only check the
partition if the RO is in the VLDB.

Change-Id: Ib2726bc5bf6697898ad26dc1d817143da3286ba3
Reviewed-on: http://gerrit.openafs.org/8036
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit b650106e301ecefe2f5c8f4a34081af1f5f74901)
Reviewed-on: http://gerrit.openafs.org/8215
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovos: convertROtoRW susceptible to VLDB changes during override prompt
Mark Vitale [Mon, 20 Aug 2012 21:39:06 +0000 (17:39 -0400)]
vos: convertROtoRW susceptible to VLDB changes during override prompt

vos convertROtoRW obtains a VLDB entry, then peforms some setup logic
(including a possible user prompt) before obtaining a volume lock.
This exposes the code to possible time-of-check/time-of-use issues.
After obtaining the volume lock, get a second copy of the VLDB entry
and compare it to the first copy; if it has changed, fail the conversion
with an error message asking the user to re-issue the vos convertROtoRW
command.

Change-Id: I9c1a634cea2e22188869d54b00b7831aed12b1cd
Reviewed-on: http://gerrit.openafs.org/8008
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 3c489db55811dfe3fdf5e555bf229989e5b58aa6)
Reviewed-on: http://gerrit.openafs.org/8214
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovos: convertROtoRW may create 2nd RW on a fileserver
Mark Vitale [Thu, 2 Aug 2012 22:37:05 +0000 (18:37 -0400)]
vos: convertROtoRW may create 2nd RW on a fileserver

If an RW is already present on disk on the target server (any partition),
'vos convertROtoRW' will still convert the RO, creating a second RW on the server.
Detect this and refuse to convert the RO by returning EXDEV (invalid cross-device link).

Change-Id: Ide15a7c39f2a975fd8597e497094b6a67b448e4f
Reviewed-on: http://gerrit.openafs.org/7934
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 0c77c0acabe0a0588ab0a9efab0124ee1e15ef6a)
Reviewed-on: http://gerrit.openafs.org/8213
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoRedHat: Avoid the DKMS escaping silliness
Andrew Deason [Tue, 25 Sep 2012 16:16:35 +0000 (11:16 -0500)]
RedHat: Avoid the DKMS escaping silliness

Depending on the version of DKMS, the current MAKE[0] variable in the
dkms.conf needs different numbers of backslashes. Commit 81a9a33e
tried to address this by changing the contents of dkms.conf depending
on whether or not we were on Fedora. However, the change occurred in
DKMS 2.2, so if someone running RHEL tries to use a newer DKMS, this
will fail.

So instead of trying to guess at the level of escaping we need, just
avoid needing to escape anything with backslashes. We can quote the
heredoc marker to avoid variable expansion inside the heredoc, we can
use a case statement instead of using backticks and local variables
and such, and we can use single quotes for the outer MAKE assignment.
With this, we should not need any backslashes when writing dkms.conf,
so we should work with any DKMS version.

Reviewed-on: http://gerrit.openafs.org/8156
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 72f1f345ece09b1fbd113af17c9e8e25ec9dffa5)

Change-Id: Icbaa1fde7ea222b639a7e5a740f6b18a4a87c74a
Reviewed-on: http://gerrit.openafs.org/8172
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoLINUX: Avoid symlink-y resolution limits
Andrew Deason [Tue, 21 Aug 2012 22:03:30 +0000 (17:03 -0500)]
LINUX: Avoid symlink-y resolution limits

Implementing the d_automount or follow_link function pointers for our
directories means that we can hit symlink resolution limits during
lookup, since we look like a "symlink". We can hit these limits pretty
easily if there are just too many directories in the lookup path.

Our pseudo-symlink directories cannot contribute to an infinite
resolution loop, since our destination is always an actual directory,
not a symlink that will result in more redirection. So, decrement the
total_link_count counter when our d_automount or follow_link code is
reached, so we do not contribute to hitting the max resolution limit.

Note that this is not related to recursive symlink lookup (link_count)
but only to the iterative symlink limit (total_link_count). Our
lookups are not recursive here, and we are not causing more recursive
lookups like a normal text-based symlink would do.

Reviewed-on: http://gerrit.openafs.org/8009
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 238b88624a8fef39557d397cc336c88bd8efc5b1)

Change-Id: Iec6e3fac25ab86ef5f10f359344908398bef8828
Reviewed-on: http://gerrit.openafs.org/8194
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoLinux 3.6: lookup inode operation API change
Marc Dionne [Tue, 14 Aug 2012 22:26:24 +0000 (18:26 -0400)]
Linux 3.6: lookup inode operation API change

The nameidata argument is replaced with an unsigned int flags
argument.

Reviewed-on: http://gerrit.openafs.org/7987
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit ec48dca871ef98adb69792a34047c6be5818f1b2)

Change-Id: Ic8be26141ede6e1c4062872c79a846efb0045bda
Reviewed-on: http://gerrit.openafs.org/8084
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoLinux 3.6: revalidate dentry op API change
Marc Dionne [Tue, 14 Aug 2012 22:08:51 +0000 (18:08 -0400)]
Linux 3.6: revalidate dentry op API change

The nameidata argument is dropped, replaced by an unsigned flags
value.  The configure test is very specific; kernels with the
older API with a signed int flags value should fall through.

Reviewed-on: http://gerrit.openafs.org/7986
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 7413cd09a53f89882a46fd100bf6c501348f2188)

Change-Id: Ie68d70dcf414d24e7e980c8a8f35b83550d2da7c
Reviewed-on: http://gerrit.openafs.org/8083
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoLinux 3.6: create inode operation API change
Marc Dionne [Tue, 14 Aug 2012 21:28:50 +0000 (17:28 -0400)]
Linux 3.6: create inode operation API change

The nameidata argument is dropped and a flag is added.

Reviewed-on: http://gerrit.openafs.org/7985
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 020e32779c103817ca89caa51259fb53bc3dde79)

Change-Id: Iae2a0301a1c4acb6835eb0bdca6ae22b143b2cda
Reviewed-on: http://gerrit.openafs.org/8082
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoLinux: fix variable used to test for the iop create API
Marc Dionne [Tue, 14 Aug 2012 21:11:08 +0000 (17:11 -0400)]
Linux: fix variable used to test for the iop create API

Use correct variable when testing for the create API to use.

This is just for looks - there is no effect since mkdir and create
were changed in the same kernel release.

Reviewed-on: http://gerrit.openafs.org/7984
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit c633a92a1bc7881f18ee641082ff2efe7da1a8cb)

Change-Id: Ib23fe9a34bc07227614c149b0f16d3b0a067501b
Reviewed-on: http://gerrit.openafs.org/8081
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoLinux 3.6: d_alias and i_dentry are now hlists
Marc Dionne [Tue, 14 Aug 2012 01:55:25 +0000 (21:55 -0400)]
Linux 3.6: d_alias and i_dentry are now hlists

The d_alias pointer is now the head of an hlist.  This means the
iterator is a different macro and has no "reverse" version since
hlists have no direct pointer to the list tail.

inode->i_dentry gets the same treatment.  Adjust where we use it.

Reviewed-on: http://gerrit.openafs.org/7983
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 6bea047fb404bde828c6358ae06f7941aa2bc959)

Change-Id: I7e7b87e5f5c240f3f0ff25fa723c857ab9d0108c
Reviewed-on: http://gerrit.openafs.org/8080
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoLinux 3.6: dentry_open API change
Marc Dionne [Tue, 14 Aug 2012 01:36:15 +0000 (21:36 -0400)]
Linux 3.6: dentry_open API change

dentry_open now takes a path argument that combines the dentry and
the vfsmount pointers.
Add a configure test and a new compat inline function to keep things
cleaner in the main source file.

Reviewed-on: http://gerrit.openafs.org/7982
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 8766a65e97eb90cb6c97ccd35181c441ece14f8a)

Change-Id: I2c0f59ad9aa6e544a2a613e902933d463f22a5b6
Reviewed-on: http://gerrit.openafs.org/8079
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoLinux 3.6: kmap_atomic API change
Marc Dionne [Tue, 14 Aug 2012 20:34:42 +0000 (16:34 -0400)]
Linux 3.6: kmap_atomic API change

kmap_atomic no longer requires a KM_TYPE argument.  Test for this
and adjust the affected code.

Reviewed-on: http://gerrit.openafs.org/7981
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 049c485b4a39ba510035788b4959d839ef668c55)

Change-Id: Iac8be7901da4b277864b1b6cc987cf5087992789
Reviewed-on: http://gerrit.openafs.org/8078
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoLinux: bypass: consolidate copy_page macros into a single function
Marc Dionne [Tue, 14 Aug 2012 00:32:08 +0000 (20:32 -0400)]
Linux: bypass: consolidate copy_page macros into a single function

The copy_page(s) macros are very similar; combine them into a
single function that can be used for all cases.

This will make it easier to add some pre-processor logic around
the kmap_atomic calls to adapt to Linux API changes.

Reviewed-on: http://gerrit.openafs.org/7980
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 0a8256a26fafb490b454f2a857b0c15d859572c5)

Change-Id: I6835a024428b26a8cd8d073f6304d0d0b3042b24
Reviewed-on: http://gerrit.openafs.org/8077
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years ago1.6: fix warnings
Derrick Brashear [Wed, 12 Sep 2012 11:25:12 +0000 (07:25 -0400)]
1.6: fix warnings

1.6 only. fix warnings which do not exist on master

Change-Id: I33927d1f3f3a45c26991bb9a60eb80bd0e6a9178
Reviewed-on: http://gerrit.openafs.org/8105
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agoafsd: include sys/resource.h in afsd_kernel.c
Marc Dionne [Sun, 3 Jun 2012 00:45:08 +0000 (20:45 -0400)]
afsd: include sys/resource.h in afsd_kernel.c

With a recent glibc update, sys/wait.h no longer includes
sys/resource.h unless __USE_SVID, __USE_XOPEN or __USE_XOPEN2K8
are set.

Don't rely on the indirect inclusion to get the bits we need;
include it directly in afsd_kernel.c.  This include used to be
there but was dropped when afsd_kernel.c was split off.

Reviewed-on: http://gerrit.openafs.org/7522
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit bc3a32a84facb8114a8c7de87025f972d0281098)

Change-Id: Ia5ba6a0e662607e680b4431f146c969b7069bcfd
Reviewed-on: http://gerrit.openafs.org/8155
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>
13 years agotptserver: Disable strict-aliasing warnings
Marc Dionne [Tue, 11 Sep 2012 20:39:55 +0000 (16:39 -0400)]
tptserver: Disable strict-aliasing warnings

Disable the strict-aliasing warnings for a few files that have
supergroups related code.  This was already done in ptserver but
not in tptserver.

Change-Id: I8b3c8b5f5b19fd47fed949e7b2568678a5ffffd4
Reviewed-on: http://gerrit.openafs.org/8096
Tested-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agovolser: log host address of caller in extra logging
Michael Meffie [Fri, 12 Aug 2011 12:25:30 +0000 (08:25 -0400)]
volser: log host address of caller in extra logging

When the volserver is running with extra logging (-log),
log the address of the host running vos in addition
to the user name.

Change-Id: I040be71a84dede255e43c30dd7d8ae56f767f721
Reviewed-on: http://gerrit.openafs.org/5234
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit cbdca2996af06c57cb3ba953c1efb9e316d18f27)
Reviewed-on: http://gerrit.openafs.org/8066
Tested-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
13 years agolibafs: revert init req to use the real uid
Michael Meffie [Thu, 2 Aug 2012 21:24:02 +0000 (17:24 -0400)]
libafs: revert init req to use the real uid

The commit to use wrappers for creditial structure access
inadvertently changed the user id to be the effective uid instead of
the real uid, when no PAG is present, on linux.  Revert this so
setuid programs continue to work.

See commit eb8e55bba7740a87e07ef07bb4b789e6d4e36f0d

Change-Id: I5d42b8caf90a042192ed39f26e55d70c9531f2e9
Reviewed-on: http://gerrit.openafs.org/7931
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 1a1e87dcdf972519cd21970f7c78709e40f8e1e9)
Reviewed-on: http://gerrit.openafs.org/7990

13 years agoafs: Set DWriting when truncating a dcache entry
Andrew Deason [Thu, 22 Mar 2012 15:42:38 +0000 (10:42 -0500)]
afs: Set DWriting when truncating a dcache entry

When we truncate a file, we truncate the contents of the relevant
dcache entry chunks, and prevent future FetchData operations from
fetching data beyond the truncation offset. If we never write anything
to that chunk, we never set DWriting, and so on disk it looks like
that dcache entry has valid data for the specified DV. However, since
the data is truncated, this is not true.

If a process holds a file open, truncates it without writing to it,
and then the client crashes (or we have trouble contacting the
fileserver when we close the file), the dcache entry will appear valid
on disk. So the next time we read the dcache entry, we will use the
incorrect cache contents as if they were accurate for the specified
DV.

To avoid this, set DWriting when we truncate a chunk. Normally we only
clear DWriting when we actually send data to the fileserver, so to
clear DWriting in this case, add an additional line to clear it in
afs_StoreAllSegments, after the StoreMini has completed.

Reviewed-on: http://gerrit.openafs.org/6937
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit b3b267d16eefb993f52f66bf44f3e659c1017e58)

Change-Id: I5602db9687f3f005f68200a4208a3c7012933efa
Reviewed-on: http://gerrit.openafs.org/7996
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoafs: Slight adjustments in afs_GetDCache
Andrew Deason [Thu, 22 Mar 2012 15:52:47 +0000 (10:52 -0500)]
afs: Slight adjustments in afs_GetDCache

maxGoodSize is only used in one block, so move the decl to that block.
Adjust some of the comments to more accurately reflect what's going
on.

Reviewed-on: http://gerrit.openafs.org/6936
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit d5c13a0f3ce7d9f0a01820ff9c12dfb1cbc12047)

Change-Id: I2ba6574b88856d2f506663eafb984a9f3bea4cf8
Reviewed-on: http://gerrit.openafs.org/7995
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoafs: Do not limit fetches based on vcache length
Andrew Deason [Fri, 2 Mar 2012 23:22:12 +0000 (17:22 -0600)]
afs: Do not limit fetches based on vcache length

Currently, when we go to the fileserver to fetch some data, we try to
make sure that we do not ask for data beyond the end of the file. For
example, if our chunk size is 1M, and we need to get the first chunk
for a file that is 4 bytes long, we will only ask the fileserver for 4
bytes.

This can cause issues when the file is being extended at the same time
as when we are trying to read the file. Consider the following
example. There is a file named X that has contents "abcd" at dv 1, and
we issue a FetchData64 request for X, only requesting 4 bytes. Right
before the fileserver gets the FetchData64 request, another client
writes the contents "12345" to file X.

The client will then fetch the contents "1234" for that file, at dv 2,
and store that as the contents of the first chunk for file X. On
subsequent reads for file X, applications will now get "1234<NUL>" as
the contents, since the size of the file will be updated to 5, but the
cache manager thinks that "1234" is the correct contents for the first
chunk of X at dv 2. The cache manager will continue to think so until
the cache entry is evicted or invalidated for whatever reason.

To avoid this scenario, always request a full chunk of data if we have
any data to fetch and the file has not been locally truncated. We can
still avoid the fetch at all if it looks like we're fetching beyond
end-of-file, since we know that at least at some point that was
correct information about the file. If this results in us trying to
fetch beyond end-of-file, the fileserver will respond with the correct
length anyway.

We still need to restrict the fetch request length based on
avc->f.truncPos, since the dcache data after avc->f.truncPos needs to
stay empty, since we don't track truncated data any other way. If we
also avoided this restriction, extending a file via truncation after
reducing a file's length via truncation could cause the old file data
to appear again, instead of filling the new file range with NULs.

Note that on at least Linux, with this fix an application can still
read the contents "1234" on the first read in the above example, and
"12345" on subsequent reads. This is just due to when we give the VFS
updates about file metadata, and could be remedied by updating file
metadata immediately from the FetchStatus information from the
FetchData64 call. However, just reading the contents "1234" in the
above example seems like a somewhat plausible outcome; at the very
least, it is an improvement.

Reviewed-on: http://gerrit.openafs.org/6882
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit e53221d9a82fd8e3d545704abae51cc844bc31a3)

Change-Id: I81b5a3a6ff745f3f53988a1a4e5d3df20f5df6d3
Reviewed-on: http://gerrit.openafs.org/7994
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoafs: Log a message on invalid FetchStatus receipt
Andrew Deason [Fri, 2 Mar 2012 23:18:25 +0000 (17:18 -0600)]
afs: Log a message on invalid FetchStatus receipt

If we get an invalid AFSFetchStatus structure from a server, log a
message to indicate as such. This serves as a warning to urge people
to fix their fileservers, and to explain what is doing.

Reviewed-on: http://gerrit.openafs.org/6881
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 577d5d99fefb62f0b52a568207d2352946b36137)

Change-Id: I10dc2dd94d2cd7277e48dfff1accb36e7cab8537
Reviewed-on: http://gerrit.openafs.org/7993
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoafs: Sanity-check some AFSFetchStatus structures
Andrew Deason [Fri, 2 Mar 2012 23:06:48 +0000 (17:06 -0600)]
afs: Sanity-check some AFSFetchStatus structures

We currently do not do any sanity checking on the AFSFetchStatus
structures returned from fileservers. Add some sanity checking for
BulkStatus and FetchStatus calls, so we do not screw up our cache if a
fileserver gives us bogus data.

If we do get an invalid AFSFetchStatus structure, act as if the server
gave us a VBUSY error code, so we will retry the request. For OpenAFS
fileservers prior to 1.6.1 that yield this situation, VBUSY is likely
the error code the fileserver should have responded anyway.

Reviewed-on: http://gerrit.openafs.org/6880
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 5af63fabc553a2fecd4c3080b25fe14483f5bd98)

Change-Id: I88922a75ada96d641bfd0078a8e7d6854c4ea699
Reviewed-on: http://gerrit.openafs.org/7992
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agorx: dec rx_nWaiting on clearing RX_CALL_WAIT_PROC
Andrew Deason [Mon, 27 Aug 2012 18:33:47 +0000 (14:33 -0400)]
rx: dec rx_nWaiting on clearing RX_CALL_WAIT_PROC

Currently, a couple of callers (rxi_ResetCall, and
rxi_AttachServerProc) will decrement rx_nWaiting only if
RX_CALL_WAIT_PROC is set for a call, and the call is on a queue
(presumably rx_incomingCallQueue). This can cause an imbalance in
rx_nWaiting if these code paths are reached when, in another thread,
rx_GetCall has removed the call from its queue, but it has not yet
cleared RX_CALL_WAIT_PROC (this can happen while it is waiting for
call->lock). In this situation, rx_GetCall will remove the call from
its queue, wait, and e.g. rxi_ResetCall will clear RX_CALL_WAIT_PROC;
neither will decrement rx_nWaiting.

This is possible if a new call is started on a call channel with an
extant call that is waiting for a thread; we will rxi_ResetCall in
rxi_ReceivePacket, but rx_GetCall may be running at the same time.
This race may also be possible via rxi_AttachServerProc via
rxi_UpdatePeerReach -> TryAttach -> rxi_AttachServerProc while
rx_GetCall is running, but I'm not sure.

To avoid this, decrement rx_nWaiting based on RX_CALL_WAIT_PROC alone,
regardless of whether or not the call is on a queue. This mirrors the
incrementing rx_nWaiting behavior, where rx_nWaiting is only
incremented if RX_CALL_WAIT_PROC is unset for a call, so this should
guarantee that rx_nWaiting does not become unbalanced.

Backport of commit 660720d1f54a867e21f78b6ec4c024235e4c37b7

Change-Id: I3372e053d284e10702971769487a7580a6842ef2
Reviewed-on: http://gerrit.openafs.org/8015
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agolibafs: log server errors on hard mount retry
Michael Meffie [Mon, 23 Apr 2012 18:42:24 +0000 (14:42 -0400)]
libafs: log server errors on hard mount retry

Save the last errors seen during a request and log those
errors if a hard-mount retry is done.

Reviewed-on: http://gerrit.openafs.org/7275
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 94a8ce970d57498583e249ea61725fce1ee53a50)

Change-Id: I9aec874fc525c823c095bb3647bd2561854dbab3
Reviewed-on: http://gerrit.openafs.org/8002
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoUnix CM: Log reason for marking server up or down
Simon Wilkinson [Thu, 24 Nov 2011 17:43:45 +0000 (17:43 +0000)]
Unix CM: Log reason for marking server up or down

When we mark a server up or down also log the error code that says
why we did so, for help in debugging connection issues.

Reviewed-on: http://gerrit.openafs.org/6116
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 33526acb56c1794838c6a8c02e9b8f5022a04ac1)

Change-Id: If0318faf99f2a7582c93f74f3fc210c0c02fbaf7
Reviewed-on: http://gerrit.openafs.org/8001
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agolibafs: initialize free dcache list for memcache
Derrick Brashear [Fri, 25 May 2012 13:40:54 +0000 (09:40 -0400)]
libafs: initialize free dcache list for memcache

reuse the disk cache dcache creation code for memcache, then
call it to prime the list

Reviewed-on: http://gerrit.openafs.org/7446
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 9bb876f6829f137e534b961f7374b310bfa8aa7d)

Change-Id: I1c616521a9e518ac7e4e62006b3a327458263cae
Reviewed-on: http://gerrit.openafs.org/7944
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoafs: Add some comments explaining 'needvalid'
Andrew Deason [Mon, 21 May 2012 17:28:58 +0000 (12:28 -0500)]
afs: Add some comments explaining 'needvalid'

Add some comments to try and help explain the meaning of the
'needvalid' parameter to GetDSlot, added in
1a672914ab050811c99b6307c657630ab9b5c8ee.

Reviewed-on: http://gerrit.openafs.org/7429
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 6f6c799c4ba4d03c6c381738b2db8aafe741ba5e)

Change-Id: If7d37d427f96f3607b6c3aea2487396666e41a03
Reviewed-on: http://gerrit.openafs.org/7943
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoafs: Add afs_WriteDCache sanity checks
Andrew Deason [Wed, 21 Dec 2011 22:01:16 +0000 (17:01 -0500)]
afs: Add afs_WriteDCache sanity checks

Writing a non-free non-discarded dcache entry with a zero volume id
can easily cause hash table corruption later on, so make sure we don't
do that. Also log something if the write itself fails, as this usually
indicates an unusual situation involving I/O errors or something.

Reviewed-on: http://gerrit.openafs.org/6419
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 79f69f2eb130c1c5cb6cdfa4e7a129f450a58339)

Change-Id: I482ad6a1fef3896144855b58c70e73bdf896027f
Reviewed-on: http://gerrit.openafs.org/7942
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoafs: Cope with afs_GetValidDSlot errors
Andrew Deason [Wed, 21 Dec 2011 21:05:40 +0000 (16:05 -0500)]
afs: Cope with afs_GetValidDSlot errors

Make callers of afs_GetValidDSlot deal with getting a NULL dcache,
which can occur if an error is encountered. Some of these just panic
at least for now, since a code path for recovery is complex, but this
is at least better than dereferencing a NULL pointer.

Reviewed-on: http://gerrit.openafs.org/6418
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 9ed26da26f4a5a3fef3bf0a7b6f9dae751ce6659)

Change-Id: I79c6fb3ae6279b5da482f95b4d4ed457beeaf1dd
Reviewed-on: http://gerrit.openafs.org/7941
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoafs: Do not always ignore errors in afs_GetDSlot
Andrew Deason [Wed, 21 Dec 2011 20:04:32 +0000 (15:04 -0500)]
afs: Do not always ignore errors in afs_GetDSlot

Currently afs_UFSGetDSlot will silently swallow any error in reading
the specified dslot from disk, and will return a "blank" dcache to the
caller. However, many callers of afs_GetDSlot will be asking for a
dcache that we know exists, and more importantly, we know is on the
global hash table. If a disk error is encountered and we're given a
"blank" dcache, we will erroneously believe the dcache entry is not on
the hash table, causing corruption of the hash table later on.

So instead, modify all callers of afs_GetDSlot to use either
afs_GetValidDSlot or afs_GetNewDSlot. Calling afs_GetValidDSlot
indicates that the given dentry index is known to be valid, and any
error encountered while reading the entry from disk should result in
an error (for disk I/O errors we have no control over, this results in
a NULL dentry returned; for internal consistency errors we panic).
Calling afs_GetNewDSlot indicates that the specified index may not
exist or may not be valid, and so returning a "blank" dentry in that
case is fine.

For memcache, the situation is the same, except any time we go to
"disk" it is an (internal) error, since there is no disk.

Reviewed-on: http://gerrit.openafs.org/6417
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 1a672914ab050811c99b6307c657630ab9b5c8ee)

Change-Id: Ia30e7de919ccc14708112886e492e60f93fe6639
Reviewed-on: http://gerrit.openafs.org/7940
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoafs: Remove second argument to afs_GetDSlot
Andrew Deason [Wed, 21 Dec 2011 22:25:29 +0000 (17:25 -0500)]
afs: Remove second argument to afs_GetDSlot

All callers of afs_GetDSlot were passing NULL as the second argument
to afs_GetDSlot. So, remove the argument, and behave as if tmpdc was
NULL unconditionally.

Reviewed-on: http://gerrit.openafs.org/6416
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 12177ba6fffaf8a693dd8c8e9445d5e7725ae743)

Change-Id: Ic1ad6d35a7051e83a811692156b0da7207cb57f4
Reviewed-on: http://gerrit.openafs.org/7939
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoafs: clean afs_osi_Alloc() usage
Chas Williams (CONTRACTOR) [Tue, 19 Oct 2010 18:50:35 +0000 (14:50 -0400)]
afs: clean afs_osi_Alloc() usage

Add asserts for any failures cases not explicitly handled and remove
any casting.

Reviewed-on: http://gerrit.openafs.org/3012
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 0e8cce457763b131de48395a9beed889fd529c1f)

Change-Id: I23497ea7a75a66c01ba7b1013e01dfaa005c9892
Reviewed-on: http://gerrit.openafs.org/7936
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoLINUX: Do not lookup immediately recursive mtpts
Andrew Deason [Fri, 6 Apr 2012 19:56:07 +0000 (14:56 -0500)]
LINUX: Do not lookup immediately recursive mtpts

On Linux, having a mountpoint in a volume root that points to the same
volume can cause serious problems. By 'immediately recursive', I mean
a situation like the following:

fs mkm mtpt vol
fs mkm mtpt/mtpt vol

If there are multiple dentry aliases for the directory (which is
possible if the directory is a mountpoint), an 'rmdir' on the
recursive mountpoint can cause the client to deadlock. Since the
'rmdir' code path in Linux locks the parent directory inode to perform
the rmdir, and locks the child directory inode after performing a
couple of sanity checks. For an immediately recursive mountpoint,
these two inodes are the same, and so we will deadlock.

Reviewed-on: http://gerrit.openafs.org/7742
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit d785abd5ec9302bdc1b3c33368246e573e0cd65d)

Change-Id: I531adbf66cf6714e04811356b072b17335980aa3
Reviewed-on: http://gerrit.openafs.org/7952
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoLinux: Make dir dentry aliases act like symlinks
Andrew Deason [Fri, 6 Jul 2012 21:37:39 +0000 (16:37 -0500)]
Linux: Make dir dentry aliases act like symlinks

Currently, we try to invalidate other dentries that exist for a
particular dir inode when we look up a dentry. This is so we try to
avoid duplicate dentries for a directory, which Linux does not like
(you cannot have hardlinks to a dir).

If we cannot invalidate the other aliases (because they are being
used), right now we just return the alias. This can make it very easy
to panic the client, due to the sanity checks Linux performs when dong
things like 'rmdir'. If we do something like this:

mkdir dir1
fs mkm dir1/mtpt vol
mkdir dir1/mtpt/dir2
fs mkm dir1/mtpt/dir2/mtpt2 vol
cd dir1/mtpt
rmdir dir2/mtpt2

For the 'rmdir', we will lookup 'mtpt2'. Since 'mtpt' and 'mtpt2'
are mountpoints for the same volume, their dentries point to the same
directory inode. So when we lookup 'mtpt2', we will try to invalidate
the other dentry, but we cannot do that since it is the cwd. So we
return the alias dentry (for 'mtpt'). The Linux VFS layer then does a
sanity check for the rmdir operation, checking that the child dentry's
parent inode is the same as the inode we're performing the rmdir for.
Since the dentry we returned was for 'mtpt', whose parent is 'dir1',
and the actual dir we're performing the rmdir for is 'dir2', this
sanity check fails and we BUG.

To avoid this, make the dentry alias act like a symlink when we
encounter an uninvalidateable dentry alias. That is, we allow multiple
dentry aliases for a directory, however, when the dentry aliases are
actually used, we redirect to a common dentry (via d_automount where
possible, and follow_link elsewhere).

This means that such mountpoints will behave similarly to symlinks, in
that we 'point' to a specific mountpoint dentry. This means that if we
have multiple different ways to get to the same volume, and all are
accessed at the same time, all but one of those mountpoints will
behave like symlinks, pointing to the same mountpoint. So, the '..'
entries for each path will all point to the parent dir of one
mountpoint, meaning that the '..' entry will be "wrong", but for most
cases it will still be correct.

In order to try to make the 'target', pointed-to directory consistent,
we add a new field to struct vcache: target_link. This points to the
dentry we should redirect to, whenever that vcache is referenced. To
avoid (possibly not-feasibly-solvable) problems with refcounting, this
pointer is not actually a reference to the target dentry, but just
serves as a pointer to compare to.

FIXES 130273

Reviewed-on: http://gerrit.openafs.org/7741
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit de381aa0d39e88a1ca0c8ccbb2471c5cad5a964c)

Change-Id: I68e1f0a3734f56db66e5fee3571597b5eb17eef8
Reviewed-on: http://gerrit.openafs.org/7951
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoafs: Indicate error from afs_osi_Read/Write better
Andrew Deason [Thu, 22 Dec 2011 20:01:52 +0000 (15:01 -0500)]
afs: Indicate error from afs_osi_Read/Write better

Currently afs_osi_Read and afs_osi_Write just return -1 on any I/O
error, even though they know the error code given from the OS VFS.
Just return that code instead so the caller can see what the error
was; but negate it, so it's clear that it is an error.

Reviewed-on: http://gerrit.openafs.org/6412
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit b5ca12ac4696c4049be14974f1e946bb55e1c440)

Change-Id: Ib5a674af7e0424691887b20d24782a6740d11414
Reviewed-on: http://gerrit.openafs.org/7938
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoafs: afs_osi_Read/Write returns negative on error
Andrew Deason [Thu, 22 Dec 2011 19:50:09 +0000 (14:50 -0500)]
afs: afs_osi_Read/Write returns negative on error

afs_osi_Read and afs_osi_Write need to return negative values on
error. EIO is not negative; return -EIO so we don't accidentally
return "success" if someone requested to read or write EIO bytes.

Reviewed-on: http://gerrit.openafs.org/6411
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 456ee898ae77b201275363f4efc0098c28e195d5)

Change-Id: Idd2e6b85d27a914cac0169a6e8fdee49ff262dc0
Reviewed-on: http://gerrit.openafs.org/7937
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agovos: Do not try to remove backup volume id 0
Andrew Deason [Mon, 9 Apr 2012 22:16:42 +0000 (17:16 -0500)]
vos: Do not try to remove backup volume id 0

Currently we always try to delete a BK volume if we're deleting the
RW. If the BK volume id is 0, this is never going to do anything, so
don't try to delete it.

Reviewed-on: http://gerrit.openafs.org/7140
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 46bdb318c45b4e93a5b297e6fdee2b2acbed4b55)

Change-Id: I6d5406d6e39513d3f38e7674fa726b627ca5f1f0
Reviewed-on: http://gerrit.openafs.org/7935
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoLINUX: Hold GLOCK for proc traversal
Andrew Deason [Thu, 26 Jul 2012 21:40:03 +0000 (16:40 -0500)]
LINUX: Hold GLOCK for proc traversal

The functions that traverse unixuser structures for display via /proc
(uu_start et al) call various libafs functions hold and release locks,
etc. To do any of that, we need GLOCK. Amongst other issues, we can
panic if we try to acquire a contested lock without GLOCK, since we
assert glock is held when we sleep for the lock or try to wake other
waiters. The same goes for the legacy CellServDB proc file.

So, hold and release GLOCK as appropriate.

Reviewed-on: http://gerrit.openafs.org/7885
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 5237d3d232f22aaf4f67f3a8727a293f4058a7ae)

Change-Id: I5895b4bde32b8efa27abc83cc6b9dab7458d5c75
Reviewed-on: http://gerrit.openafs.org/7914
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agoLINUX: Fix osi_proc.c formatting
Andrew Deason [Thu, 26 Jul 2012 20:58:45 +0000 (15:58 -0500)]
LINUX: Fix osi_proc.c formatting

osi_proc.c had a few formatting issues:

 - Several function definitions did not have the function name at the
   beginning of the line

 - A few preprocessor directives were not indented

 - A few areas used a tab character for each indentation level, as
   opposed to 4 spaces, then 1 tab, as the rest of the tree has

 - Struct definitions were aligned using tabs, not spaces, causing
   misalignments when the indentation was fixed

Fix these.

Reviewed-on: http://gerrit.openafs.org/7884
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 23f2f1232b03ed02f87582c12b4c4e8474bc9b5d)

Change-Id: I0c1a595ae0599f522ee3681d33f7b82290778b7f
Reviewed-on: http://gerrit.openafs.org/7913
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
13 years agodoc: Remove reference to NetRestrict wildcards
Andrew Deason [Mon, 18 Jun 2012 20:02:09 +0000 (15:02 -0500)]
doc: Remove reference to NetRestrict wildcards

Commit 80fc888a9223050481de932233fe7121a48df194 got some of this, but
forgot the other reference. We don't support these anywhere, so remove
it here, too.

FIXES 125340

Reviewed-on: http://gerrit.openafs.org/7564
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 4ae005062e2c927b77ea23d95934d5af463878b3)

Change-Id: I2880b5a0caf283324290ffd8f9c25194551e58cd
Reviewed-on: http://gerrit.openafs.org/7589
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agodoc: Add fs bypassthreshold man page
Andrew Deason [Thu, 28 Jun 2012 23:56:47 +0000 (18:56 -0500)]
doc: Add fs bypassthreshold man page

FIXES 130050

Change-Id: I0ffc7b93ed9dd93765a25efd60fe3430a86366cf
Reviewed-on: http://gerrit.openafs.org/7602
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 828ef9c39a14af265796755718c10b63513f952c)
Reviewed-on: http://gerrit.openafs.org/7735
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agorx: abort on missing service
Derrick Brashear [Fri, 1 Jun 2012 17:16:31 +0000 (13:16 -0400)]
rx: abort on missing service

currently rx does not send an abort if a service does not
exist; it quietly ignores the packet. provide a hint we have
done so.

Reviewed-on: http://gerrit.openafs.org/7563
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 1fbe83f9aacfc36a9c426ba1fd18ad7c72869dc1)

Change-Id: Id3b4952e8d27479f16c950606cacc19c7e52cc02
Reviewed-on: http://gerrit.openafs.org/7593
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoAuth: increase size of DNS resolver answer buffer
Niklas Jonsson [Wed, 20 Jun 2012 14:03:54 +0000 (10:03 -0400)]
Auth: increase size of DNS resolver answer buffer

This patchset increases the size of the res_search() answer
buffer from 1024 octets to 4096 octets.   This is not a proper
long term solution but will permit sites with longer response
lists to make use of SRV and AFSDB records.

This patchset only impacts UNIX systems.  Windows uses the
Win32 DNS resolver which dynamically allocates memory based
upon the size of the response.

FIXES 130936

Reviewed-on: http://gerrit.openafs.org/7575
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 3c16a2b296722f548309b10e6744639608c0861b)

Change-Id: Iac7fc7143ff48bd3eb2d3719902dd4549af25b50
Reviewed-on: http://gerrit.openafs.org/7592
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agorx: provide mechanism to send a bare abort packet
Simon Wilkinson [Fri, 1 Jun 2012 17:20:57 +0000 (13:20 -0400)]
rx: provide mechanism to send a bare abort packet

simply put an abort on the wire

Reviewed-on: http://gerrit.openafs.org/7562
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 5019ecd5fad0846abcd92835411c7b0f3f2170ca)

Change-Id: I21a8f2b5df84c49bda6b6fced5088cdeb3127017
Reviewed-on: http://gerrit.openafs.org/7591
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agodoc: Consolidate NetRestrict format docmentation
Andrew Deason [Mon, 18 Jun 2012 20:06:49 +0000 (15:06 -0500)]
doc: Consolidate NetRestrict format docmentation

We were specifying exactly the same format in two different places;
consolidate them into one place. In addition, explicitly say there are
is no way to specify a range of addresses, in case some people are
confused by the previous versions of this man page that erroneously
said you could use 255 as a wildcard.

Reviewed-on: http://gerrit.openafs.org/7565
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit d4bab02f023f53041c3ac58fd75cffd27ec92df0)

Change-Id: Ie138f8b6e3070d0bc92adae7dae90a26cbd78001
Reviewed-on: http://gerrit.openafs.org/7590
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agolibafs: put connection always in getcapabilities helper
Derrick Brashear [Tue, 19 Jun 2012 19:54:26 +0000 (15:54 -0400)]
libafs: put connection always in getcapabilities helper

if we get a connection, we need to always put it back. here we exited
with error before doing so. 1.6 only fix

Change-Id: I67abec863c1d60d557277468a681847263d783a1
Reviewed-on: http://gerrit.openafs.org/7570
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agolibafs: put connection in analyze when conn srvr missing
Derrick Brashear [Tue, 19 Jun 2012 19:11:38 +0000 (15:11 -0400)]
libafs: put connection in analyze when conn srvr missing

we need to putconn in all cases we can in afs_Analyze, but at least
one case we didn't. fixed.

(cherry picked from commit e2d094595fd76e76e4a5861114202f513d02c2b1)

Change-Id: I04e2d0f8b1002b9a6a73b8ff6755157460504da9
Reviewed-on: http://gerrit.openafs.org/7569
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agodoc: Correct volume size CAUTIONS notes
Andrew Deason [Thu, 28 Jun 2012 20:43:27 +0000 (15:43 -0500)]
doc: Correct volume size CAUTIONS notes

2 terabytes is 2^41 bytes, not 2^31 bytes. Also clarify that volumes
can be much larger than this.

FIXES 130188

Reviewed-on: http://gerrit.openafs.org/7598
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 300cbb28b08c2fd3709942cc6c48e7d9369a3394)

Change-Id: I762e18e83d4557c8fd4db3601426bcaaa845199a
Reviewed-on: http://gerrit.openafs.org/7674
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
13 years agodoc: Fix whitespace errors
Andrew Deason [Thu, 28 Jun 2012 22:47:32 +0000 (17:47 -0500)]
doc: Fix whitespace errors

Reviewed-on: http://gerrit.openafs.org/7599
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit fcaa53a6d7289665b64037a0d96ae4c6cbf4f776)

Change-Id: I69f90ca4d764a25720e8625443c0b86751914cca
Reviewed-on: http://gerrit.openafs.org/7673
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
13 years agodoc: Consolidate CAUTIONS notes about volume size
Andrew Deason [Thu, 28 Jun 2012 20:30:40 +0000 (15:30 -0500)]
doc: Consolidate CAUTIONS notes about volume size

Reviewed-on: http://gerrit.openafs.org/7597
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 3ff8ef499c56008f4d2ebf5b81e08e98eb0c0826)

Change-Id: Ie29664d105e0f35140fdf3c164da78564f6b5e36
Reviewed-on: http://gerrit.openafs.org/7672
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
13 years agodoc: Consolidate NetRestrict format docmentation
Andrew Deason [Mon, 18 Jun 2012 20:06:49 +0000 (15:06 -0500)]
doc: Consolidate NetRestrict format docmentation

We were specifying exactly the same format in two different places;
consolidate them into one place. In addition, explicitly say there are
is no way to specify a range of addresses, in case some people are
confused by the previous versions of this man page that erroneously
said you could use 255 as a wildcard.

Reviewed-on: http://gerrit.openafs.org/7565
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit d4bab02f023f53041c3ac58fd75cffd27ec92df0)

Change-Id: I7bae4786b6a0cc2115688bd54d1c1128dc0f5df2
Reviewed-on: http://gerrit.openafs.org/7671
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
13 years agodoc: Remove reference to NetRestrict wildcards
Andrew Deason [Mon, 18 Jun 2012 20:02:09 +0000 (15:02 -0500)]
doc: Remove reference to NetRestrict wildcards

Commit 80fc888a9223050481de932233fe7121a48df194 got some of this, but
forgot the other reference. We don't support these anywhere, so remove
it here, too.

FIXES 125340

Reviewed-on: http://gerrit.openafs.org/7564
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 4ae005062e2c927b77ea23d95934d5af463878b3)

Change-Id: I58e0fa2ea138a08b45d136abb9fcd43f9f3dc11a
Reviewed-on: http://gerrit.openafs.org/7670
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
13 years agoLinux 3.5: encode_fh API change
Marc Dionne [Sun, 3 Jun 2012 01:35:53 +0000 (21:35 -0400)]
Linux 3.5: encode_fh API change

The encode_fh export operation now expects two inode arguments
instead of a dentry and a "connectable" flag.  Use the inode of
the dentry we're interested in, and NULL as the parent inode which
is the same as passing a 0 flag in the previous API.

Change-Id: I05cf146fb2a4bacdca20a9f108d04ccb11530804
Reviewed-on: http://gerrit.openafs.org/7523
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 5227148ae17949705487ea673d558ebfe143e635)
Reviewed-on: http://gerrit.openafs.org/7579

13 years agoLinux 3.3: use umode_t for mkdir and create inode ops
Marc Dionne [Wed, 18 Jan 2012 16:22:35 +0000 (11:22 -0500)]
Linux 3.3: use umode_t for mkdir and create inode ops

The mkdir and create inode operations have switched to using
umode_t instead of int for the file mode.

Change-Id: Ib8bbf6eaa6e87d6a9692c45b1a3fe93fcc3eff7a
Reviewed-on: http://gerrit.openafs.org/6567
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit beafc7f742ebad021bfcbed73884aecedee4e04b)
Reviewed-on: http://gerrit.openafs.org/7577

13 years agoaklog: can't assume krb5_524_conv_principal based on convert_creds
Derrick Brashear [Tue, 12 Jun 2012 17:46:46 +0000 (13:46 -0400)]
aklog: can't assume krb5_524_conv_principal based on convert_creds

add probing for krb5_524_conv_principal directly instead of
assuming finding a 524 library will find it. current heimdal
does not include it.

Reviewed-on: http://gerrit.openafs.org/7551
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 6d3390bc16281e6f889bb555abb1182985556287)

Change-Id: Icc576d1a711fa771fda393c61a15082ffb94defc
Reviewed-on: http://gerrit.openafs.org/7582
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoLinux 3.4: replace end_writeback with clear_inode
Marc Dionne [Tue, 29 May 2012 01:43:12 +0000 (21:43 -0400)]
Linux 3.4: replace end_writeback with clear_inode

end_writeback() is renamed to clear_inode().  Add a configure test
and cope.

Change-Id: Icaf5b6b54d0ee377fabcf0b295d690eaa6b4be5e
Reviewed-on: http://gerrit.openafs.org/7503
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 2b33384a4a7b88842281021129ffccc837d91d36)
Reviewed-on: http://gerrit.openafs.org/7578

13 years agoLinux: remove unused variable
Marc Dionne [Thu, 14 Jul 2011 00:56:53 +0000 (20:56 -0400)]
Linux: remove unused variable

endindex is not used, remove it

Change-Id: I50a89e3f25828c05fd24f4fc6a1068007a68dbc2
Reviewed-on: http://gerrit.openafs.org/5012
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit a76e65034cf3feadfe2af5a20ddae705fda00aa0)
Reviewed-on: http://gerrit.openafs.org/7580
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoafs: Do not QueueVCB before osi_dnlc_purge*
Andrew Deason [Fri, 18 May 2012 21:40:38 +0000 (17:40 -0400)]
afs: Do not QueueVCB before osi_dnlc_purge*

In afs_FlushVCache, when we QueueVCB, we might drop the afs_xvcache
lock (as of 76158df491f47de56d1febe1d1d2d17d316c9a74). The vcache may
still be on the DNLC, so a lookup while xvcache is dropped can cause
someone else to grab a reference to the vcache while it is being
flushed. This can cause panics and failed assertions, since someone
will have a reference to the flushed vcache, which is effectively
freed and many of the structure fields are no longer valid.

So instead, do not call QueueVCB until we have purged the vcache from
the DNLC.

Reviewed-on: http://gerrit.openafs.org/7430
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 0e81db38b549d79a3af5fce0f9f8fa48d9e6efeb)

Change-Id: Idabad9076c6c36bede3faf459abb940aae5a975c
Reviewed-on: http://gerrit.openafs.org/7502
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoafsd: Avoid dir interpolation for memcache
Andrew Deason [Mon, 21 May 2012 22:11:29 +0000 (17:11 -0500)]
afsd: Avoid dir interpolation for memcache

memcache doesn't make use of fullpn_DCacheFile, fullpn_VolInfoFile,
etc. Do not even try to generate these strings for memcache, since
cacheBaseDir will be NULL, and so this can cause a segfault on some
platforms including Solaris.

Reviewed-on: http://gerrit.openafs.org/7442
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 2e2bc535bd03df86f78b648f78d2d0a95d273fab)

Change-Id: I46f2da9b2f0e5f8d004ebd3d799a3c1ac22c3e95
Reviewed-on: http://gerrit.openafs.org/7501
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoafsd: Avoid printing cacheBaseDir for memcache
Andrew Deason [Mon, 21 May 2012 23:01:49 +0000 (18:01 -0500)]
afsd: Avoid printing cacheBaseDir for memcache

cacheBaseDir is NULL when memcache is turned on; don't print it.

Reviewed-on: http://gerrit.openafs.org/7443
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 9eb924f16c6f3bb06d83ed281317f2ba29473202)

Change-Id: Ie5dce3a3ae12b2725c90475cd3f6718f9df63134
Reviewed-on: http://gerrit.openafs.org/7500
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agovos: volume lock not released on convertROtoRW error
Mark Vitale [Tue, 8 May 2012 19:03:46 +0000 (15:03 -0400)]
vos: volume lock not released on convertROtoRW error

If an error occurs during convertROtoRW, the volume lock may
not be released.

Reviewed-on: http://gerrit.openafs.org/7389
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 33eff6597facc01bbcd5266fb83c8a6bfa40dfa8)

Change-Id: I0b87fd3b99f178d99f997032c14673def111c1de
Reviewed-on: http://gerrit.openafs.org/7499
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agovos: convertROtoRW does not respect volume lock
Mark Vitale [Tue, 8 May 2012 18:45:16 +0000 (14:45 -0400)]
vos: convertROtoRW does not respect volume lock

vos convertROtoRW was not checking the return code from
ubik_VL_SetLock().

Reviewed-on: http://gerrit.openafs.org/7388
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 38ebd79bafee3c97323aa603906d1d5f279ec450)

Change-Id: I391c5b0d3d385af08eb2aec245f943081c7b84e3
Reviewed-on: http://gerrit.openafs.org/7498
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agovos: convertROtoRW may create two RW volumes
Mark Vitale [Tue, 8 May 2012 14:01:12 +0000 (10:01 -0400)]
vos: convertROtoRW may create two RW volumes

If the RW volume is listed after the RO convert target in the VLDB,
the code failed to detect that an RW is already present and would
create a second RW volume.

Reviewed-on: http://gerrit.openafs.org/7385
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 9a728fd86c7add13e15dfa0d3062fa94cc77c53f)

Change-Id: I7e4eaf0ffefedb3c665e28656a75959eb8677071
Reviewed-on: http://gerrit.openafs.org/7497
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agovos: convertROtoRW misc error reporting problems
Mark Vitale [Tue, 8 May 2012 16:38:38 +0000 (12:38 -0400)]
vos: convertROtoRW misc error reporting problems

Fixes a few inconsistencies and bugs in some error messages.

Reviewed-on: http://gerrit.openafs.org/7387
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit e1c6ad7d580041caf35f698c9b2241fb45f02361)

Change-Id: Icee86e1750920d50b94e29acc5504bd1a2ea9e6e
Reviewed-on: http://gerrit.openafs.org/7496
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agomacos: update AFS prefs pane
Derrick Brashear [Wed, 18 Apr 2012 15:57:10 +0000 (11:57 -0400)]
macos: update AFS prefs pane

modify afshelper to just run what it's told instead
of offering fixed operations. this avoids having a setuid
tool around. in spite of apple's suggestion this is correct,
it's actually more dangerous. instead, elevate privilege only
to run a small set of commands, then drop. allow
unlocking of the prefs pane, but make the menu extra prompt
for authentication when needed.
deactivate controls in the prefs pane when locked.

Reviewed-on: http://gerrit.openafs.org/7196
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 0524e0d1915f519a76d62540b695abc16634d4c9)

Change-Id: Iba4435829a57e91e45b0beea10a8d6573b62a214
Reviewed-on: http://gerrit.openafs.org/7495
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agoDOC: vos convertROtoRW security requirements
Mark Vitale [Wed, 2 May 2012 17:55:16 +0000 (13:55 -0400)]
DOC: vos convertROtoRW security requirements

They were copied from another command; corrected them.

Reviewed-on: http://gerrit.openafs.org/7305
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit a2f523b50592e261fe9cd3ef32978e786011c3c7)

Change-Id: I03101cec5bfd20555e33f639ce2c08cde873d646
Reviewed-on: http://gerrit.openafs.org/7494
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
13 years agodoc: add Windows section to fs newcell
Ken Dreyer [Fri, 16 Mar 2012 19:37:20 +0000 (13:37 -0600)]
doc: add Windows section to fs newcell

fs newcell works slightly differently on Windows. Document the
differences in the man page.

FIXES 125094

Reviewed-on: http://gerrit.openafs.org/6919
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 186158c9eb2379ec350831b8fb244c51ae234a6e)

Change-Id: Ie0daa8631c45eb457c5eb7a1e80a1f70401127d6
Reviewed-on: http://gerrit.openafs.org/7493
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>