Commit Graph

2031 Commits

Author SHA1 Message Date
Marc Dionne
547d94edd3 cache bypass: don't define iovecp for UKERNEL
iovecp is defined but not used for UKERNEL.  Define it conditionally
to avoid gcc warnings and --enable-checking failure.

Change-Id: I109ada36d0ab75e8a477498900dfaf85589e20e2
Reviewed-on: http://gerrit.openafs.org/5650
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-24 13:12:30 -07:00
Derrick Brashear
4b817cbb52 bypasscache: allow arbitrary sized iovecs
instead of binding outselves to PAGE_SIZE, just fill any size

Change-Id: I01385df372ac2bda6d8ea24381bf38102c12615f
Reviewed-on: http://gerrit.openafs.org/5658
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-10-24 04:44:46 -07:00
Derrick Brashear
28a159b2bf bypasscache: do errors correctly
do set errors when we bomb out early
do not unlock and return early when we happen to do a correct zero
length read
do set errors the kernel can deal with if we're feeding a page routine

Change-Id: I1dca1f9e3b0f3d24da3e4f55b473775a737370b4
Reviewed-on: http://gerrit.openafs.org/5554
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-24 04:44:31 -07:00
Marc Dionne
7829e71523 dir: add missing return in DRead
A missing return in the kernel version of DRead causes the code to
think that no entry exists for a dir and proceed to allocate a new
one, if the entry is the third one in the hash chain.

If the existing entry is dirty, its contents are never written back,
and the pending changes to the directory are not seen by the client.

Change-Id: I8b0f86b04d6ac8f75720933308a0983810974ff4
Reviewed-on: http://gerrit.openafs.org/5666
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-10-24 03:42:53 -07:00
Andrew Deason
6cb6bcc208 LINUX: Fix afs_linux_pag_to_groups signature
"new" is a struct group_info**, not a struct group_info*

Change-Id: I606afce74be6820b99b151b6077cf23d06e8e2d6
Reviewed-on: http://gerrit.openafs.org/5648
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-23 16:23:16 -07:00
Andrew Deason
ee2fbffb04 LINUX: Revert group changes on keyring failure
On Linux kernels that support keyrings, when we setpag we try to add
the PAG to the session keyring and to the supplemental group list.
Currently, if we fail to add the PAG to the keyring (which may happen
due to key quotas, or possibly other reasons), we return failure but
the group list is still modified with the new PAG in it.

Therefore, if the keyring-based approach fails, the new PAG may still
be in use, but there are no keyring keys associated with that PAG, so
the PAG may never get destroyed. This can cause a large number of PAGs
to accumulate over time, causing performance problems.

So, change this so that, in the event that keyring installation fails,
we revert the group list back to what it was before we touched it.
Also mark all unixusers with the new PAG as expired, in case one got
created during processing. Thus, the new PAG never gets used.

Change-Id: I61993edf705209e1a5d8dee638a9003690017c35
Reviewed-on: http://gerrit.openafs.org/5238
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-10-23 16:21:44 -07:00
Derrick Brashear
488c7c9785 afs: don't try GetDownD if nothing to get
if we "need" negative slots or caches, don't run. also,
don't stay "too full"

Change-Id: I29ef8d5fd9844a878d0c804d06aed5862a2d0df4
Reviewed-on: http://gerrit.openafs.org/5612
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-23 16:07:00 -07:00
Derrick Brashear
7ae1921b76 ukernel: set pthread stacksize to an integer multiple of 8k
because some pthread stacks require this to be in units of page size,
guess that page sizes will be 4k or 8k, and use the larger as a divisor

Change-Id: I9f89f7e32e2a70e12f1ed7a7fb86cab171b61e07
Reviewed-on: http://gerrit.openafs.org/5606
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-23 15:58:59 -07:00
Derrick Brashear
9f68e0dd31 afs: on uuid init fail, don't leave garbage behind
make sure we zero the uuid if we failed

Change-Id: I9d21e003b68eff0ce9bea4634c601c4663a0c078
Reviewed-on: http://gerrit.openafs.org/5599
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-23 15:38:37 -07:00
Derrick Brashear
da9044cff9 ukernel: don't enforce thread lockers in remove vop
we enforce locking by pid. when we are ukernel, MyPidXX is stupid.

don't bother.

Change-Id: Iddefd5d63edd6cc35a3c8112cb2cfbf3d47031aa
Reviewed-on: http://gerrit.openafs.org/5597
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-12 06:03:04 -07:00
Derrick Brashear
3eb60908a1 ukernel: add uafs_access
we don't have an access vop. add one.

Change-Id: I813fb941608b5e49a0f23730414854602630fdee
Reviewed-on: http://gerrit.openafs.org/5589
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-10 17:09:16 -07:00
Ben Kaduk
4a1d319177 FBSD: deal with kernel API rename
Upstream decided to rename the kernel functions that implement
syscalls to have a sys_prefix (including afs3_syscall!).
We use a couple of them, so we need to conditionalize accordingly.
Unfortunately, __FreeBSD_version was not bumped with the change,
so we use something close to it and hope it's close enough.

Change-Id: I228805a813af70b30f94f659e4da602210a6d6df
Reviewed-on: http://gerrit.openafs.org/5572
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-10 06:10:25 -07:00
Derrick Brashear
df3e4145e7 bypasscache: free in order
we need to free this, but while the pointer is still good

Change-Id: I5afa3505b764c5bf72811f60f63e29c80a29c5af
Reviewed-on: http://gerrit.openafs.org/5562
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
2011-10-07 05:40:10 -07:00
Derrick Brashear
d1cf14d54e bypasscache for ukernel
simple (read) bypasscache for ukernel.
does not bother trying any buffercache stuff.

Change-Id: Ie75572da7efdb871a4ce807f02fbbb5bd7744c66
Reviewed-on: http://gerrit.openafs.org/5484
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-10-06 01:01:23 -07:00
Derrick Brashear
955bab670d ukernel: output dataversion in stat struct if possible
we already have this data; if we can output it, do so.

Change-Id: Ibc445a152e4e1e61be50003dd8683d2a4b32d190
Reviewed-on: http://gerrit.openafs.org/5510
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-28 11:53:26 -07:00
Derrick Brashear
80943970b8 ukernel: make web enhancements the default
none of the web enhancements break base functionality,
and they are strictly more functionality; just turn them on everywhere

Change-Id: I462d3571d055f1d8ec19bdd0132b935bacd435c0
Reviewed-on: http://gerrit.openafs.org/5509
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-28 11:53:17 -07:00
Simon Wilkinson
cac7424272 Clean up assertion
The AFS code has multiple different assertion implementations in
userspace. This patchset is the start of bringing some sanity to them.

In rx, we have osi_Assert, a user/kernel assertion macro. This is only
available to libraries which have RX dependencies

In util, we redefine the standard 'assert()' macro to provide a
cross-platform assertion solution.

Because util has an RX dependency, neither of these provide an
assertion solution for libraries which should be independent of rx.
So, pull the assertion code out of util, and put it into opr, as a new
opr_Assert() macro. Implement the userspace osi_Assert in terms of this
macro, leaving the kernel variant untouched.

Update callers to the new macro and header file names.

Change-Id: I780b30ec1ea1207daa17127df4d5fbf9a94481b6
Reviewed-on: http://gerrit.openafs.org/5394
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2011-09-25 21:10:11 -07:00
Michael Meffie
0cb10104f5 solaris: libafs depends on fs/ufs
The solaris afs module depends on symbols exported by fs/ufs.
Set this dependency in the afs module so the kernel loader
will automatically load the fs/ufs driver if is not already
loaded, such on zfs only systems.

Change-Id: I87ae2c326ac0c895cca37cf30e4c11d0decbe6d1
Reviewed-on: http://gerrit.openafs.org/5456
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-20 09:56:28 -07:00
Jeffrey Altman
552d59186b Fix input size computation in SetSPrefs pioctl
Patchset 718f85a8b6 contained
a small typo that prevents the SetSPrefs pioctl processing from
functioning in all cases.  fs setserverprefs continues to work
for non-DB preference lists because fs.c pokeServers() attempts
to try the old SetSPrefs33 pioctl in the non-DB server case.

Change-Id: I2e06dccb51c53ba312418fb5f51be3d621a2004c
Reviewed-on: http://gerrit.openafs.org/5465
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2011-09-19 08:20:09 -07:00
Michael Meffie
624c5d09e2 solaris: fix afs_event build error
Fix build error on solaris introduced with commit
dc077b83c9.

Change-Id: Id41a0d7cf6400769dde5d2626854e2190cd6bd2e
Reviewed-on: http://gerrit.openafs.org/5419
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-15 20:42:56 -07:00
Marc Dionne
236c18b36a Linux: Remove use of undefined AFS_LINUX_ENV
AFS_LINUX_ENV is used in a few places, mostly from commit dc077b83,
but it is not defined anywhere.  As a result the logic was not as
intended.

In the definition of osi_ThreadUnique, this means that on all
Linux we use getpid(), which is OK as it gets defined appropriately
under LINUX and LINUX24 as current->pid or current->tgid.

Change-Id: Ic8daf10480a91ff8406cd6ca3929a2ecfafa78ad
Reviewed-on: http://gerrit.openafs.org/5424
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-14 20:49:57 -07:00
Ben Kaduk
febbd0f1ae Tidy up event hash table definitions a bit more
The change in http://gerrit.openafs.org/5314 consolidated the
definitions of struct afs_event and some related objects, but
the definitions were not quite in the right place.  In
http://gerrit.openafs.org/5392 this content was moved to more
standard headers, but a comment and #define were missed.
This change moves the comment to be in the same place as the content.

Change-Id: I86831879e9a2afd9e653182dcba4621624c55471
Reviewed-on: http://gerrit.openafs.org/5403
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-14 10:35:10 -07:00
Simon Wilkinson
6d274905b0 Unix CM: Fix afs_event fallout on Mac OS X
Commit dc077b83c9 moved the afs_event
structure definition into afs_osi.h. However, afs_osi.h is included from
lots of places which don't include a complete set of platform headers.
This means that the use of lck_mtx_t in this file breaks the build on
Darwin.

Instead, define the structure in afs.h, along with all of the rest of
the cache manager structures. Also take the opportunity to move the
definition of shutdown_osisleep it afs_prototypes.h, with the rest of
the prototypes.

Change-Id: Idd19fc30adcb5ab37e65ad87fa9224668e8cd321
Reviewed-on: http://gerrit.openafs.org/5392
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-11 06:00:56 -07:00
Simon Wilkinson
c2272c207b IRIX: Pull NFS translator hooks
We've never had working NFS translator for IRIX, and the system call
codes which are required to install the symbols used by the IBM
translator have long been used for other things by OpenAFS.

Simplify this mess by just removing the translator stubs from the kernel
module, and all of the code in afsd which used to handle pulling
addresses out of the kernel module so that we can hook ourselves in.

Change-Id: I2da2b0040afc0191e236706126d75bc7d39c0936
Reviewed-on: http://gerrit.openafs.org/5375
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-08 08:28:48 -07:00
Jeffrey Altman
4ec6fd0030 Windows: add clean rule to src/afs/NTMakefile
Change-Id: I433dee1e3f9e4b5774dc8011690b6c74162772ce
Reviewed-on: http://gerrit.openafs.org/5368
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
2011-09-07 14:27:22 -07:00
Ben Kaduk
dc077b83c9 Free memory from afs_events
DARWIN and LINUX were already doing this, but everybody else had
a memory leak.  Consolidate most of the common code to do so,
including afs_event_t definitions.

Change-Id: I5ec83cf23fd15dbbd5716995c671998e35862843
Reviewed-on: http://gerrit.openafs.org/5314
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-07 07:43:06 -07:00
Marc Dionne
def00ae8ba Linux: d_delete now takes a const argument
The d_delete dentry operation now takes a const argument.  Test for
this and define our function accordingly to avoid warnings.

Change-Id: I621f54d8e8182b29ccfdf82798773800f5870064
Reviewed-on: http://gerrit.openafs.org/5335
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2011-09-05 07:04:27 -07:00
Simon Wilkinson
b298138bc4 libafs: Fix directory verification
With the earlier directory verification changes, every directory
was seen as corrupt, because the nde pointer was never being initialised

Rework the way that we check for the failure of afs_dir_GetVerifiedBlob
so that we can more robustly detect problems, whilst still allowing
normal directories to be browsed as before

Change-Id: I3d3f428025296956b5feff6ba290aaef79817dcd
Reviewed-on: http://gerrit.openafs.org/5318
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-05 06:05:48 -07:00
Marc Dionne
8e97cf6f21 Linux: make sure backing_dev_info is zeroed
The afs backing_dev_info structure is allocated dynamically with
kmalloc, which doesn't zero out the contents.  In particular
there's no guarantee that congested_fn is NULL, causing spurious
oopses when bdi_congested tries to call it.

Change-Id: Ieeed870905627a132a0d1bd2f15cf80443b36303
Reviewed-on: http://gerrit.openafs.org/5334
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-05 06:04:19 -07:00
Marc Dionne
cbaefa266d Linux: 3.1: adapt to fsync changes
The fsync file operation gets new arguments to specify a range.
Add a configure test to check for the API change.

The inode lock is also pushed down into the operation, so we need
to take it ourselves to keep the original behaviour.

Change-Id: Icf4e152ce52f2b32c99920f83a5cc3136c05d2cd
Reviewed-on: http://gerrit.openafs.org/5332
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-09-05 06:04:00 -07:00
Derrick Brashear
16dff61e14 xserver lock order violation
individual volume locks are pretty far down, well after afs_xserver.

afs_SetupVolume (with tv->lock)-> InstallUVolumeEntry-> afs_GetServer.

Install*Volume is careful to protect against recursing into the volume
lock via ResetVolumeInfo. Unfortunately, GetServer acquires xserver,
and then if it needs to call GetCapabilities, it drops and reacquires
xserver.

turns out the volume locks weren't protecting much. they also aren't
grabbed before xvolume is dropped. fine, so, restructure to do all the
work, then merge the result.

Change-Id: I648900849a5a7349adc686658872706bd7024c90
Reviewed-on: http://gerrit.openafs.org/5303
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-31 11:37:54 -07:00
Derrick Brashear
12fa5b859b xvcb lock order violation
afs_FlushVCBs(1) = xvcb, xserver (in that order)

afs_GetServer = xserver, xsrvAddr, (call afs_RemoveSrvAddr which calls
afs_FlushServer, which gets xvcb)

"nope". do a little dance to get xvcb, searching for a struct server to reuse
again if we had to block.

if you're curious:
Lock afs_xserver status: (reader_waitingwriter_waiting, write_locked(pid:1589 at:36), 3 waiters)
Lock afs_xvcb status: (none_waiting, write_locked(pid:0 at:273))
Lock afs_xsrvAddr status: (none_waiting, write_locked(pid:1589 at:116))

Change-Id: If295d0b9ce347c1cc24df12cd9934a30dce2a3c6
Reviewed-on: http://gerrit.openafs.org/5294
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-31 11:37:21 -07:00
Michael Meffie
130144850c xstat: cm xstat time values are 32 bit
The kernel space cm xstat time structures are implemented as 32
bit values in memory and on the wire.  Define the client side
xstat userspace structures as 32 bit time values as well to avoid
size mismatches on systems with native 64 bit time values.

Change-Id: I857ea48bf8e12ec006ef24affb2e65a105ce27bb
Reviewed-on: http://gerrit.openafs.org/5237
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-29 14:17:19 -07:00
Garrett Wollman
40c9163aa9 libafs: crash in a more useful way if nchunks is zero
In afs_CacheStoreDCaches(), if the parameter nchunks is zero, the
main loop will not execute, leaving the XSTATS pointer unchanged,
which will result in a null dereference in XSTATS_END_TIME.  Instead
assert that nchunks is nonzero, which will help the static analyzer
and will also generate a more useful panic message should this
error ever be encountered in operation.

There is presently only one call site, and it may be the case that this
condition can never be triggered.

(While in the neighborhood, also avoid dereferencing tdc immediately
before testing whether it is null.)

Change-Id: Idf68f1306d3e09771425c62df139c1de11806c22
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5179
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2011-08-28 20:46:33 -07:00
Garrett Wollman
edbe891abf libafs: FillStoreStats doesn't need to be global; avoid pass-by-pointer
FillStoreStats is only used in afs_fetchstore.c, so make it static.
Parameter xferStartTime is an osi_timeval, which should be small
enough to pass by value, so do so.

Change-Id: Ic47eae8babb3b7cadbbbca2f10e2e070e2457590
Reviewed-on: http://gerrit.openafs.org/5199
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-25 12:58:40 -07:00
Matt Benjamin
fa97579a08 LINUX vcache lock ordering in afs_linux_readdir
Normalize shared and exclusive lock operations.  Take the lock
exclusive immediately, since the code assumes a write lock if
the vcache state is in flux or the entry is being fetched, releasing
-write- rather than shared, since we do not hold a shared lock.

Change-Id: Icbffdf21c6fc7929483589e87ffe9131834c79b4
Reviewed-on: http://gerrit.openafs.org/5309
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-25 10:11:26 -07:00
Marc Dionne
0fb2e3a6db dir: verified pathnames fallout
Fix some issues introduced with the verified directory path names
commit in master:
- In GetVerifiedBlob, the output parameter is set to NULL on entry
and dereferenced later on.
- For Linux, the code in afs_linux_readdir was changed to pass a
DirEntry to GetVerifiedBlob.  This is incorrect, the function still
expects a DirBuffer pointer.
- In afs_dir_IsEmpty, the assignment of ep was removed, leaving
the function to dereference this pointer which was never set.

Change-Id: I9045076ebe636cf68c19487c0d58baebf2de7dd1
Reviewed-on: http://gerrit.openafs.org/5292
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-23 09:38:35 -07:00
Garrett Wollman
5836464f45 libafs: don't crash if afs_write() is called with zero-length uio
If AFS_UIO_RESID(auio) is zero in afs_write(), we could end up
calling afsio_free(NULL).  Guard the free.  (In the alternative,
perhaps we should just osi_Assert(totalLength > 0) instead?)

Change-Id: Ic218f039e2034b679cb4817a543af2e8307f36f8
Found-by: clang static analyzer with the help of AFS_NONNULL
Reviewed-on: http://gerrit.openafs.org/5259
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-22 12:13:06 -07:00
Derrick Brashear
ad6e19331e macos: fix race in afs_root
same race on PutVCache in afs_root as we had on other platforms,
for instance FreeBSD. use a local variable instead to avoid the race.
additionally, make sure we end up with the root flagged VROOT.

Change-Id: I45ac36f12565320576070fd1c6d1f99ac6db8a63
Reviewed-on: http://gerrit.openafs.org/5278
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-15 12:04:26 -07:00
Garrett Wollman
10d2734180 libafs: don't call afs_PutDCache(NULL) in afs_GetDownD()
It's possible for an eviction candidate to be omitted by the small
for loop (around line 670), leaving its reference in victimDCs
set to NULL.  In the big for loop that follows, don't call
afs_PutDCache() when we hit one.

Change-Id: Ib0891636a3479bf97cdeab823189e659cb261aa6
Found-by: clang static analyzer with help from AFS_NONNULL
Reviewed-on: http://gerrit.openafs.org/5260
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-13 19:08:43 -07:00
Garrett Wollman
5c0e92a159 libafs: don't free a null pointer in an unlikely error condition
It is extremely unlikely that we will ever fail to allocate two
bytes in SRXAFSCB_GetCellServDB() to hold the empty-string return
value for the case where the specified cell can't be found.  But
that would result in freeing a null pointer, so check for it.

Change-Id: I47a296148e231b0ef20ecd18b8458b912f22a58c
Found-by: clang static analyzer with the help of AFS_NONNULL
Reviewed-on: http://gerrit.openafs.org/5261
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-13 19:07:45 -07:00
Garrett Wollman
ee56107d4d libafs: don't free the NULL we get from a failed allocation
In extractPioctlToken(), if we fail to allocate space for
token_opaque_val, don't immediately pass the null pointer
to osi_Free on the error exit path.

Change-Id: Ic95e178cfbc1b1bbcb18701c0bbd5221426342ee
Found-by: clang static analyzer with help from AFS_NONNULL
Reviewed-on: http://gerrit.openafs.org/5262
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2011-08-13 19:07:21 -07:00
Simon Wilkinson
d1946ffe9b libafs/dir: Verify directory pathnames
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>
2011-08-13 05:56:20 -07:00
Garrett Wollman
e3148c6bfa FBSD: coalesce three assignments to the same variable
Change-Id: Iadc9652c03a2d3453addab759c9f8f0048929e2b
Found-by: clang static analyzer
Reviewed-on: http://gerrit.openafs.org/5233
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
2011-08-12 12:36:28 -07:00
Derrick Brashear
d18ff03b59 macos: axe static vfs_fsentry
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>
2011-08-11 11:50:04 -07:00
Derrick Brashear
e8607d8d25 macos: reset next vcache pointer after reacquiring xvcache
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>
2011-08-10 10:49:01 -07:00
Garrett Wollman
7d0cd1393f FBSD: catch up with the disappearance of VOP_GETVOBJECT
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>
2011-08-10 10:48:39 -07:00
Garrett Wollman
8776f19417 afs_pioctl: don't use cell uninitialized in PGetTokens2
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>
2011-08-07 11:50:19 -07:00
Jeffrey Altman
71e64b6f21 Windows: unified afs errors must use nt mapping
On Windows, error.h does not provide a complete list of POSIX
C99 error values.  OpenAFS fills in the gaps with a private
error mapping table afs/errmap_nt.h (src/util/errmap_nt.h).
If errmap_nt.h is not included prior to processing unified_afs.h,
values such as ELOOP will be mapped to EIO instead of the unique
value defined by errmap_nt.h.

Change-Id: I3d25fafb15f1b0060ad1047178cbadd5ce22edb2
Reviewed-on: http://gerrit.openafs.org/5128
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
2011-08-01 10:42:39 -07:00
Derrick Brashear
5ebef72c02 macos: fix vnode finalization
erroneously pushed a bad version of this. fix it now.

Change-Id: Ic5db50473a97bd7ffb3ba34ac052da2ae8f2875b
Reviewed-on: http://gerrit.openafs.org/5124
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
2011-08-01 07:47:40 -07:00