In need of testers

Jeffrey Altman <[email protected]> Mon, 05 Feb 2007 09:38:02 -0500
Newsgroups gmane.comp.file-systems.openafs.devel.win32
Organization Secure Endpoints Inc.
Message-ID <[email protected]>
Over the last two weeks I have been tracking down a data corruption
error in all previous Windows clients. 

Symptoms of the original report:

While appending to a file stored in AFS over a long period of time it is noticed that holes in the file filled with NULs begin to appear.

The actual bug:

CIFS Write requests are processed by the AFS SMB Server by updating the data in the local cache, then queuing a request for the data to be written to the file server by a background thread, and finally returning success to the CIFS client.  The background thread will dequeue one request at a time and process it regardless of whether or not the request is successfully completed.  If the volume becomes busy, is taken offline, or if the file server becomes inaccessible, the request will fail and the write operation will have been completed in the local cache but will never have been delivered to the file server.

The fix:

Modify the background thread processing to only pull requests off the queue if there is a likelihood that the request might succeed.  If a request fails for any reason, do not clear the dirty flag on the buffers that were being written.  If the request fails due to the volume being busy or offline, or the server being inaccessible, it is placed back on the head of the queue and it will be processed again the next time the server is marked as available.

Other Changes:

While working on the buffer management a number of other performance enhancements were implemented that will improve the response time of the cache and in particular ensure that more of the data in the cache is current.   The performance of read/write operations should be significantly improved in the situation where only a single AFS client is modifying the contents of a file.  


Complete list of changes since 1.5.14:

Since 1.5.14

 * A reference leak was discovered in the mountpoint traversal 
   functionality which resulted in cm_volume_t objects not becoming
   eligible for re-use.  This will trigger a panic condition when
   more than the maximum number of volumes is accessed.

 * Fixed the success test for the "fs memdump" operation.  Success
   is now reported as such.  Added cm_volume_t object information 
   to the dump file.

 * A data corruption error has been fixed.  Write requests
   queued for background processing were not retried upon failure.
   This leads to inconsistencies between the contents of the file
   in the local cache and the contents of the file on the file 
   server.  

   The implemented fix is to re-queue any request that has failed
   due to timeout, volume busy, volume offline, server busy, or
   server offline.  Requests are not processed while all servers
   for a volume are inaccessible.  When servers become accessible
   the background request will be retried.

   In addition, if a background write fails, do not mark the buffers
   as clean.  Failure to preserve the dirty flag prevents the buffers
   from being written to the file server in the future.

   This fix does not address the possibility that the credentials
   necessary to perform a write request might expire between the
   time the request is queued and when the request can be processed
   due to server accessibility.

 * The Freelance volume does not support per user ACLs.  The
   cm_HaveAccessRights function did not handle this special case.
   Requests for privileges greater than read|lookup would result
   in afsd_service.exe entering an infinite loop.  ISOBuster is
   known to cause this behavior.

 * When deleting files, the SMB Server would attempt to obtain
   the access permissions for the parent directory instead of 
   for the file itself.  This would result in an incorrect 
   assessment of whether or not the file can be deleted.

 * The Network Identity Manager AFS plug-in has had its string
   tables updated for consistency with the language used by NIM.
   All credentials are referred to as credentials instead of tokens.

 * The AFS Salvager was not properly being built on Windows.
   This is relevant only if the AFS servers are in use.

 * The default signal handlers for the AFS servers incorrectly
   processed SIGQUIT.  Instead of stopping the server, an
   exception was raised.

 * Fix another volume refcount leak.  This one was triggered by
   an inability to contact the vlservers in order to update the 
   file server list.

 * Fix checklist control used by the drive mappings tabs in 
   afscreds.exe and afs_control.exe.

 * Improve output of "fs memdump" related to buffer management.

 * Fix refcount leak of cm_buf_t objects when prefetching buffers
   already in the process of being fetched.

 * Improve cache performance by computing the buffer hash table
   size based upon the number of buffers so that the average 
   number of entries in a bucket is seven.

 * Improve cache performance of read/write data by locally 
   updating the dataVersion of all buffers associated with the
   file on each StoreData or StoreStatus operation provided that
   the dataVersion was incremented by one and the dataVersion of
   the buffer matched the original dataVersion of the cached 
   status information for the file.

Daily builds containing these modifications can be found at:

  /afs/athena.mit.edu/user/j/a/jaltman/Public/OpenAFS\
  \\afs\athena.mit.edu\user\j\a\jaltman\Public\OpenAFS\
  http://web.mit.edu/jaltman/Public/OpenAFS/

Builds labeled 1-5-20070205 or greater contain these changes.
Please report positive and negative results to this list.

Thanks.

Jeffrey Altman
smime.p7s (application/x-pkcs7-signature, 3.3 KB) - not displayed