The dir package didn't protect against circular hash chains when
performing directory lookups. A corrupt directory could therefore
cause a client or a fileserver to go into an endless loop if that
directory contained a loop in its hash chain pointers.
Fix this by exiting the lookup if the hash chain has more elements
than the total number of entries in a directory. This maximum number
of entries is taken as being (number of entries per page) * (max
number of pages), which is considerably more than the real maximum
value.
Change-Id: I9e281571f3b01bd8de346ee5418df38b2f5edaa1
Reviewed-on: http://gerrit.openafs.org/5242
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Provide a new routine, afs_dir_GetVerifiedBlob() which will ensure
that the pathname contained within a directory blob is correctly
terminated before returning it to the caller. For the purposes of this
function, correct termination is defined as having a terminating
\0 character within the same directory page as the blob itself.
Change-Id: I4b3bbb95cb49645a8ac52e6061f9e24f89924831
Reviewed-on: http://gerrit.openafs.org/5241
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
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>
if we exhaust the host table, instead of aborting, return VBUSY at
the client, to defer until hopefully hosts are freed.
Change-Id: Ie8b026992bdde1b46117e6f592f9cf0ea4c85a7e
Reviewed-on: http://gerrit.openafs.org/5181
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Nothing depends on the queue-manipulation macros having the expression
nature, so make them proper statements and unpack the comma-expressions
to make it easier to read and understand how they work. This should
not change the object code.
Change-Id: Icf14537f902768429aa27f67f8acfe39ac996214
Reviewed-on: http://gerrit.openafs.org/5200
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
for whatever reason, lion 32 bit doesn't like it when this is static.
fine, so it's not static now.
Change-Id: Ia9fe6d96615c7fa816f4a88b794faa6ee7e1d010
Reviewed-on: http://gerrit.openafs.org/5206
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Use Interlocked operations for protection of cm_volume flags and
qFlags as well as cm_vol_state flags.
Change-Id: I1a062a5c49d793162b83b9f4f3c32185ae596369
Reviewed-on: http://gerrit.openafs.org/5194
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
wrap the osi_Log macro's internal if statement with
a do {...} while(0) block in order to ensure that
it is safe for use in if..else controls without bracing.
Change-Id: Ica7bb95dfb1c0285a925771a9b659f85ec0e075f
Reviewed-on: http://gerrit.openafs.org/5189
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
dropping the xvcache lock means that things can change out from under
us. in case they do, reset the next vcache pointer before looping
Change-Id: I71be39a2f2986804257c50b1d5b7d557b58a3573
Reviewed-on: http://gerrit.openafs.org/5184
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
The vnode operation VOP_GETVOBJECT disappeared in FreeBSD 6.0, an
embarrassingly long time ago. Six years ago, a kluge was added
to emulate its behavior, but it did not correctly emulate the
return value of the old VOP implementation. As a result,
osi_VM_StoreAllSegments() could never actually do anything. Since we
don't support FreeBSD before 8.0, remove all references to VOP_GETVOBJECT
and examine vp->v_object directly instead.
This has the result that osi_VM_StoreAllSegments() will actually do
something now, which may not be desirable. (Previously, if somehow
the vnode had no associated VM object, it would crash, and otherwise
it would do nothing at all.)
Change-Id: Ifdad92ae8e393e85c3f97907af7119ce342b25dd
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5183
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
AFS_NONNULL wraps the GCC/Clang function attribute __nonnull__, which
tells the compiler and the static analyzer that the pointer arguments
to a function (or specific ones, if provided) cannot be null. Note
that GCC has only limited support for warning about violations of these
constraints.
Usage examples:
int myfunc(struct foo *a, bar_t, struct baz *c) AFS_NONNULL((1));
tells the compiler that the first argument cannot be null (but the
third one can).
int myfunc2(struct foo *a, bar_t, struct baz *c) AFS_NONNULL();
tells the compiler that both pointer arguments cannot be null.
Change-Id: Id81f0c382a6a3bdd9bf9c716eb4091b433129d69
Suggested-by: Simon Wilkinson, comment on change Ic8751737 (#5180)
Reviewed-on: http://gerrit.openafs.org/5182
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
nfs.h is required for various types used in vol-info.c. Include it. On
namei this header gets pulled in indirectly via other means, but on
inode it does not (and we shouldn't be relying on such anyway).
Change-Id: If917f8c3b0382572d2146450116399498257ffc7
Reviewed-on: http://gerrit.openafs.org/5185
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Add the -config option to aklog so that a different configuration
directory location can be specified on the command line for testing
purposes.
Change-Id: Ic5f8d778304a43c823e53bf1855a3e6bf426f80c
Reviewed-on: http://gerrit.openafs.org/5170
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Add the -config option to all pts commands, so that the user can set
the location of the configuration directory to use. This is primarily
provided for testing purposes, to make it simpler to build fake AFS
cells with configuration in non-standard locations.
Change-Id: I90c9c95cbf99b3853bfbe93dab1ab71c3ae7e228
Reviewed-on: http://gerrit.openafs.org/5103
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Add an explicit dependency on libafsauthent for src/venus, since it
is needed to build afsio. This can cause parallel builds to fail.
Change-Id: Ifda59983cda0711e9e1568d5a6be25e6ea934eee
Reviewed-on: http://gerrit.openafs.org/5171
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Fix a few cases of set but unused variables.
Change-Id: I0a3e0906dbc708e2449121f3de1726d7055efc27
Reviewed-on: http://gerrit.openafs.org/5173
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
nearInode can be unused, flag it as such to prevent warnings and
keep enable_checking happy.
Change-Id: Ic79d101380b79c3c3d90c4c4f949abe7c3f476ff
Reviewed-on: http://gerrit.openafs.org/5172
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
The parameter we are interested in is at MRAFS_OFFSET + 17, not
MRAFS_OFFSET + 13.
Change-Id: Ib856ff40c5949cde95a2b277cd44253b87c3c2a4
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5178
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Die() is an abort routine shared by the dir and vol modules. Move its
prototype into dir.h to ensure that its declaration matches its three
different definitions, and add an AFS_NORETURN annotation so that the
static analyzer knows that it aborts.
Change-Id: If01f35fe796708f6187b9767497a32458888ec1c
Reviewed-on: http://gerrit.openafs.org/5177
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
tserver is used by three different functions but not shared by them;
make it private to each one to improve static analysis. tconn is
not used by anything, so just delete it.
Change-Id: Ic9fc4add66dbbb02170846154e44d261dcc6b061
Reviewed-on: http://gerrit.openafs.org/5176
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The compiler and static checkers can do a better job if they know that
certain functions never return. Tell it that common.c:Abort() is such
a function. While we're at it, let volser_internal.h provide the
declarations for this function (Log() was already there). This makes
volser parallel to the way the same functions are declared in vol.
Change-Id: I8b684bf96866edfc9edaae126d789d245a8d2356
Reviewed-on: http://gerrit.openafs.org/5175
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
When iterating through the database, kdb would dereference a
null pointer if it encountered an error retrieving the value
or if the value was not the right length, in code that was clearly
cut-and-pasted from the other branch of an "if" statement where a
specific entry was requested on the command line. Print the name
of the entry with the problem as was apparently intended.
Change-Id: Idc2d3c9b6049e5d3b0eb302353a68bcfdad6a90d
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5174
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The argument to -splitcache is in as->parms[34], not [30].
Change-Id: I4d7be16a1ad99a03025c80f9782c4f678da868ae
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5169
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
An unlikely error condition could lead to the variable cell in
PGetTokens2 being passed uninitialized to afs_PutCell. Initialize
it to NULL beforehand to avoid this.
Change-Id: Ia8ded86df9d8af2f08c02d39749252d98a6c9ffe
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5168
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
In error conditions, charList could be freed before it is initialized.
Move the initialization up to before the error checks.
Change-Id: I678f40552590e238f494507f7410233cdbb949ac
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5167
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
in the new lwp/pthread/shared universe, well, we have the
opportunity to be correct. and we chose to do it entirely wrong.
we're building a shared object. use the right rules. we need
to add some CFLAGS for PAM. do that using MODULE_CFLAGS instead
of just building a whole new CCRULE
Change-Id: Ie3e3c5ba902e5364cfa99d4dbd1b5b7fd4451127
Reviewed-on: http://gerrit.openafs.org/5153
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
don't define variables on platforms we won't use them on
do prototype functions we call. basically, we compile with warnings
enabled now, so, fix everything so we *can*.
Change-Id: I749f27c227ac70c58ccc68f1548f8274f10e3587
Reviewed-on: http://gerrit.openafs.org/5154
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
"code" is unconditionally set early in saveDbToTape() so there's
no need to initialize it. On the other hand, dumpEntry.id is used
before dumpEntry is initialized, so set it to what appears to be
the expected value before any non-local exits could cause it to be
inspected.
Change-Id: I133f8e84e46d0faedf3c9683330d92158bcd8935
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5166
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
In some unusual error situations, startTime may be used uninitialized.
Move the initialization up above the first such error condition.
(None of the intervening code can take measurably long to execute
so this should not make any difference in the non-error case.)
Change-Id: I25bf7a5e149540593febec79f9f5111434807514
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5165
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
If wantExtendedInfo is true, then pntr is used uninitialized.
In the other case, UV_ListVolumes will have set it to NULL
before doing anything (even if it returns an error), so this
free() is dead anyway.
Change-Id: I6979a69d33ecbbdb906eb9a075bbf13180e36646
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5164
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Add the volser and vldb families of functions to libafsauthent. This
allows applications such as per-AFS which are building pthreaded clients
to use a single library, rather than trying to mix LWP and pthreaded
code within the same process.
Change-Id: I3682876e91ca03311a798ac71e3a7a28f3205d42
Reviewed-on: http://gerrit.openafs.org/5157
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Nothing within the volser/ directory depends on tviced, so remove the
unecessary dependency. Add an explicit dependency on vlserver, so that
libvldb is available to us.
This is required to get rid of some potential circular loops when we
start including volser objects in libafsauthent
Change-Id: Ibb6b8fb87dfe6e9eb4fa6d1dde195fd5261a8959
Reviewed-on: http://gerrit.openafs.org/5156
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
If the target is a UNC path beginning with the AFS netbios name,
convert the path to use Unix /afs mountpoint notation.
Change-Id: I01e01b70938f8eb383fd3e7458a140d9e89dd237
Reviewed-on: http://gerrit.openafs.org/5162
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
If the object represented by a scache object is deleted,
update the LRU position of the scache object to make it
the first object in the LRU queue to be recycled. This
preserves the cached objects for those that might prove
useful in the future.
Change-Id: I0e862b1270e10c31f20ecde06d208f4b8c405c3a
Reviewed-on: http://gerrit.openafs.org/5161
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
The osi_Log macro is if(foo) osi_AddLog()
If osi_Log macros will be conditionally called, the conditonal
needs to have bracing.
Change-Id: I59de78a5b7b35cc822a648a51cd63a14037c1ca5
Reviewed-on: http://gerrit.openafs.org/5160
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
During a directory enumeration the directory scache object
is reference counted so it can't be recycled. However, if
there are more directory entries than the maximum number
of cached scache objects the directory scache object will
end up being the next object to be recycled after the refcount
is dropped. Since the directory is clearly a hot object, before
dropping the reference, adjust the scache LRU position so that
it is the last object to be recycled.
Fix the variable name for the directory scache to be 'dscp'
for consistency.
Change-Id: Ia2089fb9b47dab77abc0911ab009e5aed75ed848
Reviewed-on: http://gerrit.openafs.org/5158
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
... so say so in the Makefile
Change-Id: I84f0ac3c06953eff98e0194ad375c32b3656af58
Reviewed-on: http://gerrit.openafs.org/5155
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>