Michael Meffie [Wed, 12 Mar 2014 19:15:32 +0000 (15:15 -0400)]
volinfo: separate volscan binary
Refactor vol-info.c into several files and change the makefile to
build a separate volscan binary, instead of using the program name
to determine if the user is running volinfo or volscan.
This commit adds new source files for the volinfo and volscan main()
function and a common header file.
Change-Id: I53a2a503812237a850170c39c81ee3fb56c8282e
Reviewed-on: http://gerrit.openafs.org/10903 Reviewed-by: D Brashear <shadow@your-file-system.com> Tested-by: D Brashear <shadow@your-file-system.com>
Michael Meffie [Sat, 15 Mar 2014 15:04:31 +0000 (11:04 -0400)]
volscan: hide -mask option
The -mask option is unneccessary and sets a bad precedent, so
deprecate and hide this option. The vnodes of interest can be found
can be found easily and much more flexibly with a simple command
pipeline.
Change-Id: Ibe75928c6b041d135c0cb5867228947cd7f4e889
Reviewed-on: http://gerrit.openafs.org/10901 Reviewed-by: D Brashear <shadow@your-file-system.com> Tested-by: D Brashear <shadow@your-file-system.com>
Benjamin Kaduk [Thu, 6 Feb 2014 21:11:49 +0000 (16:11 -0500)]
pioctl.c: removed unused variable
The 'rval' variable is only actually used in the LINUX20 case;
adding another conditional block is making the LINUX20 case
different enough that it should get split out entirely.
Doing so lets the 'else' clause be simpler.
Found by clang on FreeBSD 10.0.
Change-Id: I60c56af355fdb68752d9596ff2cd7a4259b43fe9
Reviewed-on: http://gerrit.openafs.org/10819 Tested-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Reviewed-by: D Brashear <shadow@your-file-system.com>
Michael Meffie [Fri, 7 Feb 2014 14:55:31 +0000 (06:55 -0800)]
fs: display cell not available on ESRCH
The cache manager pioctls abuse ESRCH to represent errors due to
unavailable cell information. Give a more sensible error message to
the user when a pioctl returns an ESRCH error, instead of "no such
process", which is the conventional meaning of ESRCH.
The new error message is consistent with the Windows implementation
of fs.
For example, on a host with a misconfigured ThisCell and/or CellServDB.
Michael Meffie [Sat, 8 Mar 2014 19:30:27 +0000 (14:30 -0500)]
libafs: afs_SetupVolSlot function
Move the code block to get and setup volume slots out of
afs_SetupVolume to a new local function called afs_SetupVolSlot.
This new function acquires the afs_xvolume lock and releases it
before returning.
Michael Meffie [Sat, 8 Mar 2014 17:35:23 +0000 (12:35 -0500)]
libafs: put volume disk cache i/o in afs_UFSGetVolSlot
Move the reading of the volume items file to the afs_UFSGetVolSlot()
to make it more clear the volume items file is not accessed when
memcache is in effect.
This changes the afs_GetVolSlot to return an intialized volume slot,
if one can be gotten.
Michael Meffie [Sat, 8 Mar 2014 16:41:26 +0000 (11:41 -0500)]
libafs: afs_InitVolSlot function
Add a new local function to initialize newly gotten volume slots and
move that code out of afs_SetupVolume(). Initialize the slot before
putting the volume in the volume hash table list.
Make it more clear to avoid using record 0. The volume items record 0 is
not used, so avoid setting the tf pointer to the static fvolume buffer
when reading record 0.
Marc Dionne [Wed, 19 Mar 2014 15:15:13 +0000 (11:15 -0400)]
Linux: Do drop dentry if lookup returns ENOENT
Commit 997f7fce437787a45ae0584beaae43affbd37cce switched to using
d_invalidate instead of d_drop to prevent unhashing dentries
which are only temporarily invalid and may still be referenced
by someone having a current working directory pointing to it.
This could result in getting ENOENT from getcwd() after some
transient problems, even when the directory is there and
accessible.
The change had the side effect of potentially leaving something
visible when it has actually been removed, for instance a mountpoint
removed by "fs rm".
If afs_lookup returns ENOENT, we want to forcibly drop (unhash)
the dentry, even if it has current users.
Jeffrey Altman [Sun, 15 Dec 2013 00:38:50 +0000 (19:38 -0500)]
vos: GetServer search for non-loopback address
GetServer() is used to obtain an IP address for the 'aname' parameter.
'aname' can be either a dotted address or a host name. If it is a dotted
address, it is returned immediately. If it is a host name, then
gethostbyname() is used to obtain an IP address.
The prior version of this function had two failings:
1. It assumed that a struct hostent only contained a single address.
It used the former h_addr field. For all platforms supported by
OpenAFS h_addr is a macro referencing the first address in the
h_addr_list array. If h_addr was a loopback address, it would
ignore any additional addresses that might be in the list.
2. It assumed that if gethostbyname(aname) returned a loopback
address as h_addr that 'aname' must be referring to the machine
that the vos command is being executed on. It therefore used
gethostname() to obtain an alternate name to use for a gethostbyname()
query. The results of this query were not checked to be a loopback.
As a result, a loopback address could be returned to the caller which
in turn could be set into the VLDB.
Change-Id: Ib8d513be9daf650045e9c40718b0187f6b9770a2
Reviewed-on: http://gerrit.openafs.org/10585 Reviewed-by: D Brashear <shadow@your-file-system.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: Harald Barth <haba+gerrit@kth.se> Tested-by: BuildBot <buildbot@rampaginggeek.com>
Michael Meffie [Tue, 11 Mar 2014 16:40:33 +0000 (12:40 -0400)]
libafs: reset global icl set pointers on shutdown
Avoid panicking when an icl tracing function is called after
shutdown_icl.
There is a window during shutdown in which pioctls can be requested
after the shutdown_icl is issued. Reset the global icl set pointers
so tracing is disabled after the shutdown_icl, instead of using
pointers to freed memory.
Removed the unneeded afs_icl_FindSet calls and use the global
pointers which were set during the initialization.
Change-Id: I3310868a28850236a2870b8dab858ecb7a815c11
Reviewed-on: http://gerrit.openafs.org/10884 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: D Brashear <shadow@your-file-system.com>
Benjamin Kaduk [Fri, 14 Mar 2014 15:13:15 +0000 (11:13 -0400)]
libafs: DARWIN: update for Xcode 5.1
(1) remove -mlong-branch from amd64 build
Random internet postings suggest that it has triggered a warning
since at least Xcode 3.2, and the gcc manual page suggests that
it is only applicable on ppc, anyway.
(2) remove -mpreferred-stack-boundary=4 from the amd64 build
The evidence here shows up less readily in an internet search,
but it seems that Apple's compilers will force the stack alignment
to 16 bytes regardless of what is passed here. One poster had
trouble with -mpreferred-stack-boundary being unused in Xcode 4.4.1
This change only fixes warnings reported as errors by buildbot; it
does not attempt to fully synchronize with the flags that Xcode 5.1
uses for kernel module builds.
Benjamin Kaduk [Thu, 13 Mar 2014 19:30:42 +0000 (15:30 -0400)]
Remove static const char copyright[]
We do not have copyright strings in our other executables for the other
copyright statements applicable to them, so these are rather exceptional.
They also cause build failures with OS X Xcode 5.1 and --enable-checking .
Jeffrey Altman [Sat, 15 Mar 2014 16:44:09 +0000 (12:44 -0400)]
Windows: XP do not mark rdr devices as secure
Commit 9174531dca75f1f2d235ed806f784422792c3ab2 introduced the use
of device characteristics (secure and remote) to the IoCreateDevice()
and IoCreateDeviceSecure() calls for the AFSRedirector device objects.
After this change end users began to report problems on 32-bit Windows
XP SP3 when the initial access to the AFS redirector was performed by
a Limited Access Account.
This patchset conditionalizes the specification of the secure device
characteristic when registering the redirector with MUP on 32-bit
Windows XP.
Jeffrey Altman [Wed, 12 Mar 2014 16:41:45 +0000 (12:41 -0400)]
Windows: NP AFSGetConnectionInfo AuthId == 0
During the processing of a network provider GetConnectionInfo request
if the provided Authentication Logon Session Id is zero, the redirector
should attempt to obtain the Logon Session Id in kernel. This was
not performed within AFSGetConnectionInfo().
When processing a network provider GetConnection requestion obtain
the Authentication Logon Session Id earlier in the function so that
it can be logged as part of subsequent trace messages.
Jeffrey Altman [Mon, 10 Feb 2014 10:13:37 +0000 (05:13 -0500)]
Windows: AFSShareWrite do not assign pFcb too soon
In AFSShareWrite the value of pFcb is used to determine whether
or not the pfcb->NPFcb->Resource must be released upon exit.
Therefore, it must not be assigned a value until just before the
resource is acquired.
Commit 54eb2485b59550ba42569ed3a8d76211a3a35019 removed the
implementation of bnode_Deactivate(), which had been #ifdef'd out
for a long time, but left the prototype in place. Remove the
obsolete declaration in bosprototypes.h as well.
Stephan Wiesand [Fri, 7 Mar 2014 10:03:36 +0000 (11:03 +0100)]
doc: improve man pages related to bos restricted mode
Mention the restrictmode entry and the commands for setting and
querying it in the BosConfig man page, and add/fix cross references
between the BosConfig, bos, bos_getrestricted and bos_setrestricted
ones.
Change-Id: I938ef4c43c1a248335f09975c454b36f7570782c
Reviewed-on: http://gerrit.openafs.org/10874 Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com> Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Stephan Wiesand [Thu, 21 Nov 2013 09:44:05 +0000 (10:44 +0100)]
redhat: don't package kpasswd
While kpasswd was in the separate openafs-kpasswd package to avoid
clashing with the krb5 executable, openafs-debuginfo still conflicted
with krb5-debuginfo.
Don't package kpasswd at all. Package the renamed executable, kapasswd,
in openafs-kpasswd instead of openafs, together with the renamed man
page. Once we're here, provide the man page for the other executable in
there too.
FIXES 131771
Change-Id: I0d7af82072847a19f0e1ce34dbeeb34623d2ef38
Reviewed-on: http://gerrit.openafs.org/10481 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com> Reviewed-by: D Brashear <shadow@your-file-system.com>
Garrett Wollman [Fri, 14 Feb 2014 04:03:59 +0000 (23:03 -0500)]
doc: Document dependencies required for building everything
Add a new section to README.DEVEL that describes the packages required
to build everything (including all optional code like the FUSE-based
user-mode client). Start with what I figured out for FreeBSD (tested
on a clean 10.0 install) and what Russ Allbery described on the
openafs-devel list in
<https://lists.openafs.org/pipermail/openafs-devel/2014-February/019759.html>.
Benjamin Kaduk [Wed, 5 Feb 2014 23:32:16 +0000 (18:32 -0500)]
afs_fetchstore: re-avoid uninitialized variable
As noted in the gerrit comments for change 10742, commit baf6af8a8f2207ce39b746d59ca4bc661c002883 does not handle the case
where the second rx_Read() call fails, and the 'length' variable
can still be used uninitialized.
Instead of using an err label and jumping to it on the case of
errors, initialize length to zero and take care to neither
set nor access *alength if an error has occurred. This is
more consistent with the style of the surrounding code while still
avoiding the use of an uninitialized variable.
Benjamin Kaduk [Thu, 6 Feb 2014 22:01:19 +0000 (17:01 -0500)]
FBSD: Switch the dummy 'data' for mount(2)
The mount(2) API takes a void*, but 'rn' is const char*, which
is const-incorrect. Our vfs_cmount implementation ignores the 'data'
parameter, but upstream's kernel mount(2) implementation did
have a NULL check until r158611 (in the 6.1 or 7.0 timeframe),
so leave that comment for now.
Arguably we should be using nmount(2) instead of mount(2) anyway,
but leave that for a separate patch.
Benjamin Kaduk [Thu, 6 Feb 2014 21:22:49 +0000 (16:22 -0500)]
pointers are not castable to unsigned int
When printing a pointer's value for debugging purposes, use the
dedicated printf format specifier for pointers instead of assuming
that unsigned int ('x') is good enough.
Benjamin Kaduk [Thu, 6 Feb 2014 20:52:49 +0000 (15:52 -0500)]
Satisfy clang's aggressive strlcpy warnings
Passing something related to the length of the source as the
length argument to strlcpy triggers a warning, which is converted
to an error with --enable-checking (on FreeBSD 10.0). The current
code is safe, since it is using the same expression that was used
to allocate the destination buffer, but switch to using a separate
variable to hold the length and use that variable for both allocation
and copying, to appease the compiler.
Jeffrey Altman [Thu, 23 Jan 2014 03:17:56 +0000 (22:17 -0500)]
Windows: cm_GetCell_gen Fixup cm_server cellp on race
If a race occurs during the instantiation of a new cm_cell_t object,
the created servers will point at the wrong cm_cell_t object after
the race is detected. Before cm_GetCell_gen completes the cm_server_t
objects must be fixed to point to the correct cm_cell_t.
Jeffrey Altman [Fri, 31 Jan 2014 05:49:44 +0000 (00:49 -0500)]
Windows: cm_AddCellProc always call cm_NewServer
The current implementation of cm_NewServer handles races and
collisions. There is no need to perform a cm_FindServer() check
first. Just call cm_NewServer() for all server entries.
Move the logging of server creation and cell assignment to
cm_NewServer().
Andrew Deason [Fri, 31 Jan 2014 22:46:12 +0000 (16:46 -0600)]
afs: Throttle byte-range locks warnings per-file
Currently, the warning messages about byte-range locks are throttled
only according to what the last PID of the locking process was. So, if
that same process performs a bunch of byte-range locks a bunch of
times, we log this warning message at most once every 2 minutes.
However, if we have even just one other process also performing
byte-range locks, the throttling can become pretty useless as
lastWarnPid ping-pongs back and forth between the two different PIDs.
This can happen if multiple unrelated byte-range-lock-using pieces of
software just happen to be running on the same machine, or if a piece
of software uses byte-range locks after forking into separate
processes.
To avoid flooding the log in situations like this, keep track of the
last warn time in the relevant vcache, so we don't get frequent
warnings for byte-range lock requests on the same file.
Andrew Deason [Fri, 30 Aug 2013 19:21:16 +0000 (14:21 -0500)]
namei: Ignore misplaced files
The namei salvaging/ListViceInodes code currently ignores files where
we cannot derive an inode number from a given filename. However, if a
file is a valid inode filename, but is in the wrong directory, we
still record it. This can cause the salvager to abort, since it
assumes inode e.g. 12345 is present, but when it tries to open 12345,
namei translates the inode to a nonexistant path, and we bail out.
It is unknown how a namei directory structure can reach this state,
but try to handle it. To be on the safe side, just ignore the files,
and log a message about them. That way, if the files are required for
reconstructing the volume or contain important data, they are still
available if needed. And if they contain incorrect or old data, we
don't screw up the volume by trying to use them.
Thanks to Sabah S. Salih for reporting a related issue.
Andrew Deason [Thu, 3 Oct 2013 17:51:41 +0000 (12:51 -0500)]
salvager: Handle multiple/inconsistent linktables
The ListAFSSubDirs code in namei_ops.c currently detects
incorrectly-named linktable files, and whines about them and says the
salvager will handle them. However, the salvager doesn't really handle
them, since we just use the first linktable we find (FindLinkHandle)
without checking any of the information about it.
So, check for these. Fix FindLinkHandle to only consider a linktable
the "real" linktable to use if it actually matches the volume group id
we're salvaging. Also delete any inconsistent linktables via the new
function CheckDupLinktable later on.
Note that inconsistently-named linktables have been known to have been
created in the past due to a bug in the salvager (fixed by ae227049),
and possibly due to other unknown issues.
Change-Id: Iac461e1254e1f73406a2bc74eaa5a5f53d697304
Reviewed-on: http://gerrit.openafs.org/10322 Reviewed-by: Mark Vitale <mvitale@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: D Brashear <shadow@your-file-system.com>
Andrew Deason [Fri, 31 Jan 2014 22:36:44 +0000 (16:36 -0600)]
afs: Refactor DoLockWarning
Change DoLockWarning around a little bit, so subsequent changes are
easier to follow. Move lastWarnTime/lastWarnPid so they are only
usable within this function.
Marc Dionne [Thu, 30 Jan 2014 18:50:37 +0000 (13:50 -0500)]
Linux: When revalidating, don't drop in-use dentries
The Linux client can get into a state where the current working
directory is seen as "deleted" by some tools, while it is still
there and accessible to "ls" and other tools. This has been
reported by several users and sites.
One scenario that has been observed while debugging:
- A process does a chdir() into a directory
- This stores a pointer to the dir's dentry in the task structure
- The server hosting the volume goes offline temporarily
- The dentry for the directory is passed to afs_linux_dentry_revalidate
- afs_linux_dentry_revalidate calls afs_lookup which returns an
error (110 - ETIMEDOUT)
- It then considers the dentry not valid, and calls d_drop()
- d_drop unhashes the dentry unconditionally
- Server comes back up, but dentry is still unhashed
- getcwd() fetches the task structure pointer to the current dir
dentry. If unhashed, it returns ENOENT, and the vfs layer is
not involved at all.
At that point, many things won't work and there is no obvious way
for the user to get the directory rehashed.
Instead of calling d_drop directly, call d_invalidate instead, as
it will only drop (unhash) the dentry if we're the only one holding
a reference. Since d_invalidate will also call shrink_dcache_parent,
also remove that call from our code so it doesn't get called twice.
Arne Wiebalck [Fri, 10 Jan 2014 16:29:11 +0000 (17:29 +0100)]
Log shutdown progress
Shutting down fileservers with thousands of volumes can take a while and
it is helpful for operations to actually see that there is progress when
detaching volumes. This patch adds a log message to the fileserver log
every time 100 volumes have been detached.
Andrew Deason [Thu, 30 Jan 2014 20:43:57 +0000 (14:43 -0600)]
afs: Pay attention to fetchOps->destroy error code
The ->destroy function in our fetchops could change our error code, or
even raise a new error. Don't ignore it. This currently doesn't do
much, since fetchDestroy currently won't change the error code if it's
given an error, but this can change in the future.
Jeffrey Altman [Mon, 27 Jan 2014 05:30:20 +0000 (00:30 -0500)]
Windows: cm_GetAddrsU wrapper for VL_GetAddrsU
cm_GetAddrsU() is a wrapper for the VL_GetAddrsU() RPC. The initial
version is a bare bones replacement for the VL_GetAddrsU() call from
cm_UpdateVolumeLocation(). Future changes will add caching.
Jeffrey Altman [Mon, 27 Jan 2014 05:14:36 +0000 (00:14 -0500)]
Windows: replace cm_allServersp list with osi_queue
Replace the cm_allServersp list with an osi_queue. This simplifies
the Add/Remove functionality which will be required in case of VLDB
server uniquifier changes.
Andrew Deason [Tue, 28 Jan 2014 00:03:59 +0000 (18:03 -0600)]
afs: Translate VNOSERVICE to ETIMEDOUT
Some fileservers will kill calls that are taking too long with the
VNOSERVICE abort code. Our logic for retrying calls is already aware
of this usage, but if we cannot retry the call, we still just return
VNOSERVICE as an error code to our caller.
Don't return this raw, since has the same value as ENOBUFS, which can
cause a confusing error message from logs or applications ("No buffer
space available"). Return ETIMEDOUT instead.
Andrew Deason [Thu, 26 Dec 2013 22:17:44 +0000 (17:17 -0500)]
afs: Fix afs_CheckCode identifier collision
The last argument to afs_CheckCode should be unique so the call site
can be identified if fstrace is turned on. BStore and BPartialStore
were both using 43, so change BPartialStore to 430 to avoid the
collision.
Change-Id: I81a43ee41623fad10d0e70a7d9c8e6029aba30eb
Reviewed-on: http://gerrit.openafs.org/10635 Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Tested-by: BuildBot <buildbot@rampaginggeek.com>
Andrew Deason [Thu, 26 Dec 2013 21:42:46 +0000 (16:42 -0500)]
afs: Treat vc_error as a CheckCode-translated code
The vcache field vc_error is generally treated as an error code that
has been translated through afs_CheckCode, but this is inconsistent in
a few places. Fix this in a few ways:
- Adjust afs_nfsrdwr so we do not call afs_CheckCode on vc_error,
translating the error code twice.
- Change afs_close to store vc_error in code_checkcode, and have the
logging code check for specific values in code_checkcode as well.
Log unknown values of code and code_checkcode, so we can
distinguish between e.g. a 'code' value of VBUSY, and a
'code_checkcode' value of ETIMEDOUT.
Michael Meffie [Sun, 19 Jan 2014 03:01:59 +0000 (22:01 -0500)]
libadmin: makefile rule for afs_AdminError.h
Add a makefile rule to export the libadmin afs_AdminErrors.h header
file, instead of exporting afs_AdminErrors.h as a side effect of
generating the afs_AdminBosErrors error table.
Add the missing afs_AdminErrors.h dependency to the afs_utilAdmin.o
dependency list.
Michael Meffie [Fri, 22 Nov 2013 17:23:17 +0000 (12:23 -0500)]
config: parallel-safe param.h makefile rule
Generate the param.h.new temporary file in a parallel-safe
way. The rule to generate the three copies of param.h can
run at the the same time under a parallel make, clobbering
the param.h.new temporary file. Instead of creating this file
inline, create a common rule to generate the temporary file
once.
Michael Meffie [Fri, 22 Nov 2013 16:50:11 +0000 (11:50 -0500)]
libafscp: makefile install rule update
Change the makefile install rules to install the header
file from the libafscp directory, and not the top level
include directory to make the install rules consistent
with the rest of the tree.
Michael Meffie [Wed, 1 Aug 2012 21:26:33 +0000 (17:26 -0400)]
comerr: compile_et -emit option for parallel make
Add the -emit option to the compile_et command to support parallel make.
The -emit option allows make to generate the header and the source files
independently, instead of building two files at the some time. This
avoids the issue where one command creates two separate files, which is
difficult to handle correctly for parallel makes.
Change-Id: Ib44a8e358643cf19b4834b3bd4d5b88db6cd0ccf
Reviewed-on: http://gerrit.openafs.org/7921 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Benjamin Kaduk [Fri, 24 Jan 2014 17:00:20 +0000 (12:00 -0500)]
FBSD: catch up to 1997 and include if_var.h with if.h
The commit message for upstream's r257244 change includes:
- Make the prophecy from 1997 happen and remove if_var.h inclusion
from if.h.
Despite the clear public posting, we were caught unawares. We made
it down to the cellar despite the missing stairs, but "Beware of
the Leopard" caused us to turn back, apparently.
Since if.h is included in many places and if_var.h is not present
on all OSes, pull the if.h inclusion into the common kernel headers
for afs/ and rx/ , and add in if_var.h (as well as the sys/socket.h
prerequisite).
Andrew Deason [Fri, 20 Dec 2013 18:16:37 +0000 (12:16 -0600)]
afs: Return raw code from background daemons
Currently, a background daemon processing a 'store' request will
return any error code in the 'code' field in the brequest structure,
for processing by anyone that's waiting for the response. Since any
waiter will not have access to the treq for the request, they won't be
able to call afs_CheckCode on that return code, so the background
daemon calls afs_CheckCode before returning its error code.
Currently, afs_close uses the 'code' value from the background daemon
as if it were not passed through afs_CheckCode. That is, if all
background daemons are busy, we get our 'code' directly from
afs_StoreOnLastReference, and if we use a background daemon, our
'code' is tb->code. But these values are two different things: the
return value from afs_StoreOnLastReference is a raw error code, and
the code from the background daemon (tb->code) has been translated
through afs_CheckCode.
This can be confusing, in particular for the scenario where a
StoreData fails because of network errors or because of a VBUSY error.
If we get a network error when the request went through a background
daemon, afs_CheckCode will translate this to ETIMEDOUT, which is
commonly value 110, the same as VBUSY. So, an ETIMEDOUT error from the
background daemon is difficult to distinguish from a VBUSY error from
a direct afs_StoreOnLastReference call. Either case can result in a
message to the kernel like the following:
afs: failed to store file (110)
To resolve this, have the background daemon store both the 'raw' error
code, and the error code that has been translated through
afs_CheckCode. afs_close can then use the raw error code when
reporting messages like normal, but can still use the translated error
code to return to the caller, if it has a translated error. With this
change, now afs_close will always log "network problems" for a network
error, regardless of if the error came in via a background daemon or a
direct afs_StoreOnLastReference call.
In Irix's afs_delmap, we just remove the old usage of tb->code, since
the result was not used for anything.
Benjamin Kaduk [Fri, 10 Jan 2014 04:34:30 +0000 (23:34 -0500)]
Remove some explicit sbrk() usage
Mac OS X 10.9 now considers this function deprecated and warns on
its use, causing the buildslave configuration to error out.
Use the library routine to get a process's size instead of inlining
the call to sbrk (which is unlikely to have worked as intended for
quite some time -- most malloc implementations in use do not use
sbrk to get their storage).
The fileserver-side "NAT ping" behavior has yet to be proven to be
helpful in situations with NATs. If the behavior is not helpful, this
generates potentially a significant amount of extra useless traffic.
So until it can be shown to what degree this is helpful, keep this
behavior out of the fileserver.
Benjamin Kaduk [Fri, 10 Jan 2014 05:00:52 +0000 (00:00 -0500)]
Use an explicit symbol for uninitialized vnode types
Avoid trying to get clever with stuffing -1 into an unsigned bitfield,
which causes the value to change and generates a warning from clang.
Just use vNull, which is intended to be used for uninitialized/empty
vnodes.
Benjamin Kaduk [Fri, 10 Jan 2014 04:54:45 +0000 (23:54 -0500)]
Disable deprecated warnings for krb5 routines
In OS X 10.9 Mavericks, Apple has marked all of the krb5 routines
as deprecated (in favor of the GSS framework). We must disable
these warnings in order to allow the buildslave to have a successful
build.
Luckily, Apple has left in rope for us to programmatically disable
the deprecated attribute with a preprocessor macro. Defining this
macro should be safe everywhere, so do so unconditionally.
Benjamin Kaduk [Fri, 10 Jan 2014 04:38:36 +0000 (23:38 -0500)]
viced/callback.c: Ignore dump write errors even harder
Not only do we need to check the return value of write(2), but
we also need to do so in a way that does not leave an empty body
in the if statement, in order to appease the clang-500.2.79 found
on OS X 10.9 with Xcode 5.0.2.
Benjamin Kaduk [Fri, 10 Jan 2014 03:42:26 +0000 (22:42 -0500)]
afs_fetchstore: avoid use of uninitialized variable
rxfs_fetchInit() attempts to do a 64-bit RPC first, but falls back
to the 32-bit StartRXAFS_FetchData() if the server appears to not
support the 64-bit RPCs.
We correctly did not read a length from the call if the FetchData
RPC(s) failed, but proceeded to assign from the 'length' local
variable into the 'alength' output variable unconditionally later on.
Instead of blindly continuing on, jump to the error-handling part of
the routine when we cannot read a length from the call. This has the
side effect of skipping an afs_Trace3() point in the error case.
Benjamin Kaduk [Thu, 9 Jan 2014 22:29:04 +0000 (17:29 -0500)]
rfc3961: Use enctypes, not keytypes
We previously defined the enctype symbols to be aliases for keytype
symbols. The numerical values matched what we wanted (since these
values are specified in an IANA registry), but the C type is not
required to be the same for enctypes and keytypes.
Some of our buildslave configurations notice the type mismatch and
complain, so fix the types by using the enctype enum for enctype symbols
instead of keytypes.
Andrew Deason [Thu, 9 Jan 2014 18:44:44 +0000 (12:44 -0600)]
opr: Silence rbtree warning
On OS X, gcc can complain that 'child' is uninitialized whenever this
'else if' condition is false. We already handled the case where both
node->right and node->left are non-NULL earlier in this function, so
this should never occur. So, to get rid of the warning, just always
take the path in the 'else if', and assert that the right child is
NULL.
Benjamin Kaduk [Mon, 13 Jan 2014 21:08:14 +0000 (16:08 -0500)]
De-duplicate a couple afs_CheckCode uniquifiers
These uniquifiers are supposed to be globally unique, to identify the
call site within the tree. For whatever reason, a couple of them
were duplicated at different call sites; provide new (unique) values
to disambiguate between them.
There remain a couple of uniquifiers which are used in multiple
places, but those are in different architectures' implementations
of afs/ARCH/foo.c, and thus will be globally unique for any particular
build.
Michael Meffie [Mon, 13 Jan 2014 20:28:17 +0000 (15:28 -0500)]
xstat: use ephemeral ports for xstat_fs_test and scout
Instead of trying to bind to port 7101, and then retrying if
the port is in already in use, let the os find an available
port for scout and xstat_fs_test.
This fixes a bug where scout and xstat_fs_test do not call
rx_Finalize() before retrying rx_Init() with a different port
number, causing the program to crash later when more than
one copy of xstat_fs_test and/or scout are running at the same
time.
Marc Dionne [Tue, 3 Dec 2013 19:10:00 +0000 (14:10 -0500)]
Linux 3.13: Check return value from bdi_init
The use of the bdi_init function now gets a warning because the
return value is unused and the function is now defined with
the warn_unused_result attribute.