10442 Commits

Author SHA1 Message Date
Garrett Wollman
ff217dec93 afsdump_extract: clarify logic to avoid freeing local buffer
Sometimes vnodepath is set to a local buffer.  Sometimes it is set
to malloc'ed storage.  Simplify the logic for freeing vnodepath
by checking explicitly for this condition rather than the state
of other variables.  As a bonus, avoids a false (?) positive from
the static analyzer.

Change-Id: I3772cb97698acc5a6ac1f438977c673e6fea7722
Reviewed-on: http://gerrit.openafs.org/7869
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-26 11:43:30 -07:00
Michael Meffie
24d2d3ea83 vlserver: always use the hostaddress table in GetAddrsU
Use the hostaddress (IpMappedAddr) table when looking up hosts by IP
address and when listing addresses by index, instead of accessing
the multi-homed extensions directly.

The existing vos client calls the old GetAddrs rpc to first retrieve
a count of the number of addresses expected. This count is the
number of addresses in the hostaddress table.  If there are
unreferenced entries in the mh extension blocks, then vos can return
an incorrect or incomplete list of addresses.

To be consistent with the rest of the host address processing, use
the hostaddress table in GetAddrsU to lookup hosts by index or by IP
address.

The hostaddress table is already used when looking up addresses by
UUID.

Change-Id: I01aa29ae7d24d48bcd245f0320e329435f61548e
Reviewed-on: http://gerrit.openafs.org/7878
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-26 11:42:42 -07:00
Garrett Wollman
7649a66a61 afs_conn: make release_conns_vector() actually work
release_conns_vector must never have been called before with
a non-null parameter, because it could not possibly work.
The first line of the loop is a null pointer dereference, and
if that were fixed, there's also a modify-after-free bug as well.
It's not clear how what the old version was trying to do; this
version makes a stab at doing something sensible but might be
less than required.  (Note that this would be much simpler if
converted to queue(3) macros or a similar standard linked-list
data structure.)

Change-Id: I4c0fb7ed1ee977dcc0b4dfb32557882679069731
Reviewed-on: http://gerrit.openafs.org/7838
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-26 10:53:48 -07:00
Garrett Wollman
d0db811939 pruser: AFS_NONNULL annotations for functions that deserve it
Change-Id: I68e74affcb3235d93e684a04a56ef44798a42406
Reviewed-on: http://gerrit.openafs.org/7861
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-26 10:53:03 -07:00
Garrett Wollman
3f691e663c kauth: ka_CellToRealm's "realm" parameter cannot be null
Annotate ka_CellToRealm with AFS_NONNULL to indicate that its
"realm" parameter cannot be null; it does not make sense to call
this routine without this parameter.  (The static analyzer inlines
the call to ka_ExpandCell and concludes that "realm" might be null;
the annotation will prevent that and avoid a false positive.)

Change-Id: Id7fac19cf4eb4bdb1decde81d951b8bcd96fce71
Reviewed-on: http://gerrit.openafs.org/7865
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2012-07-26 10:52:11 -07:00
Andrew Deason
f6d7a4b426 afsd: More pthreads damage
We need MT_LIBS for -lpthread and such. HP-UX needs this, and probably
other platforms; otherwise we complain about missing pthreads symbols.

Change-Id: If7486cabfc20ef4238087f0285c25d9f8602703a
Reviewed-on: http://gerrit.openafs.org/7880
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-26 10:50:05 -07:00
Andrew Deason
cf03e0a474 crypto: Use our strcasecmp in kernel
A few pieces of heimdal we use in the kernel call strcasecmp
(hcrypto/evp.c, krb5/crypto.c). The strcasecmp function does not exist
in all kernels (specifically, it does not exist in at least Linux 2.4,
2.6.9, and probably not on Solaris pre-10). Since we have our own copy
of strcasecmp (called afs_strcasecmp), just use that for now.

Ideally we would have some kind of configure test for detecting the
presence of the function in the kernel, and use the roken
implementation when we don't. We currently have the framework for
neither of those in place at the moment, though, so just get by with
this for now.

Change-Id: Ia96b17596da6cb168c80c92486fa049c05205da4
Reviewed-on: http://gerrit.openafs.org/7881
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-26 10:49:27 -07:00
Andrew Deason
97e241fdc6 afs: afs_strcasecmp args are const
We do not modify our args, so declare them const so we are usable with
const strings.

Change-Id: I2d60044014e51e2a52638b76ca50a5c2fc6980c0
Reviewed-on: http://gerrit.openafs.org/7882
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-26 08:16:48 -07:00
Garrett Wollman
97146a8ed8 ptuser: avoid implementation-defined behavior in CreateIdList()
CreateIdList() is an internal subroutine of pr_IDListExpandedMembers(),
used to flatten a hash table of protection IDs into an array that can
be passed to pr_IdToName().  If for some reason the hash table had no
entries, it would call malloc(0) and, depending on how the
the implementation defines this, either return a PRNOMEM error (wrong!)
or else allocate a minimum-sized buffer which pr_IdListExpandedMembers
would then promptly leak.  Compromise between the two behaviors by
not allocating any memory in this case but returning success, and in
the caller check for an empty list and avoid the pointless RPC to
translate no IDs into no names.  pr_IDListExpandedMembers() will return
success, as it previously did in the non-PRNOMEM case.

Change-Id: I8a042bde3e98f5cf248358f37f2e875d6b5b298d
Reviewed-on: http://gerrit.openafs.org/7863
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-25 13:29:41 -07:00
Garrett Wollman
2e7939ea46 kauth: don't call lcstring with a null source argument
This code was probably never executed, but now that lcstring() has
an AFS_NONNULL annotation, the static analyzer indicates the
potential null-pointer-dereference.

Change-Id: Idb41c2af1cb38bc5c084d4912614e0a553d4aa5a
Reviewed-on: http://gerrit.openafs.org/7864
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-25 13:27:45 -07:00
Garrett Wollman
a573697da3 rxgen: avoid an unimportant memory leak in docppline()
If cpp emitted
  # 1234 ""
docppline() would leak a small buffer.  Just free it.
The static analyzer will thank you.

Change-Id: I34ae6e228469a900139375f2a4758855922cf0ef
Reviewed-on: http://gerrit.openafs.org/7871
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-25 13:27:24 -07:00
Andrew Deason
3c9a9b4960 rx: Initialize kernel rx_atomic_mutex
Change-Id: I9a63fbee0e5a0f9df31b8e2440e91a03af54151f
Reviewed-on: http://gerrit.openafs.org/7876
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-25 13:25:38 -07:00
Andrew Deason
410a55addf rx: Raise minimum Linux atomics version to 2.6
Linux 2.4 does not have atomic_dec_return. If we switch to a
dec_and_test-like API, then we could use the Linux 2.4 atomics. But
for now, just raise the minimum to 2.6, and for 2.4 and below just use
the generic atomics implementation so we can build.

Change-Id: Ie584bd420839dbcbe3158fe7b50df633cb7eba6d
Reviewed-on: http://gerrit.openafs.org/7875
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-25 13:25:12 -07:00
Andrew Deason
6dd0bc6bed LINUX24: explicit dir buffers fallout
Fix fallout from 0284e65f97861e888d95576f22a93cd681813c39

Change-Id: I40a16fee3bb3835690f7ff7328f70d3454fd1198
Reviewed-on: http://gerrit.openafs.org/7874
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-25 13:25:00 -07:00
Derrick Brashear
3638ef30d0 macos: next version header
add header for next macos

Change-Id: I9078b77587197b38ff705663c73a7f930efeec7a
Reviewed-on: http://gerrit.openafs.org/7868
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-07-24 21:19:53 -07:00
Jeffrey Altman
5f60992bfe Windows: NPAddConnection3 debugging
Define Add3FlagsToString() and use it when generating debug
output from NPAddConnection3().

Change-Id: I73251890659ea5a833b5f67d26129053c625b58a
Reviewed-on: http://gerrit.openafs.org/7860
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-24 21:10:05 -07:00
Jeffrey Altman
16b671cf3b Windows: Correct exceptions in AFSRDFSProvider
Correct two errors in the generation of debug strings that
were triggering invalid memory access exceptions.

Change-Id: Ie5ee3289e2fa74809067f05931c3aa568c2be9d0
Reviewed-on: http://gerrit.openafs.org/7859
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-24 21:09:42 -07:00
Garrett Wollman
78f1e230ce afs_bypasscache: parameters of afs_ReadNoCache can't be null
The first two parameters of afs_ReadNoCache() are unconditionally
indirected through, and all existing callers appear to guarantee
that these parameters are in fact non-null, so annotate the function
declaration to so indicate, and remove the one test that checks
whether avc (the first parameter) is null.  I suspect that acred
cannot be null either, but this code does not appear to depend on
that, so it's not included in the non-null annotation.

Change-Id: I496c868ffcbc9b894f91578019bc30bf7b14fefd
Reviewed-on: http://gerrit.openafs.org/7837
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-24 05:22:57 -07:00
Garrett Wollman
21878c61dd ptuser: use the "prname" typedef rather than "char[PR_MAXNAMELEN]"
There's a typedef for this type, so use it in function prototypes
rather than the more complicated declarator.

Change-Id: I75a9b4e72201e6b2072dba14185579f9c4aa61be
Reviewed-on: http://gerrit.openafs.org/7858
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-24 05:22:29 -07:00
Derrick Brashear
5e0c59284a afsd: fix pthreads damage
ah linker fun. clean up from 98f86cfc53fc987fdaed2f5bb733b5b5d21bfda9

Change-Id: Id78debe0c9ddec0ce5f3fd2b95e16802a132845f
Reviewed-on: http://gerrit.openafs.org/7855
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-23 21:52:57 -07:00
Jeffrey Altman
8ff703fcbb Windows: No VLDB server blocking probes
Now that we have background probes, use them for VLDB server probes.

Change-Id: Ib160ec5ae702065f410e85ae949ae13a02c425e8
Reviewed-on: http://gerrit.openafs.org/7854
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-23 21:25:00 -07:00
Jeffrey Altman
ceeb047457 Windows: NOPROBE means probe in background thread
It is important that down servers be detected as soon as possible.
When it is not possible to perform a blocking probe, perform a
probe in a backgrond thread.

Change-Id: If73856359ba894c5c302c11fd50aaa76cd2fcf28
Reviewed-on: http://gerrit.openafs.org/7853
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-23 21:24:47 -07:00
Garrett Wollman
a738c8dcff ptuser: pr_SNameToId/SIdToName: if RPC response empty, force error
If the prserver returns an empty response to ubik_PR_NameToID
or ubik_PR_IDToName, but doesn't otherwise give an error,
force a PRINTERNAL error return so that the client knows that the
the return parameter was not updated.  Existing callers seem to
expect this, as pr_SNameToId is often called without initializing
the variable which receives the result and checking only for the
error code.

PRINTERNAL is a new error code.

Change-Id: I3e598a22deb39792a0f208ac09b3c1991d6f1e58
Reviewed-on: http://gerrit.openafs.org/7836
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-23 20:26:43 -07:00
Derrick Brashear
98f86cfc53 afsd: switch to pthreads
kill one more lwp dependency.

Change-Id: I9a878d7b0e1ab50770c6162f6bd380119b7a4292
Reviewed-on: http://gerrit.openafs.org/7828
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-07-23 19:51:31 -07:00
Derrick Brashear
a3b6a940f8 afsd: cleanup syscall cleanup
sadly ead743db5d57afa175f5dc0828b76881bcbcbf54 missed a few bugs. fix
them here.

Change-Id: I03d52543fb096f75ccf6dbde4f7526a7c0c576bb
Reviewed-on: http://gerrit.openafs.org/7852
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-07-23 19:29:39 -07:00
Jeffrey Altman
736e0dbeec Windows: get rid of _strdup and use rk_strdup
Do not use the _strdup() C RTL function.  Use strdup() so that
rk_strdup() roken replacement can be used.

Change-Id: Ifd2808a078b514468aee52ef76a9b51e606a2c88
Reviewed-on: http://gerrit.openafs.org/7848
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-23 14:48:25 -07:00
Jeffrey Altman
907dbac89c roken: rk_strdup rk_wcsdup exports
Change-Id: Iee3670ddf86599dd81f1247a9f8cfafcbc6e1e8f
Reviewed-on: http://gerrit.openafs.org/7847
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-23 14:48:13 -07:00
Heimdal Developers
cabfe32c33 Import of code from heimdal
This commit updates the code imported from heimdal to
b8a53329fc8bf2fe8c4f4058512f828d7654e3f8 (switch-from-svn-to-git-3003-gb8a5332)

Upstream changes are:

Jeffrey Altman (2):
      Windows: rk_strdup allocator
      Windows: rk_wcsdup allocator

Nicolas Williams (1):
      Fix bug in _krb5_expand_path_tokensv()

Change-Id: I08abb25b4f4136bccb3eaf8d8c44851ce748f395
Reviewed-on: http://gerrit.openafs.org/7842
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-23 14:48:01 -07:00
Simon Wilkinson
5dce817d40 ptserver: Make ptclient build again
Make the ptclient utility build again, and add it to the ptserver
Makefile so that it is built by default and, hopefully, won't
bitrot again.

Change-Id: I888a9d4392b62ecb2d7556694400a2853658052a
Reviewed-on: http://gerrit.openafs.org/7841
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-07-23 09:31:03 -07:00
Simon Wilkinson
0eca3c1822 auth: Fix GetTokenEx with NULL cellName
If GetTokenEx is called with a NULL cellName, it means use the
local cell. To do this with the legacy interface, a 0 length string
must be used for the cell instance of the ktc_principal passed to
GetToken. Fix this so that we do so, rather than attempting to
strcpy(..., NULL) which never ends well.

Caught by clang-analyzer

Change-Id: I53d9bdf0fc280ee073a2fb7693659269df29c2eb
Reviewed-on: http://gerrit.openafs.org/7840
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2012-07-23 09:26:17 -07:00
Jeffrey Altman
1f0cf8b2b4 rx: rxi_FindRpcStat must test for empty queue
When queue_Scan is executed on an empty queue the queue element
variable, in this case 'rpc_stat' is the queue head, _RXQ(q),
and not NULL.  Callers of rxi_FindRpcStat() expect NULL on failure
to find or create an rx_interface_stat object.  Correct the behavior
by testing for an empty queue and return NULL immediately if the
queue is empty and the caller is not requesting creation.

Change-Id: I9952d7aaf357e039e87f6b8b17cb1a00208d6465
Reviewed-on: http://gerrit.openafs.org/7835
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-23 07:54:11 -07:00
Simon Wilkinson
ead743db5d afsd: Tidy up system calls
Tidy up the way that we do system calls from afsd, by making
afsd_syscall a va_arg function, using a structure to pass system call
information around, and simplifying the #ifdef ladder that converts our
platform independent system calls into something platform specific.

This fixes all of the warnings in afsd which required the -Wno-error
option, the only warnings remaining are related to daemon being
deprecated on Darwin.

Change-Id: I357c7d175b5327007d50d213c6181881c842050e
Reviewed-on: http://gerrit.openafs.org/7188
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-23 07:11:23 -07:00
Jeffrey Altman
748a3e29b6 Windows: cm_UpdateVolumeLocation volp locked
When calling cm_UpdateVolumeLocation the volp->mx must be held.
cm_Analyze() did not obtain the mutex as required.

Change-Id: Ida69105879a78692a367cd4439bee8e4bea751ff
Reviewed-on: http://gerrit.openafs.org/7839
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-23 05:51:54 -07:00
Michael Meffie
82865811e4 libafs: avoid flushing already freed dcaches in flush volumes
When flushing volume data, skip flushing dcache entries which
are already freed.

Change-Id: I74d7e055e833dc91214dd9d544af3781f74db59b
Reviewed-on: http://gerrit.openafs.org/7539
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:25:30 -07:00
Marc Dionne
fd707e3014 vol: set correct bit in bitmap after VGrowBitmap
Set the correct bit after the bitmap is expanded with VGrowBitmap
so we don't allocate it twice and trigger a salvage.

Change-Id: Iee307a0913d4402c2d5a32d493ff489b35778811
Reviewed-on: http://gerrit.openafs.org/7793
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:22:53 -07:00
Garrett Wollman
91d7cd931a uafs: avoid type-punning in get_user_struct()
There's no need for type-punning here; usr_getspecific() is a macro
that just assigns to the variable whose address we provide, so the
cast was just unnecessary (and erroneous) obfuscation.  This is the
only caller of usr_getspecific(), so if it needs to be more complex
in the future, it should probably just be open-coded here.

Change-Id: I81286cbce9a00908aa87073b728b07d8bcc8d1d1
Reviewed-on: http://gerrit.openafs.org/7799
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:22:35 -07:00
Derrick Brashear
d3761b9e62 ubik: don't force an error just because calliter is early returning
in this case, racing another ClientInit caller is not fatal.
clean up from 56b5b9a1c51c2197923aa373c180a834edabe4f6 which was
my fault.

Change-Id: I81d3298a775ed46972779b4121498560883fee01
Reviewed-on: http://gerrit.openafs.org/7803
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:22:21 -07:00
Garrett Wollman
e39d6ca55a strcompose: NULL must always be cast when passed to a variadic function
The C standard allows NULL to be defined as a bare "0", which will
be passed to variadic functions as an int.  If the function expects
a pointer type, demons fly out of your nose.  strcompose() is such
a function, so make sure that all of its callers cast NULL appropriately.
(None of them did.)  This may be an opportune time to change all of
the callers to spell it opr_strcompose() as well, and avoid using a
reserved identifier, but this change does not do so.

Change-Id: Ia9007a48102da4d0a85a48b41a44e83102304b49
Reviewed-on: http://gerrit.openafs.org/7805
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:22:08 -07:00
Garrett Wollman
466ba9cb60 opr: constify various string functions and mark them AFS_NONNULL()
All of these string functions require at least one non-null argument.
Mark them as AFS_NONNULL() so that the compiler and static checker can
find erroneous uses.  The "source" arguments of lcstring and ucstring
can be const, so do so.  (This doesn't affect anything in the tree
right now.)  While here, note a few unfixed issues with these interfaces.)

Change-Id: If2a8dd4d617795560e92c09ee604780f90edce6a
Reviewed-on: http://gerrit.openafs.org/7804
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:21:56 -07:00
Derrick Brashear
cb807db450 libafs: getattr should include S_IFDIR on fake dirs
on macos, VDIR is not useful as part of a directory mode. it's just not.
on aix, solaris, we presumably want to pass S_ISDIR, so do so

Change-Id: I04ee49857febf1cf96d30bd6a8271f99192630c8
Reviewed-on: http://gerrit.openafs.org/7789
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:21:41 -07:00
Jeffrey Altman
30e26c07d4 Windows: Recompute server rank periodically
After VL_ProbeServer and RXAFS_Getcapabilities RPCs call
cm_RankServer() to recompute the server ranks based upon the
updated peer statistics.

Change-Id: I84687e12f1c1bd323a95c5ffcc73b95d400bd1f5
Reviewed-on: http://gerrit.openafs.org/7827
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:20:46 -07:00
Jeffrey Altman
a3e2bd0d01 Windows: Clear peer RPC stats on IP addr change
When an IP address change has been detected, clear the peer
RPC statistics used for server ranking.

Change-Id: Ie9e3f4553f9d0b22d4876b729ce0028e762efb33
Reviewed-on: http://gerrit.openafs.org/7826
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:20:22 -07:00
Jeffrey Altman
c0d652dcde Windows: server rankings by RPC statistics
Use VL_ProbeServer for VLDB servers and either
opcode_RXAFS_GetCapabilities or opcode_RXAFS_GetTime for
File servers.

Change-Id: I67c3ad88ac3dd07ac1c0e44d462853d068bf50c8
Reviewed-on: http://gerrit.openafs.org/7825
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:19:47 -07:00
Derrick Brashear
c1081a3ab5 rxgen: per-opcode stats
allow access to per-opcode stats

Change-Id: I17639cf23acac23acfb9cb7dc07a7c5c81d4ff89
Reviewed-on: http://gerrit.openafs.org/7802
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jacob Thebault-Spieker <summatusmentis@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:18:50 -07:00
Derrick Brashear
c3767f1e90 rxgen: emit opcode defines in header
define an opcode-name-specific define with the numeric value
of the opcode

Change-Id: I34e6eb57ac2c57319a83b0279cc9115050a39c4f
Reviewed-on: http://gerrit.openafs.org/7801
Reviewed-by: Jacob Thebault-Spieker <summatusmentis@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-07-22 05:18:36 -07:00
Garrett Wollman
417df0d495 xdr: fix two old FIXMEs related to signed/unsigned arithmetic
It's implementation-defined whether the C '>>' operator, when
applied to a signed integer, is sign-extending or zero-filling.
If you want unsigned arithmetic, you have to ask for it explicitly.
One assumes the reason for the shift is to avoid overflow if the
returned size/count is later converted to a signed int, in which
case maybe it would be better to use INT_MAX here.  This is the
minimal change necessary for correctness.

Change-Id: I6e848110963b5e1832a11d052d84884f10903e2e
Reviewed-on: http://gerrit.openafs.org/7800
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-21 20:22:47 -07:00
Jeffrey Altman
860812931f Windows: AFSTearDownFcbExtents loop conditional
If there are extents in the list with a non-zero ActiveCount,
those extents will be skipped and the list 'le' will never
become empty.  Add an additional condition to ensure that the
loop is only executed once for each extent in the list.

Change-Id: I48adf7c49282181d0a34135ac50f7fa1a165c735
Reviewed-on: http://gerrit.openafs.org/7810
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-21 20:20:48 -07:00
Jeffrey Altman
6b0bc2f6ff Windows: memory leak AFSInitPIOCtlDirectoryCB
In an error occurs during AFSInitPIOCtlDirectoryCB processing
the nonpaged pool allocation would be leaked.

Change-Id: I092538202d84bd65476ba21a68e210d5f626ead2
Reviewed-on: http://gerrit.openafs.org/7809
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-21 20:20:03 -07:00
Jeffrey Altman
af1bdc2b77 Windows: memory leak AFSRemoveVolume
Do not leak the
VolumeCB->ObjectInformation.Specific.Directory.PIOCtlDirectoryCB->NonPaged
allocation and the associated lock object.

Change-Id: Ie6455c49fdcee578ab31355df1b2237f27a92e1d
Reviewed-on: http://gerrit.openafs.org/7808
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-21 20:19:39 -07:00
Jeffrey Altman
fe61f35d35 Windows: AFSExFreePool -> AFSExFreePoolWithTag
Replace AFSExFreePool() with AFSExFreePoolWithTag() which is
a wrapper around both ExFreePool() and ExFreePoolWithTag().
If a 'Tag' value, is provided, ExFreePoolWithTag() is used.
Otherwise, ExFreePool().

Specify allocation tag values wherever possible.  Path name buffer
tags are not specified because they are allocated using multiple
tags.  The same is true for network provider string buffers.

This is being done in order to debug a memory corruption issue.

Warning: this is a change to the AFSRedir->AFSRedirLib interface
and therefore both drivers must be updated with a reboot and
not simply restarting the service.

Change-Id: Id5c0503141d1077d6c2beae5d28602160105a312
Reviewed-on: http://gerrit.openafs.org/7807
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
2012-07-21 20:19:15 -07:00