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.
This patch disables the lookup of the user's AFSID and instead solves
the problem by tracking which cm_user_t created the file. If the user
is unable to obtain a write lock and is the creator, then we check for
the Insert bit. Otherwise, we deny access.
Vista has a bug in the Netbios ADAPTER_STATUS output in which the
first four bytes of the MAC address with 127.0.0.1. We must check
for that when searching for the Loopback Adapter.
when the cache manager is being frequently restarted (especially during
debugging) the 7001/udp port is often not freed appropriately. This
prevents the cache manager from running. This patch allows the cache
manager to retry with a random port number.
In order to make the client side locking more usable, if the client
is denied a lock by the server and the user only has read privileges,
then we will allocate a local lock. Local locks are not allocated
for write locks.
There is a bug in the file server locking dating back to at least
AFS 3.1 in which the lock privilege is used for read, write and insert
locks. According to the docs, the lock privilege is only supposed to
control read locks. Write locks on new and existing files are supposed
to be controlled by the Write and Insert privileges. This will be fixed
in the file server by another commit.
In order to properly handle the local allocation of locks
the cache manager must enforce the locking rules associated
with PRSFS_WRITE and PRSFS_INSERT and PRSFS_LOCK. Insert
affects "new files" which in AFS are defined as any file that
is owned by the user. Therefore, we must know the afsid of the
user so that it can be compared to owner of the file.
This commit includes a query using PR_SNameToId where the name
is the name specified by the entity setting the token. There
does not currently exist a Protection Service RPC to return the
AFSID of the entity that the rx connection was authenticated as.
Such a function will have to be added in order to make this
functionality secure.
====================
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.
====================
Export functions missing from the UNIX version and the PR_ functions
required by the Windows Cache Manager.
This patch adds code to perform return code error checking for all calls
to the ReadXyz() routines. If the rx connection was lost or if the dump
format being parsed was incorrect there was an opportunity for data to
the processed after an error had already been detected. In the best case
this would have simply resulted in additional work being performed when
it was not necessary but there was also the potential for modifying return
values which would later be used as input to later operations. Better
to simply catch the error when it initially occurs and be done with it.
The ReadString() function had the potential to write into one byte prior
to the start of the input array.
ProcessIndex() would not properly close Fdhandle nor the StreamHandle
if an error was detected.
RestoreVolume() had a problem with the processing of incremental dumps.
Originally AFS supported a concept of incrementals dumps which when
restored would simply add their contents to the existing volume. One
of the distinctions between the incremental and full dumps is that full
dump processing is responsible for removing any vnode entries from the
volume that are not present in the dump file headers. When the incremental
dump support was removed, the RestoreVolume() function was broken. If
a dump file contains multiple Dump Headers, then only the vnode entries
in the first Dump Header would be marked as being restored. Any vnode
entries restored from subsequent Dump Headers would be deleted when the
RestoreVolume() function reached the end. By removing the assignment
of 'tdelo = -1' within the loop that processes the Dump Headers, this
bug is resolved. Although RestoreVolume is only called with the
'incremental' parameter == 0 at the current time, the check for non-zero
values is restored and the "remove unrestored vnodes" functionality is
disabled when a non-zero value is provided.
The ReadVnodes() function did not perform error checking.
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.
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.
The old StoreData RPC is only supposed to be valid for files
smaller than 2GB. When StoreData64 was added, StoreData and StoreData64
were implemented as calls to common_StoreData64. This removed the bounds
checking on the old StoreData RPC making it possible for operations
beyond two 2GB to be requested even if the file server cannot support
them. This patch adds a validity check to ensure that the requested
file operations remain below 2GB. Failures return E2BIG.
as pointed out by cg2v@andrew.cmu.edu the addition of performance
collection data for the GetCapabilities RPC broke backward compatibility
with previous builds because it altered the size of the data structure
sent on the wire.
Instead we count the number of GetCapabilties calls but do not gather
performance timing data as this can be done using spare fields.
FIXES 25849
an interface which lets you select md5 based inode numbers, and the csupporting code
====================
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.
====================
FIXES 25849
an interface which lets you select md5 based inode numbers, and the c^?supportin
g code
Fix syntax error (missing braces)
Fix include file ordering
Don't declare *tmpdir extern, we're initializing it here (even though
there's no reason to)
Fix OnlyOneVolume args to match proto