Several functions in src/auth/userok.c construct pathnames in fixed
size buffers on their stacks. Those buffers are simultaneously too
small for the purpose for which they are used and too large to be
placed on the stack. This change replaces these fixed-size buffers
with dynamically-allocated buffers which are either exactly the right
size (due to asprintf) or have size AFSDIR_PATH_MAX.
When writing a callback state dump, test the return values from
write(2), but don't do anything based on the test. This avoids
compiler warnings when building on Ubuntu 12.10, with gcc 4.7.2 and
eglibc 2.15-0ubuntu20.1. This adds a new macro, WriteBytes(), which
handles writing a requested number of bytes to a file and ignoring
errors.
Fix potential buffer overflows caused by misuse of the scanf function
in the fileserver and ptserver.
Also fix similar issues in the client side fs command and libadmin
library.
Change-Id: Ia6a46981c50537da1673507c2bc777f96e43f95a
(This change was applied to the 1.6 branch as a security fix for 1.6.2 as
commit d1855f8e04; this commit brings the fix into master.)
Reviewed-on: http://gerrit.openafs.org/9962 Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Jeffrey Altman [Sat, 25 May 2013 21:05:10 +0000 (17:05 -0400)]
rx: test for active calls in rxi_ChallengeEvent
The challenge event fires when an outstanding challenge request
has not been responded to. If there are no calls in the ACTIVE or PRECALL
state on the connection when the challenge event fires do not re-issue the
challenge. Clients do not respond to challenges when there are no active
calls.
Make the version string used in AFSVersion and cml_version_number
include the names of the user doing the build and the host on which
it is done. Also, remove extraneous whitespace and the content-free
word 'built' from cml_version_string, since Rx debug packages provide
space for only 64 characters of version string.
Change-Id: I128f6c175bb93b1fb5a4d531f64aa81bd2841ce7
Reviewed-on: http://gerrit.openafs.org/2279 Reviewed-by: Mark Vitale <mvitale@sinenomine.net> Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Jeffrey Altman [Sat, 1 Jun 2013 04:48:51 +0000 (00:48 -0400)]
Windows: Protect against cm_GetVolServerList failures
In cm_Analyze, if cm_GetVolServerList() fails volServerpp will be
NULL which will trigger an exception if passed to either
cm_SetServerBusyStatus or cm_ResetServerBusyStatus.
Marc Dionne [Wed, 3 Apr 2013 20:09:53 +0000 (16:09 -0400)]
tests: Improve afstest_UnlinkTestConfig cleanup
Make afstest_UnlinkTestConfig clean up and remove the specified
directory regardless of which files are present. This means
the function no longer has to track the current state of which
files may be present as tests are added and modified.
A sanity check is added to prevent damage in case the function is
called for an inappropriate directory.
As before, no cleaning is done if the test is run outside of a
"make check".
Marc Dionne [Wed, 22 May 2013 13:26:57 +0000 (09:26 -0400)]
Linux: Fix tmpfs cache support
As of kernel 3.1, tmpfs no longer has a readpage() operation in its
address space operations. Some of the cache manager code relies on
this, causing an oops if tmpfs is used as backing store for the
cache.
As a minimal fix, detect that there is no readpage() and disable
the optimizations that depend on it.
Jeffrey Altman [Mon, 13 May 2013 10:45:34 +0000 (06:45 -0400)]
vol: return VNOVNODE if vnode is not allocated
If a request for a vnode fails because the vnode is not allocated
within the volume, the error returned to the client should be VNOVNODE to
indicate that the requested FID does not exist and not VIO indicating a
transient disk i/o error or other transient internal inconsistency.
Simon Wilkinson [Sat, 11 May 2013 19:20:38 +0000 (20:20 +0100)]
Sort all libtool symbol lists
The original plan for the libtool symbol lists was that they be in
alphabetical order. This should make them easier to maintain, as it
becomes harder to accidentaly introduce duplicates, and makes merge
conflicts when adding new symbols less likely.
However, not all of them are properly sorted. Update the ones that
aren't. This was done with
for A in `find . -name *.la.sym`; do sort $A -o $A; done
Marc Dionne [Wed, 6 Mar 2013 00:38:34 +0000 (19:38 -0500)]
libafs: fix Afs_syscall definition for UKERNEL
For the UKERNEL case, Afs_syscall is prototyped and used as (void).
Make the function definition use the void keyword to avoid a warning
about an old style definition.
Remove the uafs_klog() apis from afs_usrops. Nothing uses it except
the obsolete afsweb stuff that isn't built anymore.
Stop linking in all kauth and pts components. Also remove some other
objects from libauth, rxkad, and com_err, that were only present as
dependencies of kauth and pts components
Marc Dionne [Sat, 25 May 2013 14:43:45 +0000 (10:43 -0400)]
volser: Adjust TLV tag range
Tag values up to D_MAX cannot be used as TLV tags, as the parsing
logic assumes anything up to D_MAX is a control tag. Adjust
MIN_TLV_TAG to 21 so that the TLV range sits just above D_MAX.
Dan van der Ster [Fri, 24 May 2013 08:12:14 +0000 (10:12 +0200)]
linux: remove linux osi_alloc hash stats
The bucket stat vector is maintained but never read. And it is
occasionally annoying since it can flood messages with
"afs_get_hash_stats: Warning! exceeded max bucket len ..."
Remove it.
Jeffrey Altman [Thu, 23 May 2013 20:57:21 +0000 (16:57 -0400)]
Windows: Return bytes_read count from cm_GetData
The existing interface for cm_GetData takes an input buffer and
a buffer size and no method by which the number of bytes read into
the buffer can be returned. Add an output parameter to permit it.
Andrew Deason [Mon, 13 May 2013 20:33:42 +0000 (15:33 -0500)]
DAFS: Avoid useless attach2 error message
Since commit 53230846a202a50f6c3a61b38d62ccba8876f89d, attach2 logs an
error when we force a volume to an error state due to attachment
errors. This is to ensure that we never end up with a volume in an
error state without logging a message about it.
However, while this is useful for the fileserver, for non-fileserver
programs this situation is very common for VNOVOL errors and does not
represent an actual problem. For the fileserver, nonexistent volumes
should be caught before we hit attach2 (in e.g. GetVolume when we
can't find a volume structure), so errors here can be significant and
should be rare. But for e.g. the volserver, when we try to use a given
volume id, we just try to attach it directly, so if the volume doesn't
exist, we will hit this code path.
This can happen pretty often for the volserver, since many volume
operations try to determine if a volume already exists by trying to
attach it. In those cases, this error message is pretty much useless
noise. So, get rid of it if we are non-fileserver, and the error we
got is VNOVOL. It is not as important for non-fileserver that we put a
volume in an error state, since volume states are much more transient
for non-fileserver programs, since the volume structs don't stay
around very long.
Michael Meffie [Mon, 13 May 2013 17:59:50 +0000 (13:59 -0400)]
vldb_check: print vlentry file offsets
To aid in debugging, consistently print the vlentry database "address"
and the file offset when displaying errors for vlentries. Print the
vlentry file offsets when printing all the entries with the -entries
option.
Marc Dionne [Wed, 24 Apr 2013 13:11:09 +0000 (09:11 -0400)]
linux: Fix leaked dentry reference in the revalidate op
In one error case, we exit the function without release the
reference on the parent dentry. This dangling reference can cause
an oops when the client is shut down.
Jeffrey Altman [Mon, 13 May 2013 14:09:11 +0000 (10:09 -0400)]
Windows: NotifyHardLink avoid null ptr reference
In AFSNotifyHardLink, if the TargetDirectoryCB out parameter is non-NULL
but pDirNode is NULL, do not attempt to increment the
DirOpenReferenceCount because doing so will trigger an exception.
Anders Kaseorg [Tue, 7 May 2013 04:27:33 +0000 (00:27 -0400)]
Linux: osi_TryEvictVCache: Don’t skip the first dentry if D_ALIAS_IS_HLIST
An hlist doesn’t begin with a sentinel like a list does, so the old
code would skip the first dentry or crash with a NULL dereference if
there wasn’t one. Use the kernel’s list_for_each_entry or
hlist_for_each_entry macros instead of trying to do it manually.
Should fix a crash observed by Alex Chernyakhovsky on kernel 3.6 and
newer.
Change-Id: I6d7bd190013a0250ca896af8d5182df55a3376b0 Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/9857 Reviewed-by: Alex Chernyakhovsky <achernya@mit.edu> Tested-by: Alex Chernyakhovsky <achernya@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
it's claimed these are not initialized before use.
squelch compiler errors. has to be in parent as otherwise
we will zero them in our loop where we potentially want the
parent group id, which is not on "this" line as we add members.
A crash dump was examined which showed a deadlock due to the leak
of a SectionObjectResource in a code path in which the holding thread
could not have obtained it. The FileObject->FsContext2 (Ccb) pointer
referred to invalid memory which may have been due to pool corruption.
The only code path in which the SectionObjectResource is held exclusive
and then the Ccb pointer is used outside of a try-except block is in
AFSCleanup(). Move this reference inside the try-except block just in
case. If the Ccb is invalid, at least this way AFSRedirLib will catch
the exception and free the SectionObjectResource before continuing.
Change-Id: I08c9baacfc8897ae8d8b551a74976daf7effbcef
Reviewed-on: http://gerrit.openafs.org/9892 Reviewed-by: Peter Scott <pscott@kerneldrivers.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Jeffrey Altman [Thu, 9 May 2013 22:28:09 +0000 (18:28 -0400)]
Windows: AFSCommonWrite do not leak SectionObjectResource
If the write request is neither an extending write nor a non-cached
write and (liStartingByte.QuadPart + ulByteCount) >=
pFcb->Header.FileSize.QuadPart, then the SectionObjectResource pointer
will be leaked. Instead release it before retrying.
Change-Id: Id1ea7a3829a6e2be19280f366e665a11e14fba62
Reviewed-on: http://gerrit.openafs.org/9888 Reviewed-by: Peter Scott <pscott@kerneldrivers.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Marc Dionne [Thu, 9 May 2013 16:30:39 +0000 (12:30 -0400)]
ubik: Avoid use of freed string
If cellName was just set to dir->cellName, afsconf_Close() will
free the string before fprintf uses it. Just change the order
so we don't access freed memory and print garbage.
Jeffrey Altman [Wed, 8 May 2013 17:08:30 +0000 (13:08 -0400)]
Windows: only retry ALLBUSY for five minutes
Add a volbusyCount field to cm_req_t. Increment the count each time
CM_ERROR_ALLBUSY is processed by cm_Analyze for a given request.
Wait 15 seconds between retries and retry up to 20 times and then
fail. This prevents requests from blocking for a volume that isn't
going to come back online for hours.
Ben Kaduk [Thu, 28 Mar 2013 21:10:29 +0000 (17:10 -0400)]
FreeBSD: VOP_MMAP has been dead since 1996
Clang complains that our (K&R!) declaration of struct vop_mmap_args
will only be visible within the (empty) function.
With the kernel's CFLAGS, though, this is fatal.
Remove the dead code.
Jeffrey Altman [Mon, 6 May 2013 19:12:54 +0000 (15:12 -0400)]
Windows: AFSLibExFreePool*() macros
Introduce the AFSLibExFreePool() and AFSLibExFreePoolWithTag() macros
which simply call ExFreePool() and ExFreePoolWithTag().
The prefix AFSLib indicates that memory allocated by
AFSLibExAllocatePoolWithTag() must be freed before unloading.
AFSExFreePool*() cannot be used because that is a pointer to a
function provided by AFSRedir.sys which may not be assigned when
memory must be freed.
The only time that ExFreePool() should be used is if the memory was
allocated by a system function.
Jeffrey Altman [Mon, 6 May 2013 19:05:10 +0000 (15:05 -0400)]
Windows: Use AFSLibExAllocatePool for library local
If the memory allocation is for an object that must be freed before
the afsredirlib.sys driver unloads, use the AFSLibExAllocatePoolWithTag
interface. AFSExAllocatePoolWithTag allocates the memory from
afsredir.sys which prevents Verifier from being used to detect leaks.
Jeffrey Altman [Tue, 7 May 2013 22:36:16 +0000 (18:36 -0400)]
Windows: RDR_Initialize must cleanup threads on failure
If RDR_Initialize() fails after instantiating the worker thread
pool it must call RDR_ShutdownFinal() to destroy the pool before
exiting. Otherwise, the threads will spin endlessly as each
DeviceIoControl call to the redirector fails.
Jeffrey Altman [Mon, 4 Mar 2013 04:10:51 +0000 (23:10 -0500)]
Windows: CreateFile Reparse Point to File as File
Apply the Reparse Point to File as File Policy to CreateFile. If the
FILE_OPEN_REPARSE_POINT flag is specified to the CreateFile operation
and AFSIgnoreReparsePointToFile() returns TRUE, evaluate the target
object (if possible) and if the object is a FILE, then ignore the
FILE_OPEN_REPARSE_POINT flag. Otherwise, re-evaluate the request to
attempt to open a reparse point if it exists.
AFSIgnoreReparsePointToFile() is a helper routine that uses the
global reparse point policy to decide whether or not a reparse point
whose target is a file should be reported to applications as a file.
When per-AuthGroup or per-Process policy is supported, this function
should be modified.
pete scott [Wed, 27 Feb 2013 15:51:44 +0000 (08:51 -0700)]
Windows: IOCTL_AFS_SET_REPARSE_POLICY
IOCTL_AFS_SET_REPARSE_POLICY is a new ioctl that can be executed
by anyone to alter the behavior of AFS Symlink-to-File reparse point
processing. Policy can be set for a global default or for the active
authentication group. If the AFS_REPARSE_POINT_TO_FILE_AS_FILE policy is
active, afs symlinks will not be reported as reparse points if the symlink
target is known to be a file.
This patchset implements the ioctl but not the "reparse point to file as
file" functionality. Per authgroup policy setting is not permitted by the
ioctl but is not supported at this time.
Jeffrey Altman [Sat, 4 May 2013 15:56:30 +0000 (11:56 -0400)]
Windows: Report Case Sensitive Search
Return the FILE_CASE_SENSITIVE_SEARCH volume flag as part of afs
volume properties. NTFS does and our search algorithm is case
sensitive first, then case insensitive.
Jeffrey Altman [Fri, 3 May 2013 15:23:31 +0000 (11:23 -0400)]
Windows: Introduce CM_CONN_FLAG_NEW
The new CM_CONN_FLAG_NEW flag is set on the cm_conn object whenever
a new rx_connection has been created. The flag is cleared in cm_Analyze
if the call succeeded or if the error is one that is generated as a
result of communicating with the peer. If no communication with the
peer has taken place the connection is considered "new".
For errors that would result in forcing a new connection, check whether
the existing connection is already "new". This avoids an extra
RX_CALL_DEAD timeout period in the case where a "new" connection was
already in use.
if you are rebuilding from pt_util, data sanitization should
not randomly chown and/or rename your groups. likewise,
an admin should have the ability to do this.
Ken Dreyer [Wed, 1 May 2013 03:59:32 +0000 (21:59 -0600)]
doc: quote list items in POD
Recent versions of Pod::Simple complain if we use integers or other
special characters in an =item list. We have a couple bulleted lists
that happen to have integers or other special characters as the list
values. Quote the items with C<> so that Pod::Simple can correctly parse
them again.
Michael Meffie [Tue, 30 Apr 2013 15:30:15 +0000 (11:30 -0400)]
pt_util: fix group line check for input files
Fix the check for requiring group lines before any membership lines. Do
not clear flag indicating the presence of a group after reading each
line. (This error was caught by the pt_util-t unit test.)
Michael Meffie [Tue, 30 Apr 2013 19:38:24 +0000 (15:38 -0400)]
tests: make a plan for man page checks
Split the man page check routine into two routines; one to get the list
of sub-commands for a command, and another to verify a man page exists
for each sub-command. Use the list of sub-commands to set up the
Test::More plan before running the tests.
Setting the plan before running the tests allows the the man page tests
to run on systems which ship older versions the Test::More module.
Andrew Deason [Tue, 30 Apr 2013 19:37:54 +0000 (14:37 -0500)]
afs: Do not invalidate all dcaches on startup
Commit 20b0c65a289e2b55fb6922c8f60e873f1f4c6f97 changed
afs_UFSGetDSlot to always treat a dslot entry as invalid if
'datavalid' was 0. This was to force the invalidation of the given
dslot if we were reading in a dslot from the free or discard list,
since the data in that dslot is not valid.
However, 'datavalid' is also 0 when we read in dcache entries from
disk on startup. So, this means that we invalidated all cache entries
when the client started up, effectively making our persistent cache
worthless.
Fix this by only forcing this invalidation when we are reading from a
free or discarded dcache, and not during the initial cache scan. That
is, when 'indexvalid' is 1, and 'datavalid' is 0.
The parameters for these Get*DSlot variants should maybe be changed to
be a little more clear, but for now, this is a targeted fix for this
specific issue.
Windows: pSrcObject instead of pSrcFcb->ObjectInformation
In AFSSetFileLinkInfo and AFSSetRenameInfo consistently use the
variable pSrcObject instead of pSrcFcb->ObjectInformation. pSrcObject
is a local alias. Mixing both forms in the same function is confusing.
pCurrentObject is supposed to be an alias for pDirEntry->ObjectInformation
but it was not always being updated when pDirEntry was replaced. As a
result several tests were being performed incorrectly and the wrong data
was being logged.
Windows: AFSExamineVolume drop TreeLock if waiters
After each call to AFSExamineObject drop the ObjectInfoTree.TreeLock
if there are threads waiting for access. The garbage collection process
should not delay real work.
Each time the ObjectInformationCB object is looked up
from the ObjectInfoTree the LastAccessCount field should be updated
except in cases of invalidation, garbage collection, and extent
processing. This is particularly important when an ObjectInfoCB
is attached to DirectoryCB in AFSInitDirEntry and when constructing
directory snapshots or validating directory content.
Windows: AFSFindObjectInfo update last access time
Add a boolean parameter to AFSFindObjectInfo() which is used
to indicate whether or not the last access time for the found
ObjectInfoCB should be updated.
Set the new parameter in all calls to AFSFindObjectInfo().
In AFSInvalidateVolume a reference count is obtained in order to
ensure that the object is valid throughout the invalidation request.
Although the refcnt is obtained while holding the TreeLock the refcnt
was not released while holding the TreeLock which could open the door
for another thread to race.
In AFSInitDirEntry the pattern was to find or allocate an
ObjectInfoCB then destroy it if the DirectoryCB creation fails
for some reason. The problem with this approach is that once the
VolumeCB ObjectInfoTree.TreeLock is dropped the ObjectInfoCB is findable.
That means that the contents of the ObjectInfoCB must be valid.
This patchset makes three changes. First, in the case where the
ObjectInfoCB is allocated, the fields of the ObjectInfoCB are populated
from the DirEnumEntry before the TreeLock is dropped. Second, if the
DirectoryCB allocation fails the ObjectInfoCB is not deleted. It is
perfectly valid and can be used by a subsequent AFSInitDirEntry call.
Perhaps one that is racing with this thread. It will eventually be
cleaned up by the AFSPrimaryVolumeWorkerThread. Finally, when the
ObjectInfoCB reference count is decremented the TreeLock is held shared in
order to prevent races with other threads that might be incrementing it
themselves.
The CM_VOLUMEFLAG_RO_SIZE_VALID flag was being reset using the
wrong field which resulted in the flag never being cleared and
the correct volume size not being reported.
Windows: fail if pSrcParentObject cannot be resolved
In AFSSetFileLinkInfo and AFSSetRenameInfo return STATUS_INVALID_PARAMETER
if pSrcParentObject cannot be determined. Otherwise, a NULL pointer
dereference will occur.
Change-Id: I0e265433aa85066005e90b3584f8e865c5be79c8
Reviewed-on: http://gerrit.openafs.org/9807 Reviewed-by: Peter Scott <pscott@kerneldrivers.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Windows: SetFileRenameInfo Do not replace pSrcParentObject
If pSrcParentObject is replaced by pTargetParentObject then the
reference count obtained by the AFSFindObjectInfo() call at the
start of AFSFileRenameInfo will be released on the wrong object.
This will result in a reference leak on pSrcParentObject and an
undercount on pTargetParentObject. pTargetParentObject can then
be garbage collected while it is in use.
Change-Id: Id10db257afbd4996a31eb98ad7eca69343297274
Reviewed-on: http://gerrit.openafs.org/9806 Reviewed-by: Peter Scott <pscott@kerneldrivers.com> Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Andrew Deason [Wed, 17 Apr 2013 23:04:58 +0000 (18:04 -0500)]
LINUX: Sometimes let dentry_open handle refcounts
When Linux changed dentry_open to use a 'path' argument, they also
changed it so dentry_open handles incrementing the relevant ref
counts. So now, sometimes we need to inc the dentry and vfsmount
refcounts ourselves, and sometimes we need to leave them alone.
To accommodate this, change afs_dentry_open to also handle refcounting
itself, and 'get' the given dentry and vfsmount if necessary.
Also note that currently, afs_linux_raw_open can call afs_dentry_open
twice in the case of an error, but it does not dget(dp). This means
that dp could be undercounted, since dentry_open on older kernels will
dec the refcount on the given dentry in the case of an error. This
change should also fix this so dp is not undercounted in that case.
FIXES 131613
Change-Id: I0e9deb7ce57633ff65b76d2444a0416ecbe329fd
Reviewed-on: http://gerrit.openafs.org/9801 Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Andrew Deason <adeason@sinenomine.net>
dentry_open, at least on older kernels, decs the refcount on its
arguments in the case of an error. So calling mntget for each
dentry_open invocation actually is the correct thing to do.
This code may need to be further fixed in order to work for newer
kernels, but for now, at least put it back the way it was so we don't
undercount ref counts on older kernels.
Windows: RDR_DeleteFileEntry test for empty directory
RDR_DeleteFileEntry should check to see that a directory entry
that is a directory is in fact empty. The most frequent use of
RDR_DeleteFileEntry is to check whether the object can be deleted
prior to setting the DeletePending state which in turn results in
the object being deleted during Cleanup. If the directory is not
empty during Cleanup it is too late for the error to be seen by
the application.
If the file server is asked to remove a directory that is not empty
one might expect it to return UAENOTEMPTY but instead it returns UAEEXIST.
The error translation function cm_MapRPCErrorRmdir did not include
EEXIST in the list of errors that convert to CM_ERROR_NOTEMPTY.
Prior to IBM AFS 3.5 the file server did return ENOTEMPTY and if a
particular platform did not define ENOTEMPTY, ENOTEMPTY was defined to
be EEXIST. To late to change things back now.
Andrew Deason [Fri, 29 Mar 2013 18:40:41 +0000 (13:40 -0500)]
Make ihandle sync behavior runtime-configurable
The actual behavior of FDH_SYNC has changed a bit over the years, and
some people want one behavior, and some want another. Make it possible
to make this choice at runtime with the new -sync option, instead of
making this decision by running with different patches.
Note that FDH_SYNC is not a macro anymore, nor is it an inline
function. While it could be a macro, it would look a bit complex, and
there are some oddities with trying to use vol_io_params inside the
FDH_SYNC expansion (vol_io_params is not declared for LWP, for
example). And having it be an inline function causes problems with
some odd linking dependencies. For example, vlib.a contains volume.o,
but does not contain a definition for DFlushVolume (dir/buffer.c),
which is referenced in volume.o. 'vos' uses vlib.a, but does not
bring in anything that defines DFlushVolume. Currently this appears to
not cause a problem because 'vos' uses nothing from volume.o, so the
dependencies of volume.o don't matter. Adding an inline FDH_SYNC for
platforms that don't support 'static inline' would add a dependency to
volume.o (via vol_io_params), which causes an error for the lack of a
DFlushVolume.
Those are possibly just some problems, and may not be all. So instead,
make it so we don't have to deal with that and just have a normal
function. While FDH_SYNC may be called in a performance-critical
section, the overhead of a real function call is nowhere near the
delay of an actual fsync(), so presumably any overhead doesn't matter.
Andrew Deason [Wed, 17 Apr 2013 06:33:07 +0000 (01:33 -0500)]
LINUX: Avoid duplicate mntget in afs_linux_raw_open
In the unlikely event that our afs_dentry_open call fails with
cache_creds, we call afs_dentry_open again with the current creds as a
fallback. However, we call mntget on afs_cacheMnt for each call. So if
we actually hit the second call, we'll have added 2 refs to
afs_cacheMnt, but we only actually opened one file, causing a slight
overcount on afs_cacheMnt refs.
To avoid this, just call mntget once, before any of the
dentry_open-related calls.
cm_Analyze forces new rx connections in response to VICECONNBAD and
VICETOKENDEAD errors but failed to mark the cm_req_t with
CM_REQ_NEW_CONN_FORCED and failed to set 'forcing_new' to true ensuring
that a retry would take place even if the cm_req_t included the no retry
flag.