When iterating across the buffer list, afs_newslot used a hardcoded
maximum time to find the oldest. Instead of using this, just use the
accesstime of the first unused buffer that we find as the oldest, and
continue as normal.
Change-Id: Ifeacb8a407901b46a23fbc838b1fca761108ebbb
Reviewed-on: http://gerrit.openafs.org/738
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Both dynamic vcaches and rxmaxmtu had been committed as using the
35th command entry. Fix this according to the order they are in
the command list (35 and 36, respectively). Tidy up the command list
so it's easier to read, and remove the #ifdef notdef entry from it,
as adding it back in would just cause chaos.
Change-Id: I3fce403aa0ab01c42f0e1a48ae401503b0e21c24
Reviewed-on: http://gerrit.openafs.org/740
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Back in 2002, 0eb68f307a was committed
to fix locking problems in dir/buffer.c.
Sadly, similar changes were never made to afs/afs_buffer.c, so the
same problems remain in the cache manager.
The issue here is with two processes racing in afs_newslot. Calls to
afs_newslot protect buffers with a zero reference count using
afs_bufferLock. If we release afs_bufferLock, before we increase the
reference count of the vcache, then we can end up with newslot
picking the same buffer for two different purposes.
The GLOCK actually protects us from the worst of this, but this fix
is necessary both for correctness, and for symmetry with the file
server buffer code.
Change-Id: I7f1c7d6571559c5f1784926c39d4889b77677231
Reviewed-on: http://gerrit.openafs.org/737
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
The pininodes option has been commented out of afsd since the
original OpenAFS commit. Enabling it now would cause chaos, due to
the way that cmd orders its arguments. Just remove the sections
of code to avoid this danger.
Change-Id: I9e9944d4470fd21d2ec9e36e17771b499d7c8e0b
Reviewed-on: http://gerrit.openafs.org/739
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The convertROtoRW code for the inode fileserver makes copies of the
volume's special inodes, but leaves the old (RO) inodes around. If the
RO is created again, this will result in duplicate special inodes for
the same volume, which freaks out the salvager (and possibly other
things).
So IH_DEC the old RO special inodes after converting, so they go away.
Change-Id: Ifefa2cb69c5b2960b81dbee9d54e5ea8401b240e
Reviewed-on: http://gerrit.openafs.org/735
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
ubik_VL_GetAddrU accepts a pointer to a uniqifier and not
a pointer to a VLCallBack structure. Remove an incorrect
cast and provide the correct parameter in src/volser/vos.c.
Change-Id: I4b12cf2d4c65f115fdef76f0a4306960b5cd0413
Reviewed-on: http://gerrit.openafs.org/733
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Running salvageserver with the -client and -showlog options will
currently segfault, since -client does not open logFile, and -showlog
will attempt to rewind logFile on exit.
Fix this by not allowing -client and -showlog together (since it won't
work anyway, as -showlog tries to read SalvageLog), and by making
showlog() check logFile for NULL-ness.
Change-Id: I30f43ef1696f1e7e8873b9e1cc3867b4e06d1980
Reviewed-on: http://gerrit.openafs.org/734
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Remove check on powerStateSuspend in cm_Daemon()
Update the server Reference lists if the ranking changes.
Change-Id: Id290e0f98c616a12f4f8b1746dca58ad7a0f06ce
Reviewed-on: http://gerrit.openafs.org/729
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jacob Thebault-Spieker <summatusmentis@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
This adds the functions cm_RankUpServers() and cm_RankServer() to
the Windows cache manager. cm_RankUpServers() steps through the
list of servers, and calls cm_RankServer(), which in turn re-ranks
the servers that are currently up based on rx peer statistics as
exposed by rx_GetLocalPeers().
cm_RankUpServers() is called every 10 minutes by the cache manager
daemon, so as to allow re-ranking of the servers.
Also added is the struct server->adminRank data structure, to
allow for the modification of the rank that the admin has set,
without but basing this modification on the admin-set rank.
Change-Id: I118b885e179e4f84901dd9a3180ce821f194feb8
Reviewed-on: http://gerrit.openafs.org/317
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Clean up the 'all buffers locked' console message so that it's
clear that it comes from AFS, and so it has a trailing newline.
From a bug report by Rainer Toebbicke to openafs-info
Change-Id: I3f69e57e37a91ae3e6e8822ccfe72dddc06b4359
Reviewed-on: http://gerrit.openafs.org/732
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
When we're called from write(), we don't have the option
of deferring the writing of a page by returning AOP_WRITEPAGE_ACTIVATE.
Instead, write() simply sees this as the output of 0x8000 bytes of data.
So, whilst we can mark a vcache as being output, we can't defer the
processing of one which is already being written (by, for example, an
earlier writepage()).
This problem only affects files which are have mmap() and write()
called in quick succession, but it does break the fsx utility.
Change-Id: I750a186de38da9873665a862f5b584a78e6979ad
Reviewed-on: http://gerrit.openafs.org/725
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
We have no control over the context in which the kernel calls our
writepage routine. It may be from the process which original wrote the
page, from any other process on the system which is writing and goes
over the dirty page threshold, or from the flush thread (pdflush /
flush-afs). Therefore, we cannot use the credentials of the current
process to perform the writeback. This is an issue both for afs_write
(which, in our current MM model, may need to contact the fileserver
to read missing chunks), and for DoPartialWrite (which needs to be
able to store chunks when the local cache is getting full)
This patch stores the credentials of the first process to open a file in
the vcache structure. Whenever writepage() is used to writeback pages
for this file, the cached credentials are used rather than those of the
current context.
Thanks to Marc Dionne for his work in testing and refining this patch.
FIXES 125471
Change-Id: I2900f711150fd81b2b4839bbc2bf77623bde3b64
Reviewed-on: http://gerrit.openafs.org/724
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Fix the transaction object races between VolMonitor and the
volume operation procedures which can cause the volume
server to crash.
Add a per transaction object mutex to safely set the
transaction call pointer and name. Fix VolMonitor to safely
traverse the transaction list and to access the call pointer
and last proc name while copying info to send to the vos
client. Fix the sleep thread to safely access the last proc
name.
FIXES 125479
Change-Id: I59595b93522d111b6a771d3d93c246bfc2ce65de
Reviewed-on: http://gerrit.openafs.org/718
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Currently, h_GetHost_r and removeAddress_r can destroy the
callback_rxcon of a host. Having a NULL callback_rxcon can cause
segfaults in code that does not properly check if a host has been
HOSTDELETED before trying to use it.
Although such code is incorrect and should be fixed, we can still avoid
a segfault in those situations by not destroying callback_rxcon until we
destroy the host itself. This just prevents destroying callback_rxcon in
h_GetHost_r and removeAddress_r, leaving it to h_TossStuff_r to destroy
when it destroys the host.
Change-Id: I6fd5cbb924053446689c576026f9044f78ba71be
Reviewed-on: http://gerrit.openafs.org/717
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The writepage_sync changes get error returns wrong in a couple of places. In
particular, they return a 0 code from dopartialwrite in preference to the
length return from page_writeback
Change-Id: I34a848fed5f799aa6844e9ef0339321f91c7e59b
Reviewed-on: http://gerrit.openafs.org/721
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Add support for Windows 7 and Server 2008 R2.
Improve text in a variety of areas.
LICENSE MIT
Reviewed-on: http://gerrit.openafs.org/719
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
This change refactors writepage_sync into 4 functions -
*) prepare_writeback() readies a vnode for writeback, and performs
the anti-recursion check.
*) dopartialwrite() intialises a request and performs the call to
DoPartialWrite
*) page_writeback() does the actual work of writing an AFS page into
the disk cache page
*) complete_writeback clears the writeback flag from a vnode
There should be no change to the current behaviour of writepage_sync,
these modifications are the first part of a fix to our writepage()
behaviour.
Reviewed-on: http://gerrit.openafs.org/712
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
WinExec is a compatibility interface for 16-bit applications.
It is not compatible with Windows 7. Replace it with ShellExecuteEx.
LICENSE MIT
Reviewed-on: http://gerrit.openafs.org/714
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
in rx, we use pthread_self (which can return a pointer) as a pid;
in order to not cause problems, cast it as we do elsewhere
Reviewed-on: http://gerrit.openafs.org/703
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
WinExec is for 16-bit application compatibility. Starting with
Windows 7 it cannot be used to execute a process that requires
elevated privileges. ShellExecute[Ex] must be used instead.
LICENSE MIT
Reviewed-on: http://gerrit.openafs.org/711
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
fstrace should not log sets to the kernel message log
Reviewed-on: http://gerrit.openafs.org/710
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
GCC doesn't catch issues with performing pointer arithmetic on
(void *)s, unless the -Wpointer-arith warning flags is supplied.
Enable it for warning and checking builds.
Reviewed-on: http://gerrit.openafs.org/708
Tested-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
exiting in library code is antisocial. if rx encounters an error
which cannot be returned and would otherwise indicate a service thread
has gone away, assert.
Reviewed-on: http://gerrit.openafs.org/668
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
In places where we're doing pointer arithmetic, we must cast to (char
*), because pointer arithmetic on a void * isn't permitted by the C
standard. Sadly gcc lets us get away with it 'for convenience'.
Reinstate the necessary casts.
Reviewed-on: http://gerrit.openafs.org/707
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reference useful web pages such as docs.openafs.org for help,
www.openafs.org/windows.html for upgrade info, etc.
Reviewed-on: http://gerrit.openafs.org/706
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
When assigning ports from SRV/AFSDB lookups, convert to network
byte order when assigning them to cm_server objects.
LICENSE MIT
Reviewed-on: http://gerrit.openafs.org/705
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
The WiX based Windows Installer package for OpenAFS should set
the ARPINSTALLLOCATION property when installing. This property
contains the main installation directory for the product and is
necessary for Windows Logo compliance.
Reviewed-on: http://gerrit.openafs.org/704
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
memset() takes a void * as it's first argument. Don't explicitly cast
what we're passing in to (char *), as this may mask other errors.
Reviewed-on: http://gerrit.openafs.org/701
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Make typedefs of AFS_UCRED and AFS_PROC, with a corresponding name change.
The names afs_ucred_t and afs_proc_t are chosen since these appear to be
the best available choices. The names cannot actually collide with anything
which POSIX might later introduce. For UKERNEL, the preprocessor is used
to redirect references. This seems not easily avoidable at present.
LICENSE BSD
Reviewed-on: http://gerrit.openafs.org/645
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
On HPUX, it is possible for 'critical' signals such as SEGV, ABRT, etc
to be delivered to the softsig thread when we sigwait(). The current
code marks these as 'fatal' and just exit(0)s when they are received,
preventing us from getting cores in the case of a SEGV, ABRT, etc.
To work around this and keep behavior on other platforms the same, just
do not wait on 'critical' signals on HPUX in the softsig thread.
Reviewed-on: http://gerrit.openafs.org/693
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Permit the new rx settings to be configured via the registry and
set at startup.
LICENSE MIT
Reviewed-on: http://gerrit.openafs.org/700
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Call a spade a spade. Don't use macros to rename lock_page as LockPage,
and unlock_page as UnlockPage. Instead use the same names as the kernel,
which makes it a lot easier for people familiar with kernel code to read
ours.
Reviewed-on: http://gerrit.openafs.org/692
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
afscreds.exe:
1. disable the drive mapping and advanced tabs.
2. on exit, remove the option to stop the service.
afs_config.exe:
1. disable the drive mapping tab
Removing this functionality by default will address some of the
problems while permitting users that wish to continue using these tools
to do so. The drive mapping tab can be re-enabled setting the registry
value to be non-zero:
{HKCU,HKLM}\Software\OpenAFS\Client DWORD "ShowMountTab"
LICENSE MIT
Reviewed-on: http://gerrit.openafs.org/663
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
The recent change to detect sharing violations and initiate retries
permits infinite attempts. Change this to a limit of 100 attempts
and increase the sleep period between attempts from 1ms to 100ms.
LICENSE MIT
Reviewed-on: http://gerrit.openafs.org/697
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Windows 7 logo requirements state that all dlls including
resource only dlls be digitally signed.
LICENSE MIT
Reviewed-on: http://gerrit.openafs.org/698
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Do not return STATUS_TIMEOUT to the smb redirector, doing so
results in an undesireable disconnect.
Map RXKADNOAUTH to STATUS_CLOCK_SKEW as that is the most
frequent cause of rx level authorization failures.
Map CM_ERROR_UNKNOWN to access denied since there is no
better error choice.
LICENSE MIT
Reviewed-on: http://gerrit.openafs.org/661
Reviewed-by: Asanka Herath <asanka@secure-endpoints.com>
Tested-by: Asanka Herath <asanka@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
window size was previously pushed to 64; push to 128. as this increases memory
use, anything further should be arguably tied to rx-using-program's
resource allocation preferences, e.g. fileserver -LL should be willing to
up this
Reviewed-on: http://gerrit.openafs.org/549
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
make the copy of afscp in src/tests compile with fewer warnings
(and provide needed prototype for RXAFSCB_ExecuteRequest)
Reviewed-on: http://gerrit.openafs.org/694
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
The rx peer timeout is computed from the round trip time
calculation. It traditionally has had a lowerbound of 350ms.
The computation in rxi_ComputeRoundTripTime() was incorrect
and instead used 350ms as an upperbound.
rxi_ComputeRoundTripTime() had a second problem wherein if
the actually RTT is shorter than the resolution of the clock
then the RTT would quickly approach 0.0 seconds. Enforce
a lowerbound of 1ms if the RTT for a given packet appears
to be 0.0 seconds.
LICENSE BSD
Reviewed-on: http://gerrit.openafs.org/696
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This patch set removes many but not all of the warnings
in the rx library.
- use AFS_PTR_FMT in dpf debugging output
- fix many signed vs unsigned warnings
- on Windows, the first parameter to select() is ignored.
Passing an osi_socket produces an unnecessary warning.
- In rx_SlowReadPacket and rx_SlowWritePacket, use 'r' the
unsigned value for internal computation and 'resid' for
holding the original value. This avoids many signed vs
unsigned warnings.
LICENSE BSD
Reviewed-on: http://gerrit.openafs.org/695
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The printf format specification for a pointer of any size is
just 'p'. The 'I' is only to be used for [duox].
Reviewed-on: http://gerrit.openafs.org/690
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
'static __inline' functions on HPUX can segfault the /opt/ansic compiler
(unless we lose debugging symbols). So, just use 'static' for those
functions on HPUX. Also revert a9368a6c3d,
so we get a static inline function on other platforms.
Reviewed-on: http://gerrit.openafs.org/691
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The pageoff macro is now unused. Remove it.
Reviewed-on: http://gerrit.openafs.org/689
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>