Speed up the performance of the cache manager by not holding the
smb_fid_t mutex across calls to cm_SyncOp and AFS RPCs.
Ensure that all smb_fid_t flag references are protected.
(cherry picked from commit 87313c96b1271b4730a27dcee1b6c062b0a37425)
It is possible to have a valid callback but not to have the
required ACL info for the current user. Force acquisition of
a FetchStatus but do so without making multiple calls.
(cherry picked from commit 83732fdb158e79b64774667ee09fc1b81062707e)
Do not call cm_GetCallback() directly. Always
use cm_SyncOp(CM_SCACHESYNC_NEEDCALLBACK)
(cherry picked from commit 40415fe265d8e660f3698d8ab7f93004d589f902)
Dynamically adjust the priority of server threads based upon the age
of the cifs request that is being processed. Bump the priority one
level for each 15 seconds of age.
(cherry picked from commit 7ca1a339cb488fd97015e959e2a17e91e9b56409)
while investigating the cause of the delayed write errors it was observed
that all of the sleep queues are LIFO. This has the side effect of
encouraging starvation. Changing the queues to FIFOs revealed a serious
problem affecting the use of all queues which use both head and tail
pointers. The removal function osi_QRemove does not take a tail pointer
and therefore the pointer is always left hanging. If the number of elements
ever drops to zero the queue becomes corrupted.
Added osi_QRemoveHT to be used whenever head and tail pointers are used.
Updated all callers in afsd.
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
fix typo caused by pullup failure
(cherry picked from commit c1e79275079cfa68d73cc3a008c3fb3b201f1068)
Prevent smb_FindVCP from returning dead virtual circuits
Treat "*." as an alias for "all"
(cherry picked from commit b753ef7265b1970d1e38f3c65532af929102e1d6)
When the client changes IP addresses, in order to obtain optimal
performance it must:
(1) force the replacement of all existing rx connections
(2) ping all up and down servers
(cherry picked from commit 66596cc677e8cbf7fa40ad2962ccc4547692afb5)
A number of crash reports have been filed with Microsoft in afspthread.dll.
The crashes are occuring as the processes are terminating. In order to
attempt to address this problem this patch adds support for a DllMain()
entry point that is used to cleanup Thread Local Storage and the various
RX queues. One theory is that processes are loading and unloading DLLs
that are linked to afspthread.dll leaving the pthread data in a very
inconsistent state after each unload. By cleaning up the static data
during the unload, if afspthread is loading again it will be forced to
initialize the data once again.
(cherry picked from commit edff1e8788a2cadfd6bb9e08f9cfdbfb491924a6)
FIXES 31202
Remember to perform an OemToChar() conversion of the file name being
queried in Trans2QueryFileInfo
(cherry picked from commit 97a9d1964347e2b4b0f75e749b4d8f36d09fc876)
This patch fixes:
* race conditions around cm_Lock() calls that were not protected
by cm_SyncOp(LOCK) [asanka@secure-endpoints.com]
* deadlocks caused by obtaining smb_fid_t->mx after cm_scache_t->mx
* removes an extra Release smb_fid_t->mx that could result in
releasing a mutex that is not currently held
* changes the log representation of several return codes and fids to
be consistent with other output
(cherry picked from commit bf7404c3510d63b90c2cb15766f8455f79da90fe)
The 'active_vcp' variable is no longer being used for any useful
purpose and is the center of a race condition that could lead to
an undercount of references to 'vcp' objects. Remove it.
(cherry picked from commit f1ef60c020feffb73b2aee4c1871afba039afb67)
don't prevent all calls to getvolstatus, just the ones that are
not AFS pioctl calls.
(cherry picked from commit 632d0c701b31877b4d74f5f3849a5a8054f7326a)
An undercount has been detected of the smb_vc_t objects stored
in the smb_allVCsp list. Unfortunately, we have yet to be able
to find the cause of the undercount so this patch adds logic to
protect against the side effects until such time as the cause
can be identified.
(cherry picked from commit b9f22f0b7b9bf9aa746d3ef8ea63465b1cdadb97)
don't support functions we don't implement. the CIFS trans2 get info
ioctl is not equivalent to the AFS Get Volume Status function
(cherry picked from commit cea063c0d48bb81c6349298ecdf5dfcc0f39733b)
undo damage caused by an inadvertent pullup of code that caused all
servers to be marked down once every two hours. They would remain
down for one CheckDownServersInterval after the first contact to the
cell.
don't remove an entry from the queue and add it to the head if it already
is the head.
(cherry picked from commit bfdc909b5477e493656b3e9fb744fdf5cd16e179)
when adding a new server, mark it down to start.
this will allow the Ping to use the short timeout when checking the real
status.
(cherry picked from commit 8a6bfc54e5ff81bea0b78b45986f5115b2978adc)
several race conditions were introduced over the last couple of weeks.
let's fix them.
(cherry picked from commit d9d798f78617026349e3c087c714e474e9eb2b7f)
protect against the case in which the vcp->fidsp list is empty
which de-queuing smb_fid_t objects
(cherry picked from commit 81cfded7dbdf25d774375719ce02ebbfe698d77c)
Fix two bugs reported via Windows Crash Reporting:
* Freelance initialization is somehow broken allowing the number of
locally defined mountpoints to become negative. Due to the use of
!= instead of < in loops, it is possible to read/write unallocated
memory.
* GetTextualSid() was not properly handling a NULL output buffer
pointer as an indication that the desired size should be returned.
(cherry picked from commit 77de32ed745d912e35990c5602b4a69a1b654973)
* AFS_Logoff_Event must destroy tokens even if integrated logon is not
being used unless LogoffPreserveTokens is non-zero
(cherry picked from commit 18e7ef272ab4efbd599c5d10174f0afd87c57c2e)
* fix LogoffPreserveTokens to work in the correct direction
* modify behavior to avoid domain controller queries when integrated
logon is disabled or the logon account is local
(cherry picked from commit f213588374ab92e27bb524cd747152270f9290ca)
* cell names must be treated as case insensitive
* smb logoff messages do not mean the user is logging off the machine.
do not use as an indication that tokens should be destroyed
* use the correct lock and avoid a deadlock when handling dead VCs
(cherry picked from commit 22b02189ecc70a94410fb1648da987d0964ddcaf)
* remove all references to 'dead_vcp'; cleanup smb_vc_t's as soon as
we know they are dead
* add mx holds across the cm_cell_t updates
* add cm_FindSCacheParent() and remove duplicate code elsewhere
* add mx holds across scp->flags updates
* add cm_CleanFile()
* clear CM_SCACHEFLAG_CALLBACK when discarding callbacks
* fix smb fid wrapping. wrap at 0xFFFF instead of 0 because 0xFFFF
is -1 which is INVALID_HANDLE
* add missing mx holds around vcp->flags updates
(cherry picked from commit 8b39114d5b36f60904e5a615a16b43b7e65c3017)
Fixup token deletion logic
Surround all references to smb_fid_t flags and other references
by obtaining and releasing the 'mx' lock.
(cherry picked from commit bceabce8498127c550bbe5a9a430c8589f76d162)
Further testing revealed that some smb_vc_t objects could not be freed
because the associated smb_fid_t objects never reached a zero refcount.
Additional auditing uncovered cases in which there were holds not being
released and others in which they were released to many times. This
patch fixes the problems and improves auditability by modifying the
behavior of the smb_IoctlXXX() functions to not release a reference
that was obtained by the caller. Now the caller releases the reference.
* re-enable LogoffTokenTransferTimeout and LogoffTokenTransfer.
Tokens are now destroyed at logoff based upon the values specified
here. Default is ON and 120 seconds. Setting this to OFF will
result in tokens never being destroyed. This will leak memory.
* protect global queues with mutexes and avoid a variety of race
conditions.
(cherry picked from commit 97304b84f76154d067717e3b34a3525abebc0cf7)
This patch:
(1) removes the rest of the dead logoff code that was originally
stripped of any meaning by DELTA
winnt-win2000-win98-afs-client-updates-20010623.
(2) gives new meaning to smb_TokenTransfer and smb_TokenTransferTimeout.
these variables now control how long a smb_username_t and its
associated cm_user_t and its cm_cellinfo_t (including tokens)
will be preserved after a logoff.
(3) adds logic to detect logoff conditions
(4) adds cm_CheckVCs(). This function probes the SMB client with a ECHO
response to determine if the associated SMB virtual circuit is still
valid. This is executed once every five minutes by smb_Daemon()
and whenever the machine's IP addresses change. This allows
abandoned VCs to be detected and the associated user credentials,
file handles, and locks to be cleaned up. This will also prevent
the exhaustion of the limited number of SMB sessions.
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
and remember to mark the session dead so it can be re-used
====================
fix an error caused by patch conflict during pullup
(cherry picked from commit 7fde756a2c6f17e6a3b0db7659c6edcc2eaa0bd7)
The Integrated Logon hack of setting a token for a smb name different
than the one associated with the current smb session fails when smb
virtual circuits, sessions and username objects are properly reference
counted. When refcounts are not leaked the constructed smb_username_t
is destroyed immediately after the token is set since there are not
references to it from a current session.
The fix is to mark the smb_username_t object with a flag indicating that
it was created by the Network Provider. This flag prevents the destruction
when the refcount is zero so that it will be available at the time the
smb session is created (just a moment or two later.) During the binding
of the smb_username_t to the smb_vc_t the flag is cleared allowing the
tokens to be destroyed when the smb session is closed.
(cherry picked from commit 70b76b3a1cff1dabe9b10b8222cd84fc207b6704)
In smb_ReceiveNTCreateX the lock check, cm_CheckNTOpen(), must take place
before we allow the file to be truncated.
(cherry picked from commit d921ee381aa46e4385524f0c31ca5ad606aa920a)
This patch fixes several issues:
* the smb virtual circuits can be active and/or dead. this patch
improves the handling of vc's making the transition from active
to dead
* correct the refcounts on the smb_user_t and smb_vc_t objects
* replace the deprecated GetCurrentTime() with GetTickCounts() which
is the new name. This function needs to be replaced with something
else because its return value wraps after 49.7 days
* hold the correct locks when adjusting the scp->fileLocksH queue
(cherry picked from commit 880a6b66a5477e092d5bb74febbf24639d786c64)
the smb_username_t objects are reference counted but they were never
released on their own accord. Instead the smb_uid_t objects when
released were also cleaning up the smb_username_t. Since the smb_username_t
is reused, now that smb_user_t objects are being cleaned up, this was
a problem.
(cherry picked from commit a9df3ca715f483a31c14b72bae3f548a4c9291d4)