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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>