Index: openafs/src/WINNT/afsd/NTMakefile
diff -c openafs/src/WINNT/afsd/NTMakefile:1.27.2.12 openafs/src/WINNT/afsd/NTMakefile:1.27.2.13
*** openafs/src/WINNT/afsd/NTMakefile:1.27.2.12	Sat Oct 29 16:15:07 2005
--- openafs/src/WINNT/afsd/NTMakefile	Tue Jun  6 10:52:20 2006
***************
*** 499,504 ****
--- 499,505 ----
  	$(DEL) afsrpc.h
  	$(DEL) afsrpc_?.*
          $(DEL) afsd_eventmessages.h
+ 	$(DEL) MSG*.bin
  	$(DEL) $(CONF_DLLFILE)
  	$(DEL) $(LOGON_DLLFILE)
  	$(DEL) $(LOG95_DLLFILE)
Index: openafs/src/WINNT/afsd/afsd_service.c
diff -c openafs/src/WINNT/afsd/afsd_service.c:1.28.2.17 openafs/src/WINNT/afsd/afsd_service.c:1.28.2.18
*** openafs/src/WINNT/afsd/afsd_service.c:1.28.2.17	Tue Nov  8 22:05:33 2005
--- openafs/src/WINNT/afsd/afsd_service.c	Mon May  8 21:39:06 2006
***************
*** 288,294 ****
          /* XXX handle pause & continue */
      case SERVICE_CONTROL_POWEREVENT:                                              
          { 
!             afsi_log("SERVICE_CONTROL_POWEREVENT");
              /*                                                                                
              **	dwEventType of this notification == WPARAM of WM_POWERBROADCAST               
              **	Return NO_ERROR == return TRUE for that message, i.e. accept request          
--- 288,296 ----
          /* XXX handle pause & continue */
      case SERVICE_CONTROL_POWEREVENT:                                              
          { 
! #ifdef DEBUG
! 	    afsi_log("SERVICE_CONTROL_POWEREVENT");
! #endif
              /*                                                                                
              **	dwEventType of this notification == WPARAM of WM_POWERBROADCAST               
              **	Return NO_ERROR == return TRUE for that message, i.e. accept request          
***************
*** 337,347 ****
                      dwRet = NO_ERROR;                       
                      break;                                  
                  case PBT_APMPOWERSTATUSCHANGE:                                                    
!                     afsi_log("SERVICE_CONTROL_APMPOWERSTATUSCHANGE"); 
                      dwRet = NO_ERROR;                       
                      break;                                  
                  case PBT_APMOEMEVENT:                                                             
                      afsi_log("SERVICE_CONTROL_APMOEMEVENT"); 
                      dwRet = NO_ERROR;                       
                      break;                                  
                  case PBT_APMRESUMEAUTOMATIC:                                                      
--- 339,353 ----
                      dwRet = NO_ERROR;                       
                      break;                                  
                  case PBT_APMPOWERSTATUSCHANGE:                                                    
! #ifdef DEBUG
! 		    afsi_log("SERVICE_CONTROL_APMPOWERSTATUSCHANGE");
! #endif
                      dwRet = NO_ERROR;                       
                      break;                                  
                  case PBT_APMOEMEVENT:                                                             
+ #ifdef DEBUG
                      afsi_log("SERVICE_CONTROL_APMOEMEVENT"); 
+ #endif
                      dwRet = NO_ERROR;                       
                      break;                                  
                  case PBT_APMRESUMEAUTOMATIC:                                                      
Index: openafs/src/WINNT/afsd/cm_access.c
diff -c openafs/src/WINNT/afsd/cm_access.c:1.4.2.2 openafs/src/WINNT/afsd/cm_access.c:1.4.2.4
*** openafs/src/WINNT/afsd/cm_access.c:1.4.2.2	Fri Mar 11 01:58:39 2005
--- openafs/src/WINNT/afsd/cm_access.c	Sun May 28 19:09:52 2006
***************
*** 119,124 ****
--- 119,125 ----
      long code;
      cm_fid_t tfid;
      cm_scache_t *aclScp;
+     int got_cb = 0;
  
      /* pretty easy: just force a pass through the fetch status code */
          
***************
*** 127,136 ****
      /* first, start by finding out whether we have a directory or something
       * else, so we can find what object's ACL we need.
       */
!     code = cm_SyncOp(scp, NULL, up, reqp, 0, CM_SCACHESYNC_GETSTATUS
!                       | CM_SCACHESYNC_NEEDCALLBACK);
!     if (code) 
!         return code;
          
      if (scp->fileType != CM_SCACHETYPE_DIRECTORY) {
          /* not a dir, use parent dir's acl */
--- 128,141 ----
      /* first, start by finding out whether we have a directory or something
       * else, so we can find what object's ACL we need.
       */
!     if (!cm_HaveCallback(scp)) {
! 	code = cm_SyncOp(scp, NULL, up, reqp, 0, 
! 			 CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
! 	if (code) 
! 	    return code;
! 
! 	got_cb = 1;
!     }
          
      if (scp->fileType != CM_SCACHETYPE_DIRECTORY) {
          /* not a dir, use parent dir's acl */
***************
*** 145,158 ****
              return code;
          }       
                  
!         osi_Log1(afsd_logp, "GetAccess parent %x", aclScp);
          lock_ObtainMutex(&aclScp->mx);
!         code = cm_GetCallback(aclScp, up, reqp, 1);
!         lock_ReleaseMutex(&aclScp->mx);
          cm_ReleaseSCache(aclScp);
          lock_ObtainMutex(&scp->mx);
!     } else {
!         code = cm_GetCallback(scp, up, reqp, 1);
      }
  
      return code;
--- 150,163 ----
              return code;
          }       
                  
!         osi_Log1(afsd_logp, "GetAccess parent scp %x user %x", aclScp, up);
          lock_ObtainMutex(&aclScp->mx);
!      	code = cm_GetCallback(aclScp, up, reqp, 1);
! 	lock_ReleaseMutex(&aclScp->mx);
          cm_ReleaseSCache(aclScp);
          lock_ObtainMutex(&scp->mx);
!     } else if (!got_cb) {
! 	code = cm_GetCallback(scp, up, reqp, 1);
      }
  
      return code;
Index: openafs/src/WINNT/afsd/cm_aclent.c
diff -c openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.9 openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.10
*** openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.9	Mon Feb 13 11:33:06 2006
--- openafs/src/WINNT/afsd/cm_aclent.c	Thu May 25 13:18:43 2006
***************
*** 82,88 ****
          if (aclp->userp == userp) {
              if (aclp->tgtLifetime && aclp->tgtLifetime <= osi_Time()) {
                  /* ticket expired */
!                 osi_QRemove((osi_queue_t **) &cm_data.aclLRUp, &aclp->q);
                  CleanupACLEnt(aclp);
  
                  /* move to the tail of the LRU queue */
--- 82,88 ----
          if (aclp->userp == userp) {
              if (aclp->tgtLifetime && aclp->tgtLifetime <= osi_Time()) {
                  /* ticket expired */
!                 osi_QRemoveHT((osi_queue_t **) &cm_data.aclLRUp, (osi_queue_t **) &cm_data.aclLRUEndp, &aclp->q);
                  CleanupACLEnt(aclp);
  
                  /* move to the tail of the LRU queue */
***************
*** 96,102 ****
  			cm_data.aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q);
  
  		    /* move to the head of the LRU queue */
! 		    osi_QRemove((osi_queue_t **) &cm_data.aclLRUp, &aclp->q);
  		    osi_QAddH((osi_queue_t **) &cm_data.aclLRUp,
  			       (osi_queue_t **) &cm_data.aclLRUEndp,
  			       &aclp->q);
--- 96,102 ----
  			cm_data.aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q);
  
  		    /* move to the head of the LRU queue */
! 		    osi_QRemoveHT((osi_queue_t **) &cm_data.aclLRUp, (osi_queue_t **) &cm_data.aclLRUEndp, &aclp->q);
  		    osi_QAddH((osi_queue_t **) &cm_data.aclLRUp,
  			       (osi_queue_t **) &cm_data.aclLRUEndp,
  			       &aclp->q);
***************
*** 125,131 ****
  
      aclp = cm_data.aclLRUEndp;
      cm_data.aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q);
!     osi_QRemove((osi_queue_t **) &cm_data.aclLRUp, &aclp->q);
  
      if (aclp->backp && scp != aclp->backp) {
          ascp = aclp->backp;
--- 125,131 ----
  
      aclp = cm_data.aclLRUEndp;
      cm_data.aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q);
!     osi_QRemoveHT((osi_queue_t **) &cm_data.aclLRUp, (osi_queue_t **) &cm_data.aclLRUEndp, &aclp->q);
  
      if (aclp->backp && scp != aclp->backp) {
          ascp = aclp->backp;
Index: openafs/src/WINNT/afsd/cm_buf.c
diff -c openafs/src/WINNT/afsd/cm_buf.c:1.13.2.14 openafs/src/WINNT/afsd/cm_buf.c:1.13.2.16
*** openafs/src/WINNT/afsd/cm_buf.c:1.13.2.14	Sat Aug 27 23:30:57 2005
--- openafs/src/WINNT/afsd/cm_buf.c	Fri May 26 02:38:05 2006
***************
*** 462,467 ****
--- 462,470 ----
              bp->waitCount = bp->waitRequests = 1;
          }
          osi_SleepM((long) bp, &bp->mx);
+ 
+ 	smb_UpdateServerPriority();
+ 
          lock_ObtainMutex(&bp->mx);
          osi_Log1(afsd_logp, "buf_WaitIO conflict wait done for 0x%x", bp);
          bp->waitCount--;
***************
*** 877,883 ****
       */
      lock_ReleaseMutex(&bp->mx);
      *bufpp = bp;
!     osi_Log3(buf_logp, "buf_GetNew returning bp 0x%x for file 0x%x, offset 0x%x",
                bp, (long) scp, offsetp->LowPart);
      return 0;
  }
--- 880,886 ----
       */
      lock_ReleaseMutex(&bp->mx);
      *bufpp = bp;
!     osi_Log3(buf_logp, "buf_GetNew returning bp 0x%x for scp 0x%x, offset 0x%x",
                bp, (long) scp, offsetp->LowPart);
      return 0;
  }
***************
*** 1024,1030 ****
      }
      lock_ReleaseWrite(&buf_globalLock);
  
!     osi_Log3(buf_logp, "buf_Get returning bp 0x%x for file 0x%x, offset 0x%x",
                bp, (long) scp, offsetp->LowPart);
  #ifdef TESTING
      buf_ValidateBufQueues();
--- 1027,1033 ----
      }
      lock_ReleaseWrite(&buf_globalLock);
  
!     osi_Log3(buf_logp, "buf_Get returning bp 0x%x for scp 0x%x, offset 0x%x",
                bp, (long) scp, offsetp->LowPart);
  #ifdef TESTING
      buf_ValidateBufQueues();
Index: openafs/src/WINNT/afsd/cm_callback.c
diff -c openafs/src/WINNT/afsd/cm_callback.c:1.20.2.13 openafs/src/WINNT/afsd/cm_callback.c:1.20.2.14
*** openafs/src/WINNT/afsd/cm_callback.c:1.20.2.13	Sun Jan 15 21:06:59 2006
--- openafs/src/WINNT/afsd/cm_callback.c	Sun May 28 19:09:52 2006
***************
*** 1662,1668 ****
  
          /* otherwise, we have to make an RPC to get the status */
          sflags = CM_SCACHESYNC_FETCHSTATUS | CM_SCACHESYNC_GETCALLBACK;
!         cm_SyncOp(scp, NULL, NULL, NULL, 0, sflags);
          cm_StartCallbackGrantingCall(scp, &cbr);
          sfid = scp->fid;
          lock_ReleaseMutex(&scp->mx);
--- 1662,1668 ----
  
          /* otherwise, we have to make an RPC to get the status */
          sflags = CM_SCACHESYNC_FETCHSTATUS | CM_SCACHESYNC_GETCALLBACK;
!         cm_SyncOp(scp, NULL, userp, reqp, 0, sflags);
          cm_StartCallbackGrantingCall(scp, &cbr);
          sfid = scp->fid;
          lock_ReleaseMutex(&scp->mx);
Index: openafs/src/WINNT/afsd/cm_conn.c
diff -c openafs/src/WINNT/afsd/cm_conn.c:1.25.2.20 openafs/src/WINNT/afsd/cm_conn.c:1.25.2.21
*** openafs/src/WINNT/afsd/cm_conn.c:1.25.2.20	Wed Feb  1 13:03:18 2006
--- openafs/src/WINNT/afsd/cm_conn.c	Sat Jun  3 13:57:12 2006
***************
*** 406,416 ****
  	    cm_scache_t * scp;
  	    osi_Log4(afsd_logp, "cm_Analyze passed VNOVNODE cell %u vol %u vn %u uniq %u.",
  		      fidp->cell, fidp->volume, fidp->vnode, fidp->unique);
  	    scp = cm_FindSCache(fidp);
  	    if (scp) {
! 		cm_scache_t *pscp = cm_FindSCacheParent(scp);
! 		cm_CleanFile(scp, userp, reqp);
! 		cm_ReleaseSCache(scp);
  		if (pscp) {
  		    if (pscp->cbExpires > 0 && pscp->cbServerp != NULL) {
  			lock_ObtainMutex(&pscp->mx);
--- 406,423 ----
  	    cm_scache_t * scp;
  	    osi_Log4(afsd_logp, "cm_Analyze passed VNOVNODE cell %u vol %u vn %u uniq %u.",
  		      fidp->cell, fidp->volume, fidp->vnode, fidp->unique);
+ 
  	    scp = cm_FindSCache(fidp);
  	    if (scp) {
! 		cm_scache_t *pscp = NULL;
! 		
! 		if (scp->fileType != CM_SCACHETYPE_DIRECTORY)
! 		    pscp = cm_FindSCacheParent(scp);
! 
! 		lock_ObtainWrite(&cm_scacheLock);
! 		cm_RecycleSCache(scp, CM_SCACHE_RECYCLEFLAG_DESTROY_BUFFERS);
! 		lock_ReleaseWrite(&cm_scacheLock);
! 
  		if (pscp) {
  		    if (pscp->cbExpires > 0 && pscp->cbServerp != NULL) {
  			lock_ObtainMutex(&pscp->mx);
***************
*** 505,510 ****
--- 512,569 ----
              case VREADONLY         : s = "VREADONLY";          break;
              case EAGAIN            : s = "EAGAIN";             break;
              case EACCES            : s = "EACCES";             break;
+ 	    case ENOENT            : s = "ENOENT";             break;
+             case CM_ERROR_NOSUCHCELL	    : s = "CM_ERROR_NOSUCHCELL";         break; 			
+             case CM_ERROR_NOSUCHVOLUME	    : s = "CM_ERROR_NOSUCHVOLUME";       break; 			
+             case CM_ERROR_TIMEDOUT	    : s = "CM_ERROR_TIMEDOUT";           break; 		
+             case CM_ERROR_RETRY		    : s = "CM_ERROR_RETRY";              break; 
+             case CM_ERROR_NOACCESS	    : s = "CM_ERROR_NOACCESS";           break; 
+             case CM_ERROR_NOSUCHFILE	    : s = "CM_ERROR_NOSUCHFILE";         break; 			
+             case CM_ERROR_STOPNOW	    : s = "CM_ERROR_STOPNOW";            break; 			
+             case CM_ERROR_TOOBIG	    : s = "CM_ERROR_TOOBIG";             break; 				
+             case CM_ERROR_INVAL		    : s = "CM_ERROR_INVAL";              break; 				
+             case CM_ERROR_BADFD		    : s = "CM_ERROR_BADFD";              break; 				
+             case CM_ERROR_BADFDOP	    : s = "CM_ERROR_BADFDOP";            break; 			
+             case CM_ERROR_EXISTS	    : s = "CM_ERROR_EXISTS";             break; 				
+             case CM_ERROR_CROSSDEVLINK	    : s = "CM_ERROR_CROSSDEVLINK";       break; 			
+             case CM_ERROR_BADOP		    : s = "CM_ERROR_BADOP";              break; 				
+             case CM_ERROR_BADPASSWORD       : s = "CM_ERROR_BADPASSWORD";        break;         
+             case CM_ERROR_NOTDIR	    : s = "CM_ERROR_NOTDIR";             break; 				
+             case CM_ERROR_ISDIR		    : s = "CM_ERROR_ISDIR";              break; 				
+             case CM_ERROR_READONLY	    : s = "CM_ERROR_READONLY";           break; 			
+             case CM_ERROR_WOULDBLOCK	    : s = "CM_ERROR_WOULDBLOCK";         break; 			
+             case CM_ERROR_QUOTA		    : s = "CM_ERROR_QUOTA";              break; 				
+             case CM_ERROR_SPACE		    : s = "CM_ERROR_SPACE";              break; 				
+             case CM_ERROR_BADSHARENAME	    : s = "CM_ERROR_BADSHARENAME";       break; 			
+             case CM_ERROR_BADTID	    : s = "CM_ERROR_BADTID";             break; 				
+             case CM_ERROR_UNKNOWN	    : s = "CM_ERROR_UNKNOWN";            break; 			
+             case CM_ERROR_NOMORETOKENS	    : s = "CM_ERROR_NOMORETOKENS";       break; 			
+             case CM_ERROR_NOTEMPTY	    : s = "CM_ERROR_NOTEMPTY";           break; 			
+             case CM_ERROR_USESTD	    : s = "CM_ERROR_USESTD";             break; 				
+             case CM_ERROR_REMOTECONN	    : s = "CM_ERROR_REMOTECONN";         break; 			
+             case CM_ERROR_ATSYS		    : s = "CM_ERROR_ATSYS";              break; 				
+             case CM_ERROR_NOSUCHPATH	    : s = "CM_ERROR_NOSUCHPATH";         break; 			
+             case CM_ERROR_CLOCKSKEW	    : s = "CM_ERROR_CLOCKSKEW";          break; 			
+             case CM_ERROR_BADSMB	    : s = "CM_ERROR_BADSMB";             break; 				
+             case CM_ERROR_ALLBUSY	    : s = "CM_ERROR_ALLBUSY";            break; 			
+             case CM_ERROR_NOFILES	    : s = "CM_ERROR_NOFILES";            break; 			
+             case CM_ERROR_PARTIALWRITE	    : s = "CM_ERROR_PARTIALWRITE";       break; 			
+             case CM_ERROR_NOIPC		    : s = "CM_ERROR_NOIPC";              break; 				
+             case CM_ERROR_BADNTFILENAME	    : s = "CM_ERROR_BADNTFILENAME";      break; 			
+             case CM_ERROR_BUFFERTOOSMALL    : s = "CM_ERROR_BUFFERTOOSMALL";     break; 			
+             case CM_ERROR_RENAME_IDENTICAL  : s = "CM_ERROR_RENAME_IDENTICAL";   break; 		
+             case CM_ERROR_ALLOFFLINE        : s = "CM_ERROR_ALLOFFLINE";         break;          
+             case CM_ERROR_AMBIGUOUS_FILENAME: s = "CM_ERROR_AMBIGUOUS_FILENAME"; break;  
+             case CM_ERROR_BADLOGONTYPE	    : s = "CM_ERROR_BADLOGONTYPE";       break; 	    
+             case CM_ERROR_GSSCONTINUE       : s = "CM_ERROR_GSSCONTINUE";        break;         
+             case CM_ERROR_TIDIPC            : s = "CM_ERROR_TIDIPC";             break;              
+             case CM_ERROR_TOO_MANY_SYMLINKS : s = "CM_ERROR_TOO_MANY_SYMLINKS";  break;   
+             case CM_ERROR_PATH_NOT_COVERED  : s = "CM_ERROR_PATH_NOT_COVERED";   break;    
+             case CM_ERROR_LOCK_CONFLICT     : s = "CM_ERROR_LOCK_CONFLICT";      break;       
+             case CM_ERROR_SHARING_VIOLATION : s = "CM_ERROR_SHARING_VIOLATION";  break;   
+             case CM_ERROR_ALLDOWN           : s = "CM_ERROR_ALLDOWN";            break;             
+             case CM_ERROR_TOOFEWBUFS	    : s = "CM_ERROR_TOOFEWBUFS";         break; 			
+             case CM_ERROR_TOOMANYBUFS	    : s = "CM_ERROR_TOOMANYBUFS";        break; 			
              }
              osi_Log2(afsd_logp, "cm_Analyze: ignoring error code 0x%x (%s)", 
                       errorCode, s);
Index: openafs/src/WINNT/afsd/cm_daemon.c
diff -c openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.10 openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.11
*** openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.10	Sat Jan 21 15:58:39 2006
--- openafs/src/WINNT/afsd/cm_daemon.c	Tue May  9 01:20:40 2006
***************
*** 58,64 ****
  	if (Result == NO_ERROR && daemon_ShutdownFlag == 0) {
  	    osi_Log0(afsd_logp, "cm_IpAddrDaemon CheckDownServers");
  	    Sleep(2500);
!             cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL);
  	    smb_CheckVCs();
  	}	
      }
--- 58,65 ----
  	if (Result == NO_ERROR && daemon_ShutdownFlag == 0) {
  	    osi_Log0(afsd_logp, "cm_IpAddrDaemon CheckDownServers");
  	    Sleep(2500);
! 	    cm_ForceNewConnectionsAllServers();
!             cm_CheckServers(CM_FLAG_CHECKUPSERVERS | CM_FLAG_CHECKDOWNSERVERS, NULL);
  	    smb_CheckVCs();
  	}	
      }
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.33.2.27 openafs/src/WINNT/afsd/cm_ioctl.c:1.33.2.28
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.33.2.27	Sun Apr  9 03:29:37 2006
--- openafs/src/WINNT/afsd/cm_ioctl.c	Sat Jun  3 13:57:12 2006
***************
*** 83,88 ****
--- 83,95 ----
  {
      long code;
  
+ #ifdef AFS_FREELANCE_CLIENT
+     if ( scp->fid.cell == AFS_FAKE_ROOT_CELL_ID && scp->fid.volume == AFS_FAKE_ROOT_VOL_ID ) {
+ 	cm_noteLocalMountPointChange();
+ 	return 0;
+     }
+ #endif
+ 
      lock_ObtainWrite(&scp->bufCreateLock);
      code = buf_FlushCleanPages(scp, userp, reqp);
          
***************
*** 105,111 ****
  
      /* now flush the file */
      code = cm_FlushFile(pscp, userp, reqp);
!     cm_ReleaseSCache(scp);
  
      return code;
  }
--- 112,118 ----
  
      /* now flush the file */
      code = cm_FlushFile(pscp, userp, reqp);
!     cm_ReleaseSCache(pscp);
  
      return code;
  }
***************
*** 117,122 ****
--- 124,136 ----
      cm_scache_t *scp;
      int i;
  
+ #ifdef AFS_FREELANCE_CLIENT
+     if ( cell == AFS_FAKE_ROOT_CELL_ID && volume == AFS_FAKE_ROOT_VOL_ID ) {
+ 	cm_noteLocalMountPointChange();
+ 	return 0;
+     }
+ #endif
+ 
      lock_ObtainWrite(&cm_scacheLock);
      for (i=0; i<cm_data.hashTableSize; i++) {
          for (scp = cm_data.hashTablep[i]; scp; scp = scp->nextp) {
Index: openafs/src/WINNT/afsd/cm_scache.c
diff -c openafs/src/WINNT/afsd/cm_scache.c:1.14.2.15 openafs/src/WINNT/afsd/cm_scache.c:1.14.2.19
*** openafs/src/WINNT/afsd/cm_scache.c:1.14.2.15	Wed Feb  1 13:03:18 2006
--- openafs/src/WINNT/afsd/cm_scache.c	Sat Jun  3 13:57:12 2006
***************
*** 46,67 ****
  {
      if (scp == cm_data.scacheLRULastp)
          cm_data.scacheLRULastp = (cm_scache_t *) osi_QPrev(&scp->q);
!     osi_QRemove((osi_queue_t **) &cm_data.scacheLRUFirstp, &scp->q);
      osi_QAdd((osi_queue_t **) &cm_data.scacheLRUFirstp, &scp->q);
      if (!cm_data.scacheLRULastp) 
          cm_data.scacheLRULastp = scp;
  }
  
  /* called with cm_scacheLock write-locked; find a vnode to recycle.
   * Can allocate a new one if desperate, or if below quota (cm_data.maxSCaches).
   */
  cm_scache_t *cm_GetNewSCache(void)
  {
      cm_scache_t *scp;
-     int i;
-     cm_scache_t **lscpp;
-     cm_scache_t *tscp;
  
      if (cm_data.currentSCaches >= cm_data.maxSCaches) {
          for (scp = cm_data.scacheLRULastp;
                scp;
--- 46,201 ----
  {
      if (scp == cm_data.scacheLRULastp)
          cm_data.scacheLRULastp = (cm_scache_t *) osi_QPrev(&scp->q);
!     osi_QRemoveHT((osi_queue_t **) &cm_data.scacheLRUFirstp, (osi_queue_t **) &cm_data.scacheLRULastp, &scp->q);
      osi_QAdd((osi_queue_t **) &cm_data.scacheLRUFirstp, &scp->q);
      if (!cm_data.scacheLRULastp) 
          cm_data.scacheLRULastp = scp;
  }
  
+ /* called with cm_scacheLock write-locked; recycles an existing scp. */
+ long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags)
+ {
+     cm_scache_t **lscpp;
+     cm_scache_t *tscp;
+     int i;
+ 
+ #ifdef AFS_FREELANCE_CLIENT
+     /* Do not recycle Freelance cache entries */
+     if ( cm_freelanceEnabled && 
+          scp->fid.cell==AFS_FAKE_ROOT_CELL_ID &&
+          scp->fid.volume==AFS_FAKE_ROOT_VOL_ID )
+ 	return -1;
+ #endif /* AFS_FREELANCE_CLIENT */
+ 
+ 
+     if (scp->flags & CM_SCACHEFLAG_INHASH) {
+ 	/* hash it out first */
+ 	i = CM_SCACHE_HASH(&scp->fid);
+ 	for (lscpp = &cm_data.hashTablep[i], tscp = cm_data.hashTablep[i];
+ 	      tscp;
+ 	      lscpp = &tscp->nextp, tscp = tscp->nextp) {
+ 	    if (tscp == scp) {
+ 		*lscpp = scp->nextp;
+ 		scp->flags &= ~CM_SCACHEFLAG_INHASH;
+ 		break;
+ 	    }
+ 	}
+ 	osi_assertx(tscp, "afsd: scache hash screwup");
+     }
+ 
+     if (flags & CM_SCACHE_RECYCLEFLAG_DESTROY_BUFFERS) {
+ 	osi_queueData_t *qdp;
+ 	cm_buf_t *bufp;
+ 
+ 	while(qdp = scp->bufWritesp) {
+             bufp = osi_GetQData(qdp);
+ 	    osi_QRemove((osi_queue_t **) &scp->bufWritesp, &qdp->q);
+ 	    osi_QDFree(qdp);
+ 	    if (bufp) {
+ 		lock_ObtainMutex(&bufp->mx);
+ 		bufp->cmFlags &= ~CM_BUF_CMSTORING;
+ 		bufp->flags &= ~CM_BUF_DIRTY;
+ 		bufp->dataVersion = -1; /* bad */
+ 		bufp->dirtyCounter++;
+ 		if (bufp->flags & CM_BUF_WAITING) {
+ 		    osi_Log2(afsd_logp, "CM RecycleSCache Waking [scp 0x%x] bufp 0x%x", scp, bufp);
+ 		    osi_Wakeup((long) &bufp);
+ 		}
+ 		lock_ReleaseMutex(&bufp->mx);
+ 		buf_Release(bufp);
+ 	    }
+         }
+ 	while(qdp = scp->bufReadsp) {
+             bufp = osi_GetQData(qdp);
+ 	    osi_QRemove((osi_queue_t **) &scp->bufReadsp, &qdp->q);
+ 	    osi_QDFree(qdp);
+ 	    if (bufp) {
+ 		lock_ObtainMutex(&bufp->mx);
+ 		bufp->cmFlags &= ~CM_BUF_CMFETCHING;
+ 		bufp->flags &= ~CM_BUF_DIRTY;
+ 		bufp->dataVersion = -1; /* bad */
+ 		bufp->dirtyCounter++;
+ 		if (bufp->flags & CM_BUF_WAITING) {
+ 		    osi_Log2(afsd_logp, "CM RecycleSCache Waking [scp 0x%x] bufp 0x%x", scp, bufp);
+ 		    osi_Wakeup((long) &bufp);
+ 		}
+ 		lock_ReleaseMutex(&bufp->mx);
+ 		buf_Release(bufp);
+ 	    }
+         }
+     } else {
+ 	/* look for things that shouldn't still be set */
+ 	osi_assert(scp->bufWritesp == NULL);
+ 	osi_assert(scp->bufReadsp == NULL);
+     }
+ 
+     /* invalidate so next merge works fine;
+      * also initialize some flags */
+     scp->flags &= ~(CM_SCACHEFLAG_STATD
+ 		     | CM_SCACHEFLAG_RO
+ 		     | CM_SCACHEFLAG_PURERO
+ 		     | CM_SCACHEFLAG_OVERQUOTA
+ 		     | CM_SCACHEFLAG_OUTOFSPACE);
+     scp->serverModTime = 0;
+     scp->dataVersion = 0;
+     scp->bulkStatProgress = hzero;
+     scp->waitCount = 0;
+ 
+     scp->fid.vnode = 0;
+     scp->fid.volume = 0;
+     scp->fid.unique = 0;
+     scp->fid.cell = 0;
+ 
+     /* discard callback */
+     if (scp->cbServerp) {
+ 	cm_PutServer(scp->cbServerp);
+ 	scp->cbServerp = NULL;
+     }
+     scp->cbExpires = 0;
+ 
+     /* remove from dnlc */
+     cm_dnlcPurgedp(scp);
+     cm_dnlcPurgevp(scp);
+ 
+     /* discard cached status; if non-zero, Close
+      * tried to store this to server but failed */
+     scp->mask = 0;
+ 
+     /* drop held volume ref */
+     if (scp->volp) {
+ 	cm_PutVolume(scp->volp);
+ 	scp->volp = NULL;
+     }
+ 
+     /* discard symlink info */
+     scp->mountPointStringp[0] = 0;
+     memset(&scp->mountRootFid, 0, sizeof(cm_fid_t));
+     memset(&scp->dotdotFid, 0, sizeof(cm_fid_t));
+ 
+     /* reset locking info */
+     scp->fileLocksH = NULL;
+     scp->fileLocksT = NULL;
+     scp->serverLock = (-1);
+     scp->exclusiveLocks = 0;
+     scp->sharedLocks = 0;
+ 
+     /* not locked, but there can be no references to this guy
+      * while we hold the global refcount lock.
+      */
+     cm_FreeAllACLEnts(scp);
+ 
+     return 0;
+ }
+ 
+ 
  /* called with cm_scacheLock write-locked; find a vnode to recycle.
   * Can allocate a new one if desperate, or if below quota (cm_data.maxSCaches).
   */
  cm_scache_t *cm_GetNewSCache(void)
  {
      cm_scache_t *scp;
  
+   start:
      if (cm_data.currentSCaches >= cm_data.maxSCaches) {
          for (scp = cm_data.scacheLRULastp;
                scp;
***************
*** 72,159 ****
                  
          if (scp) {
              osi_assert(scp >= cm_data.scacheBaseAddress && scp < (cm_scache_t *)cm_data.hashTablep);
-             /* we found an entry, so return it */
-             if (scp->flags & CM_SCACHEFLAG_INHASH) {
-                 /* hash it out first */
-                 i = CM_SCACHE_HASH(&scp->fid);
-                 for (lscpp = &cm_data.hashTablep[i], tscp = cm_data.hashTablep[i];
-                       tscp;
-                       lscpp = &tscp->nextp, tscp = tscp->nextp) {
-                     if (tscp == scp) {
-                         *lscpp = scp->nextp;
-                         scp->flags &= ~CM_SCACHEFLAG_INHASH;
-                         break;
-                     }
-                 }
-                 osi_assertx(tscp, "afsd: scache hash screwup");
-             }
- 
-             /* look for things that shouldn't still be set */
-             osi_assert(scp->bufWritesp == NULL);
-             osi_assert(scp->bufReadsp == NULL);
- 
-             /* invalidate so next merge works fine;
-             * also initialize some flags */
-             scp->flags &= ~(CM_SCACHEFLAG_STATD
-                              | CM_SCACHEFLAG_RO
-                              | CM_SCACHEFLAG_PURERO
-                              | CM_SCACHEFLAG_OVERQUOTA
-                              | CM_SCACHEFLAG_OUTOFSPACE);
-             scp->serverModTime = 0;
-             scp->dataVersion = 0;
-             scp->bulkStatProgress = hzero;
-             scp->waitCount = 0;
- 
-             scp->fid.vnode = 0;
-             scp->fid.volume = 0;
-             scp->fid.unique = 0;
-             scp->fid.cell = 0;
- 
-             /* discard callback */
-             if (scp->cbServerp) {
-                 cm_PutServer(scp->cbServerp);
-                 scp->cbServerp = NULL;
-             }
-             scp->cbExpires = 0;
- 
-             /* remove from dnlc */
-             cm_dnlcPurgedp(scp);
-             cm_dnlcPurgevp(scp);
- 
-             /* discard cached status; if non-zero, Close
-              * tried to store this to server but failed */
-             scp->mask = 0;
- 
-             /* drop held volume ref */
-             if (scp->volp) {
-                 cm_PutVolume(scp->volp);
-                 scp->volp = NULL;
-             }
- 
-             /* discard symlink info */
-             scp->mountPointStringp[0] = 0;
-             memset(&scp->mountRootFid, 0, sizeof(cm_fid_t));
-             memset(&scp->dotdotFid, 0, sizeof(cm_fid_t));
- 
-             /* reset locking info */
-             scp->fileLocksH = NULL;
-             scp->fileLocksT = NULL;
-             scp->serverLock = (-1);
-             scp->exclusiveLocks = 0;
-             scp->sharedLocks = 0;
- 
-             /* not locked, but there can be no references to this guy
-              * while we hold the global refcount lock.
-              */
-             cm_FreeAllACLEnts(scp);
- 
-             /* now remove from the LRU queue and put it back at the
-              * head of the LRU queue.
-              */
-             cm_AdjustLRU(scp);
  
!             /* and we're done */
!             return scp;
          }
      }
          
--- 206,226 ----
                  
          if (scp) {
              osi_assert(scp >= cm_data.scacheBaseAddress && scp < (cm_scache_t *)cm_data.hashTablep);
  
! 	    if (!cm_RecycleSCache(scp, 0)) {
! 	    
! 		/* we found an entry, so return it */
! 		/* now remove from the LRU queue and put it back at the
! 		 * head of the LRU queue.
! 		 */
! 		cm_AdjustLRU(scp);
! 
! 		/* and we're done */
! 		return scp;
! 	    } else {
! 		/* We don't like this entry, choose another one. */
! 		goto start;
! 	    }
          }
      }
          
***************
*** 854,860 ****
              if (!cm_HaveCallback(scp)) {
                  osi_Log1(afsd_logp, "CM SyncOp getting callback on scp %x",
                            (long) scp);
!                 if (bufLocked) lock_ReleaseMutex(&bufp->mx);
                  code = cm_GetCallback(scp, up, reqp, 0);
                  if (bufLocked) {
                      lock_ReleaseMutex(&scp->mx);
--- 921,928 ----
              if (!cm_HaveCallback(scp)) {
                  osi_Log1(afsd_logp, "CM SyncOp getting callback on scp %x",
                            (long) scp);
!                 if (bufLocked) 
! 		    lock_ReleaseMutex(&bufp->mx);
                  code = cm_GetCallback(scp, up, reqp, 0);
                  if (bufLocked) {
                      lock_ReleaseMutex(&scp->mx);
***************
*** 917,922 ****
--- 985,993 ----
          if (bufLocked) 
              lock_ReleaseMutex(&bufp->mx);
          osi_SleepM((long) &scp->flags, &scp->mx);
+ 
+ 	smb_UpdateServerPriority();
+ 
          if (bufLocked) 
              lock_ObtainMutex(&bufp->mx);
          lock_ObtainMutex(&scp->mx);
Index: openafs/src/WINNT/afsd/cm_scache.h
diff -c openafs/src/WINNT/afsd/cm_scache.h:1.4.2.12 openafs/src/WINNT/afsd/cm_scache.h:1.4.2.13
*** openafs/src/WINNT/afsd/cm_scache.h:1.4.2.12	Wed Feb  1 13:03:18 2006
--- openafs/src/WINNT/afsd/cm_scache.h	Sat Jun  3 13:57:12 2006
***************
*** 265,270 ****
--- 265,273 ----
  #define CM_SCACHESYNC_NOWAIT		0x100000/* don't wait for the state,
  						 * just fail */
  
+ /* flags for cm_RecycleSCache	*/
+ #define CM_SCACHE_RECYCLEFLAG_DESTROY_BUFFERS 	0x1
+ 
  /* flags for cm_MergeStatus */
  #define CM_MERGEFLAG_FORCE		1	/* check mtime before merging;
  						 * used to see if we're merging
***************
*** 333,336 ****
--- 336,341 ----
  
  extern long cm_ShutdownSCache(void);
  
+ extern long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags);
+ 
  #endif /*  __CM_SCACHE_H_ENV__ */
Index: openafs/src/WINNT/afsd/cm_server.c
diff -c openafs/src/WINNT/afsd/cm_server.c:1.13.2.9 openafs/src/WINNT/afsd/cm_server.c:1.13.2.10
*** openafs/src/WINNT/afsd/cm_server.c:1.13.2.9	Fri Feb 17 16:44:39 2006
--- openafs/src/WINNT/afsd/cm_server.c	Tue May  9 01:20:40 2006
***************
*** 29,34 ****
--- 29,48 ----
  
  cm_server_t *cm_allServersp;
  
+ void
+ cm_ForceNewConnectionsAllServers(void)
+ {
+     cm_server_t *tsp;
+ 
+     lock_ObtainRead(&cm_serverLock);
+     for (tsp = cm_allServersp; tsp; tsp = tsp->allNextp) {
+         cm_GetServerNoLock(tsp);
+ 	cm_ForceNewConnections(tsp);
+         cm_PutServerNoLock(tsp);
+     }
+     lock_ReleaseRead(&cm_serverLock);
+ }
+ 
  void cm_CheckServers(long flags, cm_cell_t *cellp)
  {
      /* ping all file servers, up or down, with unauthenticated connection,
Index: openafs/src/WINNT/afsd/cm_server.h
diff -c openafs/src/WINNT/afsd/cm_server.h:1.5.2.6 openafs/src/WINNT/afsd/cm_server.h:1.5.2.7
*** openafs/src/WINNT/afsd/cm_server.h:1.5.2.6	Sun Jan 15 21:06:59 2006
--- openafs/src/WINNT/afsd/cm_server.h	Tue May  9 01:20:40 2006
***************
*** 100,103 ****
--- 100,105 ----
  
  extern void cm_FreeServerList(cm_serverRef_t** list);
  
+ extern void cm_ForceNewConnectionsAllServers(void);
+ 
  #endif /*  __CM_SERVER_H_ENV__ */
Index: openafs/src/WINNT/afsd/cm_utils.c
diff -c openafs/src/WINNT/afsd/cm_utils.c:1.5.14.6 openafs/src/WINNT/afsd/cm_utils.c:1.5.14.7
*** openafs/src/WINNT/afsd/cm_utils.c:1.5.14.6	Mon Nov 21 19:37:48 2005
--- openafs/src/WINNT/afsd/cm_utils.c	Sat Jun  3 13:57:12 2006
***************
*** 246,252 ****
          error = CM_ERROR_EXISTS;
      else if (error == 20) 
          error = CM_ERROR_NOTDIR;
!     else if (error == 2) 
          error = CM_ERROR_NOSUCHFILE;
      else if (error == 11        /* EAGAIN, most servers */
               || error == 35)	/* EAGAIN, Digital UNIX */
--- 246,252 ----
          error = CM_ERROR_EXISTS;
      else if (error == 20) 
          error = CM_ERROR_NOTDIR;
!     else if (error == 2)	/* ENOENT */
          error = CM_ERROR_NOSUCHFILE;
      else if (error == 11        /* EAGAIN, most servers */
               || error == 35)	/* EAGAIN, Digital UNIX */
Index: openafs/src/WINNT/afsd/cm_vnodeops.c
diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.36 openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.39
*** openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.36	Wed Feb 22 09:29:22 2006
--- openafs/src/WINNT/afsd/cm_vnodeops.c	Sat Jun  3 13:57:12 2006
***************
*** 265,271 ****
  
      code = cm_SyncOp(scp, NULL, userp, reqp, rights,
                        CM_SCACHESYNC_GETSTATUS
!                       | CM_SCACHESYNC_NEEDCALLBACK);
  
      if (code == 0 && 
          ((rights & PRSFS_WRITE) || (rights & PRSFS_READ)) &&
--- 265,272 ----
  
      code = cm_SyncOp(scp, NULL, userp, reqp, rights,
                        CM_SCACHESYNC_GETSTATUS
!                      | CM_SCACHESYNC_NEEDCALLBACK
!                      | CM_SCACHESYNC_LOCK);
  
      if (code == 0 && 
          ((rights & PRSFS_WRITE) || (rights & PRSFS_READ)) &&
***************
*** 315,322 ****
--- 316,330 ----
  		}
  	    }
          }
+ 
+     } else if (code != 0) {
+         goto _done;
      }
  
+     cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_LOCK);
+ 
+  _done:
+ 
      lock_ReleaseMutex(&scp->mx);
  
      return code;
***************
*** 346,352 ****
  
      code = cm_SyncOp(scp, NULL, userp, reqp, rights,
                        CM_SCACHESYNC_GETSTATUS
!                       | CM_SCACHESYNC_NEEDCALLBACK);
  
      /*
       * If the open will fail because the volume is readonly, then we will
--- 354,361 ----
  
      code = cm_SyncOp(scp, NULL, userp, reqp, rights,
                        CM_SCACHESYNC_GETSTATUS
!                      | CM_SCACHESYNC_NEEDCALLBACK
!                      | CM_SCACHESYNC_LOCK);
  
      /*
       * If the open will fail because the volume is readonly, then we will
***************
*** 356,362 ****
       */
      if (code == CM_ERROR_READONLY)
          code = CM_ERROR_NOACCESS;
!     else if (code == 0 &&
               ((rights & PRSFS_WRITE) || (rights & PRSFS_READ)) &&
               scp->fileType == CM_SCACHETYPE_FILE) {
          cm_key_t key;
--- 365,372 ----
       */
      if (code == CM_ERROR_READONLY)
          code = CM_ERROR_NOACCESS;
! 
!     if (code == 0 &&
               ((rights & PRSFS_WRITE) || (rights & PRSFS_READ)) &&
               scp->fileType == CM_SCACHETYPE_FILE) {
          cm_key_t key;
***************
*** 403,410 ****
--- 413,425 ----
  		}
  	    }
          }
+     } else if (code != 0) {
+         goto _done;
      }
  
+     cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_LOCK);
+ 
+  _done:
      lock_ReleaseMutex(&scp->mx);
  
      return code;
***************
*** 1312,1317 ****
--- 1327,1339 ----
      cm_SyncOpDone(dscp, NULL, sflags);
      if (code == 0) 
          cm_MergeStatus(dscp, &newDirStatus, &volSync, userp, 0);
+ 	else if (code == CM_ERROR_NOSUCHFILE) {
+ 		/* windows would not have allowed the request to delete the file 
+ 		 * if it did not believe the file existed.  therefore, we must 
+ 		 * have an inconsistent view of the world.
+ 		 */
+ 		dscp->cbServerp = NULL;
+ 	}
      lock_ReleaseMutex(&dscp->mx);
  
      return code;
***************
*** 3653,3659 ****
  
              if (scp->fileLocksT == q)
                  scp->fileLocksT = osi_QPrev(q);
!             osi_QRemove(&scp->fileLocksH,q);
  
              if(IS_LOCK_ACCEPTED(fileLock)) {
                  if(fileLock->lockType == LockRead)
--- 3675,3681 ----
  
              if (scp->fileLocksT == q)
                  scp->fileLocksT = osi_QPrev(q);
!             osi_QRemoveHT(&scp->fileLocksH, &scp->fileLocksT, q);
  
              if(IS_LOCK_ACCEPTED(fileLock)) {
                  if(fileLock->lockType == LockRead)
***************
*** 3905,3911 ****
      lock_ObtainWrite(&cm_scacheLock);
      if (scp->fileLocksT == q)
          scp->fileLocksT = osi_QPrev(q);
!     osi_QRemove(&scp->fileLocksH, q);
  
      /*
       * Don't delete it here; let the daemon delete it, to simplify
--- 3927,3933 ----
      lock_ObtainWrite(&cm_scacheLock);
      if (scp->fileLocksT == q)
          scp->fileLocksT = osi_QPrev(q);
!     osi_QRemoveHT(&scp->fileLocksH, &scp->fileLocksT, q);
  
      /*
       * Don't delete it here; let the daemon delete it, to simplify
***************
*** 4513,4519 ****
  	lock_ObtainWrite(&cm_scacheLock);
          if (scp->fileLocksT == &oldFileLock->fileq)
              scp->fileLocksT = osi_QPrev(&oldFileLock->fileq);
!         osi_QRemove(&scp->fileLocksH, &oldFileLock->fileq);
  	lock_ReleaseWrite(&cm_scacheLock);
      } else if (code == 0 && IS_LOCK_WAITLOCK(oldFileLock)) {
          scp->serverLock = newLock;
--- 4535,4541 ----
  	lock_ObtainWrite(&cm_scacheLock);
          if (scp->fileLocksT == &oldFileLock->fileq)
              scp->fileLocksT = osi_QPrev(&oldFileLock->fileq);
!         osi_QRemoveHT(&scp->fileLocksH, &scp->fileLocksT, &oldFileLock->fileq);
  	lock_ReleaseWrite(&cm_scacheLock);
      } else if (code == 0 && IS_LOCK_WAITLOCK(oldFileLock)) {
          scp->serverLock = newLock;
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.55.2.51 openafs/src/WINNT/afsd/smb.c:1.55.2.61
*** openafs/src/WINNT/afsd/smb.c:1.55.2.51	Mon Apr 10 13:56:30 2006
--- openafs/src/WINNT/afsd/smb.c	Tue Jun  6 12:58:50 2006
***************
*** 170,175 ****
--- 170,177 ----
  
  smb_waitingLockRequest_t *smb_allWaitingLocks;
  
+ DWORD smb_TlsRequestSlot = -1;
+ 
  /* forward decl */
  void smb_DispatchPacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp,
  			NCB *ncbp, raw_write_cont_t *rwcp);
***************
*** 204,209 ****
--- 206,244 ----
  /* Faux server GUID. This is never checked. */
  GUID smb_ServerGUID = { 0x40015cb8, 0x058a, 0x44fc, { 0xae, 0x7e, 0xbb, 0x29, 0x52, 0xee, 0x7e, 0xff }};
  
+ void smb_ResetServerPriority()
+ {
+     void * p = TlsGetValue(smb_TlsRequestSlot);
+     if (p) {
+ 	free(p);
+ 	TlsSetValue(smb_TlsRequestSlot, NULL);
+ 	SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
+     }
+ }
+ 
+ void smb_SetRequestStartTime()
+ {
+     time_t * tp = malloc(sizeof(time_t));
+     if (tp) {
+ 	*tp = osi_Time();
+ 
+ 	if (!TlsSetValue(smb_TlsRequestSlot, tp))
+ 	    free(tp);
+     }
+ }
+ 
+ void smb_UpdateServerPriority()
+ {
+     time_t *tp = TlsGetValue(smb_TlsRequestSlot);
+ 
+     if (tp) {
+ 	time_t now = osi_Time();
+ 
+ 	/* Give one priority boost for each 15 seconds */
+ 	SetThreadPriority(GetCurrentThread(), (now - *tp) / 15);
+     }
+ }
+ 
  char * myCrt_Dispatch(int i)
  {
      switch (i)
***************
*** 809,815 ****
  	    osi_panic("afsd: invalid smb_vc_t detected in smb_allVCsp", 
  		       __FILE__, __LINE__);
  
!         if (lsn == vcp->lsn && lana == vcp->lana) {
              smb_HoldVCNoLock(vcp);
              break;
          }
--- 844,851 ----
  	    osi_panic("afsd: invalid smb_vc_t detected in smb_allVCsp", 
  		       __FILE__, __LINE__);
  
!         if (lsn == vcp->lsn && lana == vcp->lana &&
! 	    !(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) {
              smb_HoldVCNoLock(vcp);
              break;
          }
***************
*** 966,971 ****
--- 1002,1016 ----
      unsigned short uid;
      smb_vc_t **vcpp;
  
+ 
+     lock_ObtainMutex(&vcp->mx);
+     if (vcp->flags & SMB_VCFLAG_CLEAN_IN_PROGRESS) {
+ 	lock_ReleaseMutex(&vcp->mx);
+ 	osi_Log1(smb_logp, "Clean of dead vcp 0x%x in progress", vcp);
+ 	return;
+     }
+     vcp->flags |= SMB_VCFLAG_CLEAN_IN_PROGRESS;
+     lock_ReleaseMutex(&vcp->mx);
      osi_Log1(smb_logp, "Cleaning up dead vcp 0x%x", vcp);
  
      lock_ObtainWrite(&smb_rctLock);
***************
*** 1407,1415 ****
      smb_vc_t *vcp = NULL;
      smb_ioctl_t *ioctlp;
  
      lock_ObtainWrite(&smb_rctLock);
      osi_assert(fidp->refCount-- > 0);
-     lock_ObtainMutex(&fidp->mx);
      if (fidp->refCount == 0 && (fidp->delete)) {
  	vcp = fidp->vcp;
  	fidp->vcp = NULL;
--- 1452,1460 ----
      smb_vc_t *vcp = NULL;
      smb_ioctl_t *ioctlp;
  
+     lock_ObtainMutex(&fidp->mx);
      lock_ObtainWrite(&smb_rctLock);
      osi_assert(fidp->refCount-- > 0);
      if (fidp->refCount == 0 && (fidp->delete)) {
  	vcp = fidp->vcp;
  	fidp->vcp = NULL;
***************
*** 2501,2512 ****
  		  vcp, vcp->usersp);
  
  	lock_ObtainMutex(&vcp->mx);
! 	vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
! 	lock_ReleaseMutex(&vcp->mx);
! 	lock_ObtainWrite(&smb_globalLock);
! 	dead_sessions[vcp->session] = TRUE;
! 	lock_ReleaseWrite(&smb_globalLock);
! 	smb_CleanupDeadVC(vcp);
      }
  
      if (localNCB)
--- 2546,2563 ----
  		  vcp, vcp->usersp);
  
  	lock_ObtainMutex(&vcp->mx);
! 	if (!(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) {
! 	    osi_Log2(smb_logp, "marking dead vcp 0x%x, user struct 0x%x",
! 		      vcp, vcp->usersp);
! 	    vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
! 	    lock_ReleaseMutex(&vcp->mx);
! 	    lock_ObtainWrite(&smb_globalLock);
! 	    dead_sessions[vcp->session] = TRUE;
! 	    lock_ReleaseWrite(&smb_globalLock);
! 	    smb_CleanupDeadVC(vcp);
! 	} else {
! 	    lock_ReleaseMutex(&vcp->mx);
! 	}
      }
  
      if (localNCB)
***************
*** 4710,4716 ****
       * in a readonly volume doesn't mean it shojuld be marked as RO 
       */
      if (newScp->fileType == CM_SCACHETYPE_DIRECTORY ||
!         newScp->fileType == CM_SCACHETYPE_MOUNTPOINT)
          attrs = SMB_ATTR_DIRECTORY;
      else
          attrs = 0;
--- 4761,4768 ----
       * in a readonly volume doesn't mean it shojuld be marked as RO 
       */
      if (newScp->fileType == CM_SCACHETYPE_DIRECTORY ||
!         newScp->fileType == CM_SCACHETYPE_MOUNTPOINT ||
! 	newScp->fileType == CM_SCACHETYPE_INVALID)
          attrs = SMB_ATTR_DIRECTORY;
      else
          attrs = 0;
***************
*** 5422,5428 ****
      /* now create the hardlink */
      osi_Log1(smb_logp,"  Attempting to create new link [%s]", osi_LogSaveString(smb_logp, newLastNamep));
      code = cm_Link(newDscp, newLastNamep, sscp, 0, userp, &req);
!     osi_Log1(smb_logp,"  Link returns %d", code);
  
      /* Handle Change Notification */
      if (code == 0) {
--- 5474,5480 ----
      /* now create the hardlink */
      osi_Log1(smb_logp,"  Attempting to create new link [%s]", osi_LogSaveString(smb_logp, newLastNamep));
      code = cm_Link(newDscp, newLastNamep, sscp, 0, userp, &req);
!     osi_Log1(smb_logp,"  Link returns 0x%x", code);
  
      /* Handle Change Notification */
      if (code == 0) {
***************
*** 5629,5639 ****
      userp = smb_GetUser(vcp, inp);
  
      lock_ObtainMutex(&fidp->mx);
!     if (fidp->flags & SMB_FID_OPENWRITE)
!         code = cm_FSync(fidp->scp, userp, &req);
!     else 
          code = 0;
!     lock_ReleaseMutex(&fidp->mx);
          
      smb_ReleaseFID(fidp);
          
--- 5681,5696 ----
      userp = smb_GetUser(vcp, inp);
  
      lock_ObtainMutex(&fidp->mx);
!     if (fidp->flags & SMB_FID_OPENWRITE) {
! 	cm_scache_t * scp = fidp->scp;
! 	cm_HoldSCache(scp);
! 	lock_ReleaseMutex(&fidp->mx);
!         code = cm_FSync(scp, userp, &req);
! 	cm_ReleaseSCache(scp);
!     } else {
          code = 0;
! 	lock_ReleaseMutex(&fidp->mx);
!     }
          
      smb_ReleaseFID(fidp);
          
***************
*** 5695,5700 ****
--- 5752,5758 ----
      cm_req_t req;
      cm_scache_t *dscp = fidp->NTopen_dscp;
      char *pathp = fidp->NTopen_pathp;
+     cm_scache_t * scp;
  
      osi_Log3(smb_logp, "smb_CloseFID Closing fidp 0x%x (fid=%d vcp=0x%x)",
               fidp, fidp->fid, vcp);
***************
*** 5731,5763 ****
          lock_ObtainMutex(&fidp->mx);
      }
  
      /* watch for ioctl closes, and read-only opens */
!     if (fidp->scp != NULL &&
          (fidp->flags & (SMB_FID_OPENWRITE | SMB_FID_DELONCLOSE))
           == SMB_FID_OPENWRITE) {
          if (dosTime != 0 && dosTime != -1) {
!             fidp->scp->mask |= CM_SCACHEMASK_CLIENTMODTIME;
              /* This fixes defect 10958 */
              CompensateForSmbClientLastWriteTimeBugs(&dosTime);
              smb_UnixTimeFromDosUTime(&fidp->scp->clientModTime, dosTime);
          }
!         code = cm_FSync(fidp->scp, userp, &req);
      }
      else 
          code = 0;
  
      /* unlock any pending locks */
!     if (!(fidp->flags & SMB_FID_IOCTL) && fidp->scp &&
!         fidp->scp->fileType == CM_SCACHETYPE_FILE) {
          cm_key_t key;
-         cm_scache_t * scp;
          long tcode;
  
!         /* CM_UNLOCK_BY_FID doesn't look at the process ID.  We pass
             in zero. */
          key = cm_GenerateKey(vcp->vcID, 0, fidp->fid);
-         scp = fidp->scp;
-         cm_HoldSCache(scp);
          lock_ObtainMutex(&scp->mx);
  
          tcode = cm_SyncOp(scp, NULL, userp, &req, 0,
--- 5789,5826 ----
          lock_ObtainMutex(&fidp->mx);
      }
  
+     scp = fidp->scp;
+     if (scp)
+ 	cm_HoldSCache(scp);
+ 
      /* watch for ioctl closes, and read-only opens */
!     if (scp != NULL &&
          (fidp->flags & (SMB_FID_OPENWRITE | SMB_FID_DELONCLOSE))
           == SMB_FID_OPENWRITE) {
          if (dosTime != 0 && dosTime != -1) {
!             scp->mask |= CM_SCACHEMASK_CLIENTMODTIME;
              /* This fixes defect 10958 */
              CompensateForSmbClientLastWriteTimeBugs(&dosTime);
              smb_UnixTimeFromDosUTime(&fidp->scp->clientModTime, dosTime);
          }
! 	lock_ReleaseMutex(&fidp->mx);
!         code = cm_FSync(scp, userp, &req);
! 	lock_ObtainMutex(&fidp->mx);
      }
      else 
          code = 0;
  
      /* unlock any pending locks */
!     if (!(fidp->flags & SMB_FID_IOCTL) && scp &&
!         scp->fileType == CM_SCACHETYPE_FILE) {
          cm_key_t key;
          long tcode;
  
! 	lock_ReleaseMutex(&fidp->mx);
! 
! 	/* CM_UNLOCK_BY_FID doesn't look at the process ID.  We pass
             in zero. */
          key = cm_GenerateKey(vcp->vcID, 0, fidp->fid);
          lock_ObtainMutex(&scp->mx);
  
          tcode = cm_SyncOp(scp, NULL, userp, &req, 0,
***************
*** 5778,5791 ****
      post_syncopdone:
  
          lock_ReleaseMutex(&scp->mx);
!         cm_ReleaseSCache(scp);
      }
  
      if (fidp->flags & SMB_FID_DELONCLOSE) {
          char *fullPathp;
  
!         smb_FullName(dscp, fidp->scp, pathp, &fullPathp, userp, &req);
!         if (fidp->scp->fileType == CM_SCACHETYPE_DIRECTORY) {
              code = cm_RemoveDir(dscp, fullPathp, userp, &req);
              if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
                  smb_NotifyChange(FILE_ACTION_REMOVED,
--- 5841,5855 ----
      post_syncopdone:
  
          lock_ReleaseMutex(&scp->mx);
! 	lock_ObtainMutex(&fidp->mx);
      }
  
      if (fidp->flags & SMB_FID_DELONCLOSE) {
          char *fullPathp;
  
! 	lock_ReleaseMutex(&fidp->mx);
!         smb_FullName(dscp, scp, pathp, &fullPathp, userp, &req);
!         if (scp->fileType == CM_SCACHETYPE_DIRECTORY) {
              code = cm_RemoveDir(dscp, fullPathp, userp, &req);
              if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
                  smb_NotifyChange(FILE_ACTION_REMOVED,
***************
*** 5799,5804 ****
--- 5863,5869 ----
                                   dscp, fullPathp, NULL, TRUE);
          }
          free(fullPathp);
+ 	lock_ObtainMutex(&fidp->mx);
  	fidp->flags &= ~SMB_FID_DELONCLOSE;
      }
  
***************
*** 5816,5821 ****
--- 5881,5889 ----
      if (dscp)
  	cm_ReleaseSCache(dscp);
  
+     if (scp)
+ 	cm_ReleaseSCache(scp);
+ 
      if (pathp)
  	free(pathp);
  
***************
*** 5892,5897 ****
--- 5960,5966 ----
          if (fidp->curr_chunk == fidp->prev_chunk + 1)
              sequential = 1;
      }
+     lock_ReleaseMutex(&fidp->mx);
  
      /* start by looking up the file's end */
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
***************
*** 5994,6000 ****
  
    done:
      lock_ReleaseMutex(&scp->mx);
-     lock_ReleaseMutex(&fidp->mx);
      if (bufferp) 
          buf_Release(bufferp);
  
--- 6063,6068 ----
***************
*** 6044,6052 ****
      offset = *offsetp;
  
      lock_ObtainMutex(&fidp->mx);
      scp = fidp->scp;
!     lock_ObtainMutex(&scp->mx);
  
      /* start by looking up the file's end */
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
                        CM_SCACHESYNC_NEEDCALLBACK
--- 6112,6131 ----
      offset = *offsetp;
  
      lock_ObtainMutex(&fidp->mx);
+     /* make sure we have a writable FD */
+     if (!(fidp->flags & SMB_FID_OPENWRITE)) {
+ 	osi_Log2(smb_logp, "smb_WriteData fid %d not OPENWRITE flags 0x%x",
+ 		  fidp->fid, fidp->flags);
+ 	lock_ReleaseMutex(&fidp->mx);
+         code = CM_ERROR_BADFDOP;
+         goto done;
+     }
+     
      scp = fidp->scp;
!     cm_HoldSCache(scp);
!     lock_ReleaseMutex(&fidp->mx);
  
+     lock_ObtainMutex(&scp->mx);
      /* start by looking up the file's end */
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
                        CM_SCACHESYNC_NEEDCALLBACK
***************
*** 6055,6067 ****
      if (code) 
          goto done;
          
-     /* make sure we have a writable FD */
-     if (!(fidp->flags & SMB_FID_OPENWRITE)) {
- 	lock_ReleaseMutex(&fidp->mx);
-         code = CM_ERROR_BADFDOP;
-         goto done;
-     }
- 
      /* now we have the entry locked, look up the length */
      fileLength = scp->length;
      minLength = fileLength;
--- 6134,6139 ----
***************
*** 6228,6233 ****
--- 6300,6306 ----
          buf_Release(bufferp);
      }
  
+     lock_ObtainMutex(&fidp->mx);
      if (code == 0 && filter != 0 && (fidp->flags & SMB_FID_NTOPEN)
           && (fidp->NTopen_dscp->flags & CM_SCACHEFLAG_ANYWATCH)) {
          smb_NotifyChange(FILE_ACTION_MODIFIED, filter,
***************
*** 6242,6255 ****
          osi_Log1(smb_logp, "smb_WriteData fid %d calling cm_SyncOp ASYNCSTORE",
                    fidp->fid);
          code2 = cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_ASYNCSTORE);
!         osi_Log2(smb_logp, "smb_WriteData fid %d calling cm_SyncOp ASYNCSTORE returns %d",
!                   fidp->fid,code2);
          lock_ReleaseMutex(&scp->mx);
          cm_QueueBKGRequest(scp, cm_BkgStore, writeBackOffset.LowPart,
                              writeBackOffset.HighPart, cm_chunkSize, 0, userp);
      }
  
!     osi_Log3(smb_logp, "smb_WriteData fid %d returns %d written %d",
                fidp->fid, code, *writtenp);
      return code;
  }
--- 6315,6330 ----
          osi_Log1(smb_logp, "smb_WriteData fid %d calling cm_SyncOp ASYNCSTORE",
                    fidp->fid);
          code2 = cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_ASYNCSTORE);
!         osi_Log2(smb_logp, "smb_WriteData fid %d calling cm_SyncOp ASYNCSTORE returns 0x%x",
!                   fidp->fid, code2);
          lock_ReleaseMutex(&scp->mx);
          cm_QueueBKGRequest(scp, cm_BkgStore, writeBackOffset.LowPart,
                              writeBackOffset.HighPart, cm_chunkSize, 0, userp);
      }
  
!     cm_ReleaseSCache(scp);
! 
!     osi_Log3(smb_logp, "smb_WriteData fid %d returns 0x%x written %d bytes",
                fidp->fid, code, *writtenp);
      return code;
  }
***************
*** 7032,7037 ****
--- 7107,7114 ----
  
      lock_ObtainMutex(&fidp->mx);
      scp = fidp->scp;
+     cm_HoldSCache(scp);
+     lock_ReleaseMutex(&fidp->mx);
      lock_ObtainMutex(&scp->mx);
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
                       CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
***************
*** 7050,7057 ****
          smb_SetSMBDataLength(outp, 0);
      }
      lock_ReleaseMutex(&scp->mx);
-     lock_ReleaseMutex(&fidp->mx);
      smb_ReleaseFID(fidp);
      cm_ReleaseUser(userp);
      return code;
  }
--- 7127,7134 ----
          smb_SetSMBDataLength(outp, 0);
      }
      lock_ReleaseMutex(&scp->mx);
      smb_ReleaseFID(fidp);
+     cm_ReleaseSCache(scp);
      cm_ReleaseUser(userp);
      return code;
  }
***************
*** 7556,7561 ****
--- 7633,7641 ----
  	    smb_ReleaseVC(vcp);
  	    vcp = NULL;
  	}
+ 
+ 	smb_ResetServerPriority();
+ 
          code = thrd_WaitForMultipleObjects_Event(numNCBs, NCBreturns[myIdx],
                                                   FALSE, INFINITE);
  
***************
*** 7839,7844 ****
--- 7919,7926 ----
           * then we are in big trouble. This means either :
           *   a) we have the wrong NCB.
           *   b) Netbios screwed up the call.
+ 	 *   c) The VC was already marked dead before we were able to
+ 	 *      process the call
           * Obviously this implies that 
           *   ( LSNs[idx_session] != ncbp->ncb_lsn ||
           *   lanas[idx_session] != ncbp->ncb_lana_num )
***************
*** 7851,7857 ****
              char *ptbuf[1];
  
              sprintf(buf,
!                      "Bad vcp!! : "
                       "LSNs[idx_session]=[%d],"
                       "lanas[idx_session]=[%d],"
                       "ncbp->ncb_lsn=[%d],"
--- 7933,7939 ----
              char *ptbuf[1];
  
              sprintf(buf,
!                      "vcp does not exist!! : "
                       "LSNs[idx_session]=[%d],"
                       "lanas[idx_session]=[%d],"
                       "ncbp->ncb_lsn=[%d],"
***************
*** 7870,7876 ****
              }
  
              /* Also log in the trace log. */
!             osi_Log4(smb_logp, "Server: BAD VCP!"
                        "LSNs[idx_session]=[%d],"
                        "lanas[idx_session]=[%d],"
                        "ncbp->ncb_lsn=[%d],"
--- 7952,7958 ----
              }
  
              /* Also log in the trace log. */
!             osi_Log4(smb_logp, "Server: VCP does not exist!"
                        "LSNs[idx_session]=[%d],"
                        "lanas[idx_session]=[%d],"
                        "ncbp->ncb_lsn=[%d],"
***************
*** 7886,7891 ****
--- 7968,7975 ----
              continue;
          }
  
+ 	smb_SetRequestStartTime();
+ 
          vcp->errorCount = 0;
          bufp = (struct smb_packet *) ncbp->ncb_buffer;
  #ifdef DJGPP
***************
*** 8267,8275 ****
              smb_FreePacket(outp);
  
  	    lock_ObtainMutex(&vcp->mx);
! 	    vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
! 	    lock_ReleaseMutex(&vcp->mx);
! 	    smb_CleanupDeadVC(vcp);
          } else {
              /* assert that we do not exceed the maximum number of sessions or NCBs.
               * we should probably want to wait for a session to be freed in case
--- 8351,8368 ----
              smb_FreePacket(outp);
  
  	    lock_ObtainMutex(&vcp->mx);
! 	    if (!(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) {
! 		osi_Log2(smb_logp, "marking dead vcp 0x%x, user struct 0x%x",
! 			  vcp, vcp->usersp);
! 		vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
! 		lock_ReleaseMutex(&vcp->mx);
! 		lock_ObtainWrite(&smb_globalLock);
! 		dead_sessions[vcp->session] = TRUE;
! 		lock_ReleaseWrite(&smb_globalLock);
! 		smb_CleanupDeadVC(vcp);
! 	    } else {
! 		lock_ReleaseMutex(&vcp->mx);
! 	    }
          } else {
              /* assert that we do not exceed the maximum number of sessions or NCBs.
               * we should probably want to wait for a session to be freed in case
***************
*** 8508,8513 ****
--- 8601,8608 ----
      EVENT_HANDLE retHandle;
      char eventName[MAX_PATH];
  
+     smb_TlsRequestSlot = TlsAlloc();
+ 
  #ifndef DJGPP
      smb_MBfunc = aMBfunc;
  #endif /* DJGPP */
***************
*** 9031,9036 ****
--- 9126,9133 ----
          }
      }
      lock_ReleaseWrite(&smb_rctLock);
+ 
+     TlsFree(smb_TlsRequestSlot);
  }
  
  /* Get the UNC \\<servername>\<sharename> prefix. */
Index: openafs/src/WINNT/afsd/smb.h
diff -c openafs/src/WINNT/afsd/smb.h:1.14.2.22 openafs/src/WINNT/afsd/smb.h:1.14.2.24
*** openafs/src/WINNT/afsd/smb.h:1.14.2.22	Sun Apr  9 00:56:39 2006
--- openafs/src/WINNT/afsd/smb.h	Fri May 26 02:38:06 2006
***************
*** 224,229 ****
--- 224,230 ----
  #define SMB_VCFLAG_ALREADYDEAD	0x20	/* do not get tokens from this vc */
  #define SMB_VCFLAG_SESSX_RCVD	0x40	/* we received at least one session setups on this vc */
  #define SMB_VCFLAG_AUTH_IN_PROGRESS 0x80 /* a SMB NT extended authentication is in progress */
+ #define SMB_VCFLAG_CLEAN_IN_PROGRESS 0x100
  
  /* one per user session */
  typedef struct smb_user {
***************
*** 695,700 ****
--- 696,705 ----
  
  extern DWORD smb_ServerExceptionFilter(void);
  
+ extern void smb_UpdateServerPriority(void);
+ extern void smb_SetRequestStartTime(void);
+ extern void smb_ResetServerPriority(void);
+ 
  /* include other include files */
  #include "smb3.h"
  #include "smb_ioctl.h"
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.42.2.44 openafs/src/WINNT/afsd/smb3.c:1.42.2.50
*** openafs/src/WINNT/afsd/smb3.c:1.42.2.44	Fri Feb  3 18:05:28 2006
--- openafs/src/WINNT/afsd/smb3.c	Wed Jun  7 19:30:18 2006
***************
*** 1029,1034 ****
--- 1029,1036 ----
      tidp = smb_FindTID(vcp, newTid, SMB_FLAG_CREATE);
  
      if (!ipc) {
+ 	if (!strcmp(shareName, "*."))
+ 	    strcpy(shareName, "all");
          uidp = smb_FindUID(vcp, ((smb_t *)inp)->uid, 0);
  	shareFound = smb_FindShare(vcp, uidp, shareName, &sharePath);
          if (uidp)
***************
*** 1599,1605 ****
          for (i=0; i < nRegShares && cshare < nSharesRet; i++) {
              len = sizeof(thisShare);
              rv = RegEnumValue(hkSubmount, i, thisShare, &len, NULL, NULL, NULL, NULL);
!             if (rv == ERROR_SUCCESS && strlen(thisShare) && (!allSubmount || stricmp(thisShare,"all"))) {
                  strncpy(shares[cshare].shi1_netname, thisShare, sizeof(shares->shi1_netname)-1);
                  shares[cshare].shi1_netname[sizeof(shares->shi1_netname)-1] = 0; /* unfortunate truncation */
                  shares[cshare].shi1_remark = cstrp - outp->datap;
--- 1601,1608 ----
          for (i=0; i < nRegShares && cshare < nSharesRet; i++) {
              len = sizeof(thisShare);
              rv = RegEnumValue(hkSubmount, i, thisShare, &len, NULL, NULL, NULL, NULL);
!             if (rv == ERROR_SUCCESS && strlen(thisShare) && 
! 		(!allSubmount || (stricmp(thisShare,"all") && strcmp(thisShare,"*.")))) {
                  strncpy(shares[cshare].shi1_netname, thisShare, sizeof(shares->shi1_netname)-1);
                  shares[cshare].shi1_netname[sizeof(shares->shi1_netname)-1] = 0; /* unfortunate truncation */
                  shares[cshare].shi1_remark = cstrp - outp->datap;
***************
*** 1685,1691 ****
  
      outp = smb_GetTran2ResponsePacket(vcp, p, op, totalParam, totalData);
  
!     if(!stricmp(shareName,"all")) {
          rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, 0,
                            KEY_QUERY_VALUE, &hkParam);
          if (rv == ERROR_SUCCESS) {
--- 1688,1694 ----
  
      outp = smb_GetTran2ResponsePacket(vcp, p, op, totalParam, totalData);
  
!     if(!stricmp(shareName,"all") || !strcmp(shareName,"*.")) {
          rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, 0,
                            KEY_QUERY_VALUE, &hkParam);
          if (rv == ERROR_SUCCESS) {
***************
*** 2456,2468 ****
      switch (p->parmsp[0]) {
      case 1: responseSize = sizeof(qi.u.allocInfo); break;
      case 2: responseSize = sizeof(qi.u.volumeInfo); break;
      case 0x102: responseSize = sizeof(qi.u.FSvolumeInfo); break;
      case 0x103: responseSize = sizeof(qi.u.FSsizeInfo); break;
      case 0x104: responseSize = sizeof(qi.u.FSdeviceInfo); break;
      case 0x105: responseSize = sizeof(qi.u.FSattributeInfo); break;
      case 0x200: /* CIFS Unix Info */
      case 0x301: /* Mac FS Info */
!     default: return CM_ERROR_INVAL;
      }
  
      outp = smb_GetTran2ResponsePacket(vcp, p, op, 0, responseSize);
--- 2459,2473 ----
      switch (p->parmsp[0]) {
      case 1: responseSize = sizeof(qi.u.allocInfo); break;
      case 2: responseSize = sizeof(qi.u.volumeInfo); break;
+     	break;
      case 0x102: responseSize = sizeof(qi.u.FSvolumeInfo); break;
      case 0x103: responseSize = sizeof(qi.u.FSsizeInfo); break;
      case 0x104: responseSize = sizeof(qi.u.FSdeviceInfo); break;
      case 0x105: responseSize = sizeof(qi.u.FSattributeInfo); break;
      case 0x200: /* CIFS Unix Info */
      case 0x301: /* Mac FS Info */
!     default: 
! 	return CM_ERROR_INVAL;
      }
  
      outp = smb_GetTran2ResponsePacket(vcp, p, op, 0, responseSize);
***************
*** 2636,2641 ****
--- 2641,2647 ----
      cm_scache_t *scp, *dscp;
      long code = 0;
      char *op;
+     char *pathp;
      char *tidPathp;
      char *lastComp;
      cm_req_t req;
***************
*** 2663,2670 ****
          smb_SendTran2Error(vcp, p, opx, CM_ERROR_INVAL);
          return 0;
      }
      osi_Log2(smb_logp, "T2 QPathInfo type 0x%x path %s", infoLevel,
!               osi_LogSaveString(smb_logp, (char *)(&p->parmsp[3])));
  
      outp = smb_GetTran2ResponsePacket(vcp, p, opx, 2, nbytesRequired);
  
--- 2669,2680 ----
          smb_SendTran2Error(vcp, p, opx, CM_ERROR_INVAL);
          return 0;
      }
+ 
+     pathp = (char *)(&p->parmsp[3]);
+     if (smb_StoreAnsiFilenames)
+ 	OemToChar(pathp,pathp);
      osi_Log2(smb_logp, "T2 QPathInfo type 0x%x path %s", infoLevel,
!               osi_LogSaveString(smb_logp, pathp));
  
      outp = smb_GetTran2ResponsePacket(vcp, p, opx, 2, nbytesRequired);
  
***************
*** 2715,2722 ****
       */
      if (infoLevel == SMB_QUERY_FILE_BASIC_INFO) {
          spacep = cm_GetSpace();
!         smb_StripLastComponent(spacep->data, &lastComp,
!                                 (char *)(&p->parmsp[3]));
  #ifndef SPECIAL_FOLDERS
          /* Make sure that lastComp is not NULL */
          if (lastComp) {
--- 2725,2731 ----
       */
      if (infoLevel == SMB_QUERY_FILE_BASIC_INFO) {
          spacep = cm_GetSpace();
!         smb_StripLastComponent(spacep->data, &lastComp, pathp);
  #ifndef SPECIAL_FOLDERS
          /* Make sure that lastComp is not NULL */
          if (lastComp) {
***************
*** 2761,2767 ****
      }
  
      /* now do namei and stat, and copy out the info */
!     code = cm_NameI(cm_data.rootSCachep, (char *)(&p->parmsp[3]),
                       CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, userp, tidPathp, &req, &scp);
  
      if (code) {
--- 2770,2776 ----
      }
  
      /* now do namei and stat, and copy out the info */
!     code = cm_NameI(cm_data.rootSCachep, pathp,
                       CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, userp, tidPathp, &req, &scp);
  
      if (code) {
***************
*** 2796,2802 ****
      op = outp->datap;
      /* for info level 108, figure out short name */
      if (infoLevel == 0x108) {
!         code = cm_GetShortName((char *)(&p->parmsp[3]), userp, &req,
                                  tidPathp, scp->fid.vnode, shortName,
                                  (size_t *) &len);
          if (code) {
--- 2805,2811 ----
      op = outp->datap;
      /* for info level 108, figure out short name */
      if (infoLevel == 0x108) {
!         code = cm_GetShortName(pathp, userp, &req,
                                  tidPathp, scp->fid.vnode, shortName,
                                  (size_t *) &len);
          if (code) {
***************
*** 2833,2842 ****
      else if (infoLevel == SMB_QUERY_FILE_STANDARD_INFO) {
          *((LARGE_INTEGER *)op) = scp->length; op += 8;	/* alloc size */
          *((LARGE_INTEGER *)op) = scp->length; op += 8;	/* EOF */
!         *((u_long *)op) = scp->linkCount; op += 4;
!         *op++ = 0;
          *op++ = 0;
-         *op++ = (scp->fileType == CM_SCACHETYPE_DIRECTORY ? 1 : 0);
          *op++ = 0;
      }
      else if (infoLevel == SMB_QUERY_FILE_EA_INFO) {
--- 2842,2853 ----
      else if (infoLevel == SMB_QUERY_FILE_STANDARD_INFO) {
          *((LARGE_INTEGER *)op) = scp->length; op += 8;	/* alloc size */
          *((LARGE_INTEGER *)op) = scp->length; op += 8;	/* EOF */
!         *((u_long *)op) = scp->linkCount; op += 4;	/* Link count */
!         *op++ = 0;					/* Delete Pending */
!         *op++ = ((scp->fileType == CM_SCACHETYPE_DIRECTORY || 
! 		  scp->fileType == CM_SCACHETYPE_MOUNTPOINT ||
! 		  scp->fileType == CM_SCACHETYPE_INVALID) ? 1 : 0);
          *op++ = 0;
          *op++ = 0;
      }
      else if (infoLevel == SMB_QUERY_FILE_EA_INFO) {
***************
*** 2877,2882 ****
--- 2888,2894 ----
      unsigned short infoLevel;
      int nbytesRequired;
      unsigned short fid;
+     int delonclose = 0;
      cm_user_t *userp;
      smb_fid_t *fidp;
      cm_scache_t *scp;
***************
*** 2927,2933 ****
--- 2939,2949 ----
      	goto done;
      }   
  
+     lock_ObtainMutex(&fidp->mx);
+     delonclose = fidp->flags & SMB_FID_DELONCLOSE;
      scp = fidp->scp;
+     cm_HoldSCache(scp);
+     lock_ReleaseMutex(&fidp->mx);
      lock_ObtainMutex(&scp->mx);
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
                        CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
***************
*** 2951,2961 ****
      else if (infoLevel == SMB_QUERY_FILE_STANDARD_INFO) {
          *((LARGE_INTEGER *)op) = scp->length; op += 8;	/* alloc size */
          *((LARGE_INTEGER *)op) = scp->length; op += 8;	/* EOF */
!         *((u_long *)op) = scp->linkCount; op += 4;
! 	lock_ObtainMutex(&fidp->mx);
!         *op++ = ((fidp->flags & SMB_FID_DELONCLOSE) ? 1 : 0);
! 	lock_ReleaseMutex(&fidp->mx);
!         *op++ = (scp->fileType == CM_SCACHETYPE_DIRECTORY ? 1 : 0);
          *op++ = 0;
          *op++ = 0;
      }
--- 2967,2977 ----
      else if (infoLevel == SMB_QUERY_FILE_STANDARD_INFO) {
          *((LARGE_INTEGER *)op) = scp->length; op += 8;	/* alloc size */
          *((LARGE_INTEGER *)op) = scp->length; op += 8;	/* EOF */
!         *((u_long *)op) = scp->linkCount; op += 4;	/* Link count */
!         *op++ = (delonclose ? 1 : 0);			/* Delete Pending */
!         *op++ = ((scp->fileType == CM_SCACHETYPE_DIRECTORY || 
! 		  scp->fileType == CM_SCACHETYPE_MOUNTPOINT ||
! 		  scp->fileType == CM_SCACHETYPE_INVALID)? 1 : 0);
          *op++ = 0;
          *op++ = 0;
      }
***************
*** 2966,2975 ****
--- 2982,2995 ----
          unsigned long len;
          char *name;
  
+ 	lock_ReleaseMutex(&scp->mx);
+ 	lock_ObtainMutex(&fidp->mx);
+ 	lock_ObtainMutex(&scp->mx);
          if (fidp->NTopen_wholepathp)
              name = fidp->NTopen_wholepathp;
          else
              name = "\\";	/* probably can't happen */
+ 	lock_ReleaseMutex(&fidp->mx);
          len = strlen(name);
          outp->totalData = (len*2) + 4;	/* this is actually what we want to return */
          *((u_long *)op) = len * 2; op += 4;
***************
*** 2979,2984 ****
--- 2999,3005 ----
      /* send and free the packets */
    done:
      lock_ReleaseMutex(&scp->mx);
+     cm_ReleaseSCache(scp);
      cm_ReleaseUser(userp);
      smb_ReleaseFID(fidp);
      if (code == 0) 
***************
*** 3012,3018 ****
      }
  
      infoLevel = p->parmsp[1];
!     osi_Log2(smb_logp,"ReceiveTran2SetFileInfo type=[%x] fid=[%x]", infoLevel, fid);
      if (infoLevel > 0x104 || infoLevel < 0x101) {
          osi_Log2(smb_logp, "Bad Tran2 op 0x%x infolevel 0x%x",
                    p->opcode, infoLevel);
--- 3033,3039 ----
      }
  
      infoLevel = p->parmsp[1];
!     osi_Log2(smb_logp,"ReceiveTran2SetFileInfo type 0x%x fid %d", infoLevel, fid);
      if (infoLevel > 0x104 || infoLevel < 0x101) {
          osi_Log2(smb_logp, "Bad Tran2 op 0x%x infolevel 0x%x",
                    p->opcode, infoLevel);
***************
*** 3035,3040 ****
--- 3056,3064 ----
          smb_SendTran2Error(vcp, p, op, CM_ERROR_NOACCESS);
          return 0;
      }
+ 
+     scp = fidp->scp;
+     cm_HoldSCache(scp);
      lock_ReleaseMutex(&fidp->mx);
  
      osi_Log1(smb_logp, "T2 SFileInfo type 0x%x", infoLevel);
***************
*** 3051,3058 ****
      	goto done;
      }   
  
-     scp = fidp->scp;
- 
      if (infoLevel == SMB_QUERY_FILE_BASIC_INFO) {
          FILETIME lastMod;
          unsigned int attribute;
--- 3075,3080 ----
***************
*** 3065,3075 ****
          code = cm_SyncOp(scp, NULL, userp, &req, 0,
                            CM_SCACHESYNC_GETSTATUS
                           | CM_SCACHESYNC_NEEDCALLBACK);
          if (code) {
-             lock_ReleaseMutex(&scp->mx);
              goto done;
          }
  
          /* prepare for setattr call */
          attr.mask = 0;
  
--- 3087,3100 ----
          code = cm_SyncOp(scp, NULL, userp, &req, 0,
                            CM_SCACHESYNC_GETSTATUS
                           | CM_SCACHESYNC_NEEDCALLBACK);
+ 	lock_ReleaseMutex(&scp->mx);
          if (code) {
              goto done;
          }
  
+ 	lock_ObtainMutex(&fidp->mx);
+ 	lock_ObtainMutex(&scp->mx);
+ 
          /* prepare for setattr call */
          attr.mask = 0;
  
***************
*** 3082,3090 ****
               lastMod.dwLowDateTime != -1 && lastMod.dwHighDateTime != -1) {
              attr.mask |= CM_ATTRMASK_CLIENTMODTIME;
              smb_UnixTimeFromLargeSearchTime(&attr.clientModTime, &lastMod);
- 	    lock_ObtainMutex(&fidp->mx);
              fidp->flags |= SMB_FID_MTIMESETDONE;
- 	    lock_ReleaseMutex(&fidp->mx);
          }
  		
          attribute = *((u_long *)(p->datap + 32));
--- 3107,3113 ----
***************
*** 3103,3108 ****
--- 3126,3132 ----
              }
          }
          lock_ReleaseMutex(&scp->mx);
+ 	lock_ReleaseMutex(&fidp->mx);
  
          /* call setattr */
          if (attr.mask)
***************
*** 3138,3143 ****
--- 3162,3168 ----
      }       
  
    done:
+     cm_ReleaseSCache(scp);
      cm_ReleaseUser(userp);
      smb_ReleaseFID(fidp);
      if (code == 0) 
***************
*** 3242,3248 ****
          requestFileName[0] == '\\' &&
          !_strnicmp(cm_NetbiosName,&requestFileName[1],nbnLen) &&
          requestFileName[nbnLen+1] == '\\' &&
!         !_strnicmp("all",&requestFileName[nbnLen+2],3)) 
      {
          USHORT * sp;
          struct smb_v2_referral * v2ref;
--- 3267,3274 ----
          requestFileName[0] == '\\' &&
          !_strnicmp(cm_NetbiosName,&requestFileName[1],nbnLen) &&
          requestFileName[nbnLen+1] == '\\' &&
!         (!_strnicmp("all",&requestFileName[nbnLen+2],3) ||
! 	 !_strnicmp("*.",&requestFileName[nbnLen+2],2)))
      {
          USHORT * sp;
          struct smb_v2_referral * v2ref;
***************
*** 4886,4891 ****
--- 4912,4919 ----
  	smb_ReleaseFID(fidp);
          return CM_ERROR_BADFD;
      }
+     scp = fidp->scp;
+     cm_HoldSCache(scp);
      lock_ReleaseMutex(&fidp->mx);
  
      /* set inp->fid so that later read calls in same msg can find fid */
***************
*** 4893,4899 ****
  
      userp = smb_GetUser(vcp, inp);
  
-     scp = fidp->scp;
  
      lock_ObtainMutex(&scp->mx);
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
--- 4921,4926 ----
***************
*** 5092,5097 ****
--- 5119,5125 ----
  
    doneSync:
      lock_ReleaseMutex(&scp->mx);
+     cm_ReleaseSCache(scp);
      cm_ReleaseUser(userp);
      smb_ReleaseFID(fidp);
  
***************
*** 5123,5139 ****
  	smb_ReleaseFID(fidp);
          return CM_ERROR_BADFD;
      }
      lock_ReleaseMutex(&fidp->mx);
          
      userp = smb_GetUser(vcp, inp);
          
-     scp = fidp->scp;
-         
      /* otherwise, stat the file */
      lock_ObtainMutex(&scp->mx);
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
                       CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
!     if (code) goto done;
  
      /* decode times.  We need a search time, but the response to this
       * call provides the date first, not the time, as returned in the
--- 5151,5168 ----
  	smb_ReleaseFID(fidp);
          return CM_ERROR_BADFD;
      }
+     scp = fidp->scp;
+     cm_HoldSCache(scp);
      lock_ReleaseMutex(&fidp->mx);
          
      userp = smb_GetUser(vcp, inp);
          
      /* otherwise, stat the file */
      lock_ObtainMutex(&scp->mx);
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
                       CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
!     if (code)
! 	goto done;
  
      /* decode times.  We need a search time, but the response to this
       * call provides the date first, not the time, as returned in the
***************
*** 5162,5167 ****
--- 5191,5197 ----
  
    done:
      lock_ReleaseMutex(&scp->mx);
+     cm_ReleaseSCache(scp);
      cm_ReleaseUser(userp);
      smb_ReleaseFID(fidp);
      return code;
***************
*** 5194,5205 ****
  	smb_ReleaseFID(fidp);
          return CM_ERROR_BADFD;
      }
      lock_ReleaseMutex(&fidp->mx);
          
      userp = smb_GetUser(vcp, inp);
          
-     scp = fidp->scp;
-         
      /* now prepare to call cm_setattr.  This message only sets various times,
       * and AFS only implements mtime, and we'll set the mtime if that's
       * requested.  The others we'll ignore.
--- 5224,5235 ----
  	smb_ReleaseFID(fidp);
          return CM_ERROR_BADFD;
      }
+     scp = fidp->scp;
+     cm_HoldSCache(scp);
      lock_ReleaseMutex(&fidp->mx);
          
      userp = smb_GetUser(vcp, inp);
          
      /* now prepare to call cm_setattr.  This message only sets various times,
       * and AFS only implements mtime, and we'll set the mtime if that's
       * requested.  The others we'll ignore.
***************
*** 5219,5226 ****
              osi_Log1(smb_logp, "**smb_UnixTimeFromSearchTime failed searchTime=%ld", searchTime);
          }
      }
!     else code = 0;
  
      cm_ReleaseUser(userp);
      smb_ReleaseFID(fidp);
      return code;
--- 5249,5258 ----
              osi_Log1(smb_logp, "**smb_UnixTimeFromSearchTime failed searchTime=%ld", searchTime);
          }
      }
!     else 
! 	code = 0;
  
+     cm_ReleaseSCache(scp);
      cm_ReleaseUser(userp);
      smb_ReleaseFID(fidp);
      return code;
***************
*** 5567,5572 ****
--- 5599,5605 ----
      if (shareAccess & FILE_SHARE_WRITE)
          fidflags |= SMB_FID_SHARE_WRITE;
  
+     osi_Log1(smb_logp, "NTCreateX fidflags 0x%x", fidflags);
      code = 0;
  
      /* For an exclusive create, we want to do a case sensitive match for the last component. */
***************
*** 6094,6100 ****
      smb_SetSMBParm(outp, parmSlot, 0); parmSlot++;	/* filetype */
      smb_SetSMBParm(outp, parmSlot, 0); parmSlot++;	/* dev state */
      smb_SetSMBParmByte(outp, parmSlot,
!                         scp->fileType == CM_SCACHETYPE_DIRECTORY); /* is a dir? */
      lock_ReleaseMutex(&scp->mx);
      smb_SetSMBDataLength(outp, 0);
  
--- 6127,6135 ----
      smb_SetSMBParm(outp, parmSlot, 0); parmSlot++;	/* filetype */
      smb_SetSMBParm(outp, parmSlot, 0); parmSlot++;	/* dev state */
      smb_SetSMBParmByte(outp, parmSlot,
!                         (scp->fileType == CM_SCACHETYPE_DIRECTORY ||
! 			 scp->fileType == CM_SCACHETYPE_MOUNTPOINT ||
! 			 scp->fileType == CM_SCACHETYPE_INVALID) ? 1 : 0); /* is a dir? */
      lock_ReleaseMutex(&scp->mx);
      smb_SetSMBDataLength(outp, 0);
  
***************
*** 6720,6726 ****
          *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* EOF */
          *((USHORT *)outData) = 0; outData += 2;	/* filetype */
          *((USHORT *)outData) = 0; outData += 2;	/* dev state */
!         *((USHORT *)outData) = (scp->fileType == CM_SCACHETYPE_DIRECTORY);
          outData += 2;	/* is a dir? */
          lock_ReleaseMutex(&scp->mx);
      } else {
--- 6755,6763 ----
          *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* EOF */
          *((USHORT *)outData) = 0; outData += 2;	/* filetype */
          *((USHORT *)outData) = 0; outData += 2;	/* dev state */
!         *((USHORT *)outData) = ((scp->fileType == CM_SCACHETYPE_DIRECTORY ||
! 				scp->fileType == CM_SCACHETYPE_MOUNTPOINT ||
! 				scp->fileType == CM_SCACHETYPE_INVALID) ? 1 : 0);
          outData += 2;	/* is a dir? */
          lock_ReleaseMutex(&scp->mx);
      } else {
***************
*** 6768,6774 ****
          *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* EOF */
          *((USHORT *)outData) = 0; outData += 2;	/* filetype */
          *((USHORT *)outData) = 0; outData += 2;	/* dev state */
!         *((USHORT *)outData) = (scp->fileType == CM_SCACHETYPE_DIRECTORY);
          outData += 1;	/* is a dir? */
          memset(outData,0,24); outData += 24; /* Volume ID and file ID */
          *((ULONG *)outData) = 0x001f01ffL; outData += 4; /* Maxmimal access rights */
--- 6805,6813 ----
          *((LARGE_INTEGER *)outData) = scp->length; outData += 8; /* EOF */
          *((USHORT *)outData) = 0; outData += 2;	/* filetype */
          *((USHORT *)outData) = 0; outData += 2;	/* dev state */
!         *((USHORT *)outData) = ((scp->fileType == CM_SCACHETYPE_DIRECTORY ||
! 				scp->fileType == CM_SCACHETYPE_MOUNTPOINT ||
! 				scp->fileType == CM_SCACHETYPE_INVALID) ? 1 : 0);
          outData += 1;	/* is a dir? */
          memset(outData,0,24); outData += 24; /* Volume ID and file ID */
          *((ULONG *)outData) = 0x001f01ffL; outData += 4; /* Maxmimal access rights */
Index: openafs/src/WINNT/afsd/smb3.h
diff -c openafs/src/WINNT/afsd/smb3.h:1.7.2.4 openafs/src/WINNT/afsd/smb3.h:1.7.2.5
*** openafs/src/WINNT/afsd/smb3.h:1.7.2.4	Thu Jan 19 18:08:46 2006
--- openafs/src/WINNT/afsd/smb3.h	Thu Apr 27 11:55:40 2006
***************
*** 44,83 ****
      union {
  #pragma pack(push, 2)
          struct {
!             long FSID;			/* file system ID */
!             long sectorsPerAllocUnit;
!             long totalAllocUnits;		/* on the disk */
!             long availAllocUnits;		/* free blocks */
              unsigned short bytesPerSector;	/* bytes per sector */
          } allocInfo;
  #pragma pack(pop)
          struct {
!             long vsn;	        /* volume serial number */
              char vnCount;	/* count of chars in label, incl null */
              char label[12];	/* pad out with nulls */
          } volumeInfo;
          struct {
!             FILETIME vct;	/* volume creation time */
!             long vsn;	        /* volume serial number */
!             long vnCount;	/* length of volume label in bytes */
!             char res[2];	/* reserved */
!             char label[10];	/* volume label */
          } FSvolumeInfo;
          struct {
              osi_hyper_t totalAllocUnits;	/* on the disk */
              osi_hyper_t availAllocUnits;	/* free blocks */
!             long sectorsPerAllocUnit;
!             long bytesPerSector;		/* bytes per sector */
          } FSsizeInfo;
          struct {
!             long devType;	/* device type */
!             long characteristics;
          } FSdeviceInfo;
          struct {
!             long attributes;
!             long maxCompLength;	/* max path component length */
!             long FSnameLength;	/* length of file system name */
!             char FSname[12];
          } FSattributeInfo;
      } u;
  } smb_tran2QFSInfo_t;
--- 44,83 ----
      union {
  #pragma pack(push, 2)
          struct {
!             unsigned long FSID;			/* file system ID */
!             unsigned long sectorsPerAllocUnit;
!             unsigned long totalAllocUnits;	/* on the disk */
!             unsigned long availAllocUnits;	/* free blocks */
              unsigned short bytesPerSector;	/* bytes per sector */
          } allocInfo;
  #pragma pack(pop)
          struct {
!             unsigned long vsn;	/* volume serial number */
              char vnCount;	/* count of chars in label, incl null */
              char label[12];	/* pad out with nulls */
          } volumeInfo;
          struct {
!             FILETIME vct;		/* volume creation time */
!             unsigned long vsn;	        /* volume serial number */
!             unsigned long vnCount;	/* length of volume label in bytes */
!             char res[2];		/* reserved */
!             char label[10];		/* volume label */
          } FSvolumeInfo;
          struct {
              osi_hyper_t totalAllocUnits;	/* on the disk */
              osi_hyper_t availAllocUnits;	/* free blocks */
!             unsigned long sectorsPerAllocUnit;
!             unsigned long bytesPerSector;	/* bytes per sector */
          } FSsizeInfo;
          struct {
!             unsigned long devType;		/* device type */
!             unsigned long characteristics;
          } FSdeviceInfo;
          struct {
!             unsigned long attributes;
!             unsigned long maxCompLength;	/* max path component length */
!             unsigned long FSnameLength;		/* length of file system name */
!             unsigned char FSname[12];
          } FSattributeInfo;
      } u;
  } smb_tran2QFSInfo_t;
Index: openafs/src/WINNT/aklog/aklog.c
diff -c openafs/src/WINNT/aklog/aklog.c:1.5.2.12 openafs/src/WINNT/aklog/aklog.c:1.5.2.13
*** openafs/src/WINNT/aklog/aklog.c:1.5.2.12	Fri Jul 15 08:11:02 2005
--- openafs/src/WINNT/aklog/aklog.c	Fri May 19 23:15:58 2006
***************
*** 199,208 ****
      strcpy(lastcell, aserver->cell);
  
      if (!pr_Initialize (0, confname, aserver->cell)) {
!         char sname[PR_MAXNAMELEN];
          strncpy(sname, username, PR_MAXNAMELEN);
          sname[PR_MAXNAMELEN-1] = '\0';
!         *status = pr_SNameToId (sname, &viceId);
      }
  
      if (dflag)
--- 199,213 ----
      strcpy(lastcell, aserver->cell);
  
      if (!pr_Initialize (0, confname, aserver->cell)) {
!         char sname[PR_MAXNAMELEN], *at;
! 
          strncpy(sname, username, PR_MAXNAMELEN);
          sname[PR_MAXNAMELEN-1] = '\0';
! 
! 	at = strchr(sname, '@');
! 	if (at && !stricmp(at+1, realm_of_cell))
! 	    *at = '\0';
! 	*status = pr_SNameToId (sname, &viceId);
      }
  
      if (dflag)
Index: openafs/src/WINNT/client_exp/NTMakefile
diff -c openafs/src/WINNT/client_exp/NTMakefile:1.7.2.1 openafs/src/WINNT/client_exp/NTMakefile:1.7.2.2
*** openafs/src/WINNT/client_exp/NTMakefile:1.7.2.1	Sun Jan 30 23:05:03 2005
--- openafs/src/WINNT/client_exp/NTMakefile	Tue Jun  6 10:44:52 2006
***************
*** 128,133 ****
--- 128,134 ----
  # Local clean target; augments predefined clean target
  
  clean::
+ 	$(DEL) *.pdb
  	$(CD) lang
  	if exist $(NTLANG) $(NTLANG) en_US $(MAKECMD) /nologo /f NTMakefile clean
  	if exist $(NTLANG) $(NTLANG) ja_JP $(MAKECMD) /nologo /f NTMakefile clean
Index: openafs/src/WINNT/client_osi/libosi.def
diff -c openafs/src/WINNT/client_osi/libosi.def:1.3 openafs/src/WINNT/client_osi/libosi.def:1.3.2.1
*** openafs/src/WINNT/client_osi/libosi.def:1.3	Thu Feb 26 14:22:49 2004
--- openafs/src/WINNT/client_osi/libosi.def	Thu May 25 13:18:48 2006
***************
*** 65,71 ****
  	osi_LogPrint		@58
  	osi_LogSaveString	@59
  	osi_InitPanic		@60
! 	osi_InitTraceOption @61
  	osi_LogEvent0		@62
  	osi_LogEvent		@63
!     osi_HexifyString    @64
--- 65,72 ----
  	osi_LogPrint		@58
  	osi_LogSaveString	@59
  	osi_InitPanic		@60
! 	osi_InitTraceOption     @61
  	osi_LogEvent0		@62
  	osi_LogEvent		@63
!         osi_HexifyString        @64
!         osi_QRemoveHT           @65
Index: openafs/src/WINNT/client_osi/osiqueue.c
diff -c openafs/src/WINNT/client_osi/osiqueue.c:1.3 openafs/src/WINNT/client_osi/osiqueue.c:1.3.2.1
*** openafs/src/WINNT/client_osi/osiqueue.c:1.3	Sun Mar  9 20:59:15 2003
--- openafs/src/WINNT/client_osi/osiqueue.c	Thu May 25 13:18:48 2006
***************
*** 93,111 ****
  
  void osi_QRemove(osi_queue_t **headpp, osi_queue_t *eltp)
  {
! 	osi_queue_t *np;	/* next dude */
  
! 	np = eltp->nextp;	/* useful for both paths */
  
! 	if (eltp == *headpp) {
! 		/* we're the first element in the list */
! 		*headpp = np;
! 		if (np) np->prevp = NULL;
! 	}
! 	else {
! 		eltp->prevp->nextp = np;
! 		if (np) np->prevp = eltp->prevp;
! 	}
  }
  
  void osi_InitQueue(void)
--- 93,145 ----
  
  void osi_QRemove(osi_queue_t **headpp, osi_queue_t *eltp)
  {
!     osi_queue_t *np = eltp->nextp;	/* next dude */
!     osi_queue_t *pp = eltp->prevp;	/* prev dude */
  
!     if (eltp == *headpp) {
! 	/* we're the first element in the list */
! 	*headpp = np;
! 	if (np) 
! 	    np->prevp = NULL;
!     }
!     else {
! 	pp->nextp = np;
! 	if (np) 
! 	    np->prevp = pp;
!     }
!     eltp->prevp = NULL;
!     eltp->nextp = NULL;
! }
  
! void osi_QRemoveHT(osi_queue_t **headpp, osi_queue_t **tailpp, osi_queue_t *eltp)
! {
!     osi_queue_t *np = eltp->nextp;	/* next dude */
!     osi_queue_t *pp = eltp->prevp;	/* prev dude */
! 
!     if (eltp == *headpp && eltp == *tailpp) 
!     {
!     	*headpp = *tailpp = NULL;
!     }
!     else if (eltp == *headpp) {
! 	/* we're the first element in the list */
! 	*headpp = np;
! 	if (np) 
! 	    np->prevp = NULL;
!     }	
!     else if (eltp == *tailpp) {
! 	/* we're the last element in the list */
! 	*tailpp = pp;
! 	if (pp) 
! 	    pp->nextp = NULL;
!     }	
!     else {
! 	if (pp)
! 		pp->nextp = np;
! 	if (np)
! 		np->prevp = pp;
!     }
!     eltp->prevp = NULL; 
!     eltp->nextp = NULL;
  }
  
  void osi_InitQueue(void)
Index: openafs/src/WINNT/client_osi/osiqueue.h
diff -c openafs/src/WINNT/client_osi/osiqueue.h:1.2 openafs/src/WINNT/client_osi/osiqueue.h:1.2.2.1
*** openafs/src/WINNT/client_osi/osiqueue.h:1.2	Sun Mar  9 20:59:15 2003
--- openafs/src/WINNT/client_osi/osiqueue.h	Thu May 25 13:18:48 2006
***************
*** 59,64 ****
--- 59,69 ----
   */
  extern void osi_QRemove(osi_queue_t **headpp, osi_queue_t *eltp);
  
+ /* remove an element from a queue with both head and tail pointers; 
+  * takes address of head and tail lists, and element to remove as parameters.
+  */
+ extern void osi_QRemoveHT(osi_queue_t **headpp, osi_queue_t **tailpp, osi_queue_t *eltp);
+ 
  /* initialize the queue package */
  extern void osi_InitQueue(void);
  
Index: openafs/src/WINNT/client_osi/osisleep.c
diff -c openafs/src/WINNT/client_osi/osisleep.c:1.2 openafs/src/WINNT/client_osi/osisleep.c:1.2.2.2
*** openafs/src/WINNT/client_osi/osisleep.c:1.2	Sun Mar  9 20:59:15 2003
--- openafs/src/WINNT/client_osi/osisleep.c	Thu May 25 13:40:59 2006
***************
*** 56,61 ****
--- 56,62 ----
   * should be ignored.
   */
  static osi_sleepInfo_t *osi_sleepers[OSI_SLEEPHASHSIZE];
+ static osi_sleepInfo_t *osi_sleepersEnd[OSI_SLEEPHASHSIZE];
  
  /* allocate space for lock operations */
  osi_lockOps_t *osi_lockOps[OSI_NLOCKTYPES];
***************
*** 109,115 ****
  	if (ap->states & OSI_SLEEPINFO_INHASH) {
  		ap->states &= ~OSI_SLEEPINFO_INHASH;
  		idx = osi_SLEEPHASH(ap->value);
! 		osi_QRemove((osi_queue_t **) &osi_sleepers[idx], &ap->q);
  	}
  
  	if (ap->states & OSI_SLEEPINFO_DELETED) {
--- 110,116 ----
  	if (ap->states & OSI_SLEEPINFO_INHASH) {
  		ap->states &= ~OSI_SLEEPINFO_INHASH;
  		idx = osi_SLEEPHASH(ap->value);
! 		osi_QRemoveHT((osi_queue_t **) &osi_sleepers[idx], (osi_queue_t **) &osi_sleepersEnd[idx], &ap->q);
  	}
  
  	if (ap->states & OSI_SLEEPINFO_DELETED) {
***************
*** 226,231 ****
--- 227,233 ----
  	for(i=0;i<OSI_SLEEPHASHSIZE; i++) {
  		InitializeCriticalSection(&osi_critSec[i]);
  		osi_sleepers[i] = (osi_sleepInfo_t *) NULL;
+ 	        osi_sleepersEnd[i] = (osi_sleepInfo_t *) NULL;
  	}
  
  	/* free list CS */
***************
*** 265,277 ****
  		sp = osi_AllocSleepInfo();
  		TlsSetValue(osi_SleepSlot, sp);
  	}
! 	else
  		sp->states = 0;
  	sp->refCount = 0;
          sp->waitFor = waitFor;
          sp->value = (long) patchp;
!         osi_QAdd((osi_queue_t **) &turnp->firstp, &sp->q);
!         if (!turnp->lastp) turnp->lastp = sp;
          LeaveCriticalSection(releasep);
  
  	/* now wait for the signal */
--- 267,281 ----
  		sp = osi_AllocSleepInfo();
  		TlsSetValue(osi_SleepSlot, sp);
  	}
! 	else {
  		sp->states = 0;
+         }
  	sp->refCount = 0;
          sp->waitFor = waitFor;
          sp->value = (long) patchp;
!         osi_QAddT((osi_queue_t **) &turnp->firstp, (osi_queue_t **) &turnp->lastp, &sp->q);
!         if (!turnp->lastp) 
! 	  turnp->lastp = sp;
          LeaveCriticalSection(releasep);
  
  	/* now wait for the signal */
***************
*** 309,319 ****
  {
  	osi_sleepInfo_t *sp;
          
! 	if (!turnp->lastp) return;
          
          sp = turnp->lastp;
  	turnp->lastp = (osi_sleepInfo_t *) osi_QPrev(&sp->q);
!         osi_QRemove((osi_queue_t **) &turnp->firstp, &sp->q);
          sp->states |= OSI_SLEEPINFO_SIGNALLED;
          ReleaseSemaphore(sp->sema, 1, (long *) 0);
  }
--- 313,324 ----
  {
  	osi_sleepInfo_t *sp;
          
! 	if (!turnp->lastp) 
! 	    return;
          
          sp = turnp->lastp;
  	turnp->lastp = (osi_sleepInfo_t *) osi_QPrev(&sp->q);
!         osi_QRemoveHT((osi_queue_t **) &turnp->firstp, (osi_queue_t **) &turnp->lastp, &sp->q);
          sp->states |= OSI_SLEEPINFO_SIGNALLED;
          ReleaseSemaphore(sp->sema, 1, (long *) 0);
  }
***************
*** 325,331 ****
          
          while(sp = turnp->lastp) {
  		turnp->lastp = (osi_sleepInfo_t *) osi_QPrev(&sp->q);
! 	        osi_QRemove((osi_queue_t **) &turnp->firstp, &sp->q);
  	        sp->states |= OSI_SLEEPINFO_SIGNALLED;
  	        ReleaseSemaphore(sp->sema, 1, (long *) 0);
  	}	/* while someone's still asleep */
--- 330,336 ----
          
          while(sp = turnp->lastp) {
  		turnp->lastp = (osi_sleepInfo_t *) osi_QPrev(&sp->q);
! 	        osi_QRemoveHT((osi_queue_t **) &turnp->firstp, (osi_queue_t **) &turnp->lastp, &sp->q);
  	        sp->states |= OSI_SLEEPINFO_SIGNALLED;
  	        ReleaseSemaphore(sp->sema, 1, (long *) 0);
  	}	/* while someone's still asleep */
***************
*** 370,376 ****
                   * the crit sec.
                   */
  		turnp->lastp = (osi_sleepInfo_t *) osi_QPrev(&tsp->q);
! 	        osi_QRemove((osi_queue_t **) &turnp->firstp, &tsp->q);
                  
  		/* do the patching required for lock obtaining */
                  if (tsp->waitFor & OSI_SLEEPINFO_W4WRITE) {
--- 375,381 ----
                   * the crit sec.
                   */
  		turnp->lastp = (osi_sleepInfo_t *) osi_QPrev(&tsp->q);
! 	        osi_QRemoveHT((osi_queue_t **) &turnp->firstp, (osi_queue_t **) &turnp->lastp, &tsp->q);
                  
  		/* do the patching required for lock obtaining */
                  if (tsp->waitFor & OSI_SLEEPINFO_W4WRITE) {
***************
*** 425,438 ****
  		sp = osi_AllocSleepInfo();
  		TlsSetValue(osi_SleepSlot, sp);
  	}
! 	else
  		sp->states = 0;
  	sp->refCount = 0;
  	sp->value = sleepValue;
  	idx = osi_SLEEPHASH(sleepValue);
  	csp = &osi_critSec[idx];
  	EnterCriticalSection(csp);
! 	osi_QAdd((osi_queue_t **) &osi_sleepers[idx], &sp->q);
  	sp->states |= OSI_SLEEPINFO_INHASH;
  	LeaveCriticalSection(releasep);
  	LeaveCriticalSection(csp);
--- 430,444 ----
  		sp = osi_AllocSleepInfo();
  		TlsSetValue(osi_SleepSlot, sp);
  	}
! 	else {
  		sp->states = 0;
+ 	}
  	sp->refCount = 0;
  	sp->value = sleepValue;
  	idx = osi_SLEEPHASH(sleepValue);
  	csp = &osi_critSec[idx];
  	EnterCriticalSection(csp);
! 	osi_QAddT((osi_queue_t **) &osi_sleepers[idx], (osi_queue_t **) &osi_sleepersEnd[idx], &sp->q);
  	sp->states |= OSI_SLEEPINFO_INHASH;
  	LeaveCriticalSection(releasep);
  	LeaveCriticalSection(csp);
Index: openafs/src/WINNT/eventlog/lang/NTMakefile
diff -c openafs/src/WINNT/eventlog/lang/NTMakefile:1.6 openafs/src/WINNT/eventlog/lang/NTMakefile:1.6.2.1
*** openafs/src/WINNT/eventlog/lang/NTMakefile:1.6	Fri Nov 21 03:00:02 2003
--- openafs/src/WINNT/eventlog/lang/NTMakefile	Tue Jun  6 10:44:53 2006
***************
*** 70,73 ****
  install9x: install
  
  clean::
! 	$(DEL) $(INCFILES) $(DLLFILE)
\ No newline at end of file
--- 70,77 ----
  install9x: install
  
  clean::
! 	$(DEL) $(INCFILES) $(DLLFILE)
! 	$(DEL) $(LANGNAME)\afsevent.h
! 	$(DEL) $(LANGNAME)\event.h
! 	$(DEL) $(LANGNAME)\event.rc
! 	$(DEL) $(LANGNAME)\MSG*.bin
Index: openafs/src/WINNT/install/loopback/NTMakefile
diff -c openafs/src/WINNT/install/loopback/NTMakefile:1.3 openafs/src/WINNT/install/loopback/NTMakefile:1.3.2.1
*** openafs/src/WINNT/install/loopback/NTMakefile:1.3	Thu Jun 24 00:08:57 2004
--- openafs/src/WINNT/install/loopback/NTMakefile	Tue Jun  6 10:44:53 2006
***************
*** 1,4 ****
! # rcsid : $Id: NTMakefile,v 1.3 2004/06/24 04:08:57 jaltman Exp $
  
  RELDIR=WINNT\install\loopback
  !INCLUDE ..\..\..\config\NTMakefile.$(SYS_NAME)
--- 1,4 ----
! # rcsid : $Id: NTMakefile,v 1.3.2.1 2006/06/06 14:44:53 jaltman Exp $
  
  RELDIR=WINNT\install\loopback
  !INCLUDE ..\..\..\config\NTMakefile.$(SYS_NAME)
***************
*** 57,59 ****
--- 57,60 ----
  install:  $(DLLFILE) $(EXEFILE)
  
  clean	::
+ 	$(DEL) *.pdb
Index: openafs/src/WINNT/license/NTMakefile
diff -c openafs/src/WINNT/license/NTMakefile:1.4 openafs/src/WINNT/license/NTMakefile:1.4.2.1
*** openafs/src/WINNT/license/NTMakefile:1.4	Fri Nov 21 03:00:07 2003
--- openafs/src/WINNT/license/NTMakefile	Tue Jun  6 10:44:53 2006
***************
*** 41,43 ****
--- 41,48 ----
  	cd lang
  	nmake /nologo /f ntmakefile SRC=$(SRC) OBJ=$(OBJ) mkdir
  	cd ..
+ 
+ clean ::
+ 	$(CD) lang
+ 	@$(MAKECMD) /nologo /f NTMakefile clean
+ 	$(CD) ..
Index: openafs/src/WINNT/pthread/pthread.c
diff -c openafs/src/WINNT/pthread/pthread.c:1.6.2.7 openafs/src/WINNT/pthread/pthread.c:1.6.2.8
*** openafs/src/WINNT/pthread/pthread.c:1.6.2.7	Tue Apr 19 01:13:01 2005
--- openafs/src/WINNT/pthread/pthread.c	Mon May  1 23:51:55 2006
***************
*** 260,265 ****
--- 260,283 ----
      pthread_cache_done = 1;
  }
  
+ static void cleanup_pthread_cache(void) {
+     thread_p cur = NULL, next = NULL;
+ 
+     if (pthread_cache_done) {
+ 	for(queue_Scan(&active_Q, cur, next, thread)) {
+ 	    queue_Remove(cur);
+ 	}
+ 	for(queue_Scan(&cache_Q, cur, next, thread)) {
+ 	    queue_Remove(cur);
+ 	}
+ 
+ 	pthread_mutex_destroy(&active_Q_mutex);
+ 	pthread_mutex_destroy(&cache_Q_mutex);
+ 
+ 	pthread_cache_done = 0;
+     }
+ }	
+ 
  static void put_thread(thread_p old) {
   
      CloseHandle(old->t_handle);
***************
*** 360,365 ****
--- 378,400 ----
      } while(call_more_destructors);
  }
  
+ static void cleanup_global_tsd(void)
+ {
+     thread_p cur = NULL, next = NULL;
+ 
+     if (tsd_done) {
+ 	for(queue_Scan(&active_Q, cur, next, thread)) {
+ 	    tsd_free_all(cur->tsd);
+ 	}
+ 
+ 	TlsFree(tsd_pthread_index);
+ 	tsd_pthread_index = 0xFFFFFFFF;
+ 	TlsFree(tsd_index);
+ 	tsd_index = 0xFFFFFFFF;
+ 	tsd_done = 0;
+     }
+ }
+ 
  static DWORD WINAPI afs_pthread_create_stub(LPVOID param) {
      pthread_create_t *t = (pthread_create_t *) param;
      void *rc;
***************
*** 700,709 ****
   
  static void init_waiter_cache(void) {
      InitializeCriticalSection(&waiter_cache_cs);
-     waiter_cache_init = 1;
      queue_Init(&waiter_cache);
  }
   
  static cond_waiters_t *get_waiter() {
      cond_waiters_t *new = NULL;
   
--- 735,761 ----
   
  static void init_waiter_cache(void) {
      InitializeCriticalSection(&waiter_cache_cs);
      queue_Init(&waiter_cache);
+     waiter_cache_init = 1;
  }
   
+ static void cleanup_waiter_cache(void)
+ {
+     cond_waiters_t * cur = NULL, * next = NULL;
+ 
+     if (waiter_cache_init) {
+ 	for(queue_Scan(&waiter_cache, cur, next, cond_waiter)) {
+ 	    queue_Remove(cur);
+ 
+ 	    CloseHandle(cur->event);
+ 	    free(cur);
+ 	}
+ 
+ 	DeleteCriticalSection(&waiter_cache_cs);
+ 	waiter_cache_init = 0;
+     }
+ }
+ 
  static cond_waiters_t *get_waiter() {
      cond_waiters_t *new = NULL;
   
***************
*** 1257,1259 ****
--- 1309,1345 ----
      RaiseException(PTHREAD_EXIT_EXCEPTION, 0, 0, NULL);
  
  }
+ 
+ /*
+  * DllMain() -- Entry-point function called by the DllMainCRTStartup()
+  *     function in the MSVC runtime DLL (msvcrt.dll).
+  *
+  *     Note: the system serializes calls to this function.
+  */
+ BOOL WINAPI
+ DllMain(HINSTANCE dllInstHandle,/* instance handle for this DLL module */
+         DWORD reason,           /* reason function is being called */
+         LPVOID reserved)
+ {                               /* reserved for future use */
+     switch (reason) {
+     case DLL_PROCESS_ATTACH:
+         /* library is being attached to a process */
+         /* disable thread attach/detach notifications */
+         (void)DisableThreadLibraryCalls(dllInstHandle);
+ 
+ 	pthread_once(&pthread_cache_once, create_once);
+ 	pthread_once(&global_tsd_once, tsd_once);
+ 	pthread_once(&waiter_cache_once, init_waiter_cache);
+ 	return TRUE;
+ 
+     case DLL_PROCESS_DETACH:
+ 	cleanup_waiter_cache();
+ 	cleanup_global_tsd();
+ 	cleanup_pthread_cache();
+         return TRUE;
+ 
+     default:
+         return FALSE;
+     }
+ }
+ 
Index: openafs/src/WINNT/pthread/pthread.def
diff -c openafs/src/WINNT/pthread/pthread.def:1.1 openafs/src/WINNT/pthread/pthread.def:1.1.24.1
*** openafs/src/WINNT/pthread/pthread.def:1.1	Fri Nov  3 21:21:36 2000
--- openafs/src/WINNT/pthread/pthread.def	Mon May  1 23:51:55 2006
***************
*** 25,27 ****
--- 25,28 ----
  	pthread_attr_getdetachstate			@23
  	pthread_attr_setdetachstate			@24
  	pthread_exit					@25
+ 	DllMain						@26
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.74.2.12 openafs/src/afs/afs_call.c:1.74.2.13
*** openafs/src/afs/afs_call.c:1.74.2.12	Tue Jan 17 12:09:47 2006
--- openafs/src/afs/afs_call.c	Mon May 22 15:08:45 2006
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74.2.12 2006/01/17 17:09:47 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74.2.13 2006/05/22 19:08:45 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 50,56 ****
  
  #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
  kmutex_t afs_global_lock;
- kmutex_t afs_rxglobal_lock;
  #endif
  
  #if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
--- 50,55 ----
Index: openafs/src/afs/afs_osi.c
diff -c openafs/src/afs/afs_osi.c:1.48.2.6 openafs/src/afs/afs_osi.c:1.48.2.7
*** openafs/src/afs/afs_osi.c:1.48.2.6	Wed Feb 15 15:55:11 2006
--- openafs/src/afs/afs_osi.c	Mon May 22 15:08:45 2006
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.48.2.6 2006/02/15 20:55:11 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.48.2.7 2006/05/22 19:08:45 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 71,77 ****
      /* Linux initialization in osi directory. Should move the others. */
      mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL);
  #endif
-     /* afs_rxglobal_lock is initialized in rx_Init. */
  #endif /* AFS_GLOBAL_SUNLOCK */
  #endif /* AFS_HPUX_ENV */
  
--- 71,76 ----
Index: openafs/src/afs/DOC/afs_rwlocks
diff -c openafs/src/afs/DOC/afs_rwlocks:1.3.8.1 openafs/src/afs/DOC/afs_rwlocks:1.3.8.2
*** openafs/src/afs/DOC/afs_rwlocks:1.3.8.1	Thu Jan 26 11:04:49 2006
--- openafs/src/afs/DOC/afs_rwlocks	Mon May 22 15:08:46 2006
***************
*** 81,89 ****
  Many fine grained locks are used by Rx on the AIX4.1 platform.  These
  need to be explained.
  
- It is likely they could be used preference to the afs_rxglobal_lock on
- AFS_GLOBAL_SUNLOCK platforms.
- 
  ***** GLOBAL LOCKS
  
  98. afs_global_lock -- This lock provides a non-preemptive environment
--- 81,86 ----
***************
*** 96,105 ****
  data structures that need synchronization.  However, much existing code
  is deficient in this regard (e.g. afs_getevent).
  
- 99. afs_rxglobal_lock -- This lock is obtained after the afs_global_lock
- at process level but is obtained independently during packet arrival
- "interrupts" and during fasttimo processing.
- 
  ***** OS LOCKS
  
  100. The vnode lock on SunOS and SGI53 protects the its reference count.
--- 93,98 ----
Index: openafs/src/afs/FBSD/osi_machdep.h
diff -c openafs/src/afs/FBSD/osi_machdep.h:1.9.2.3 openafs/src/afs/FBSD/osi_machdep.h:1.9.2.4
*** openafs/src/afs/FBSD/osi_machdep.h:1.9.2.3	Mon May 23 17:09:37 2005
--- openafs/src/afs/FBSD/osi_machdep.h	Mon May 22 15:08:46 2006
***************
*** 25,32 ****
  #include <sys/mutex.h>
  #endif
  
- extern struct simplelock afs_rxglobal_lock;
- 
  /* 
   * Time related macros
   */
--- 25,30 ----
Index: openafs/src/afs/LINUX/osi_probe.c
diff -c openafs/src/afs/LINUX/osi_probe.c:1.1.2.9 openafs/src/afs/LINUX/osi_probe.c:1.1.2.11
*** openafs/src/afs/LINUX/osi_probe.c:1.1.2.9	Fri Apr  7 01:23:11 2006
--- openafs/src/afs/LINUX/osi_probe.c	Wed May 31 13:40:57 2006
***************
*** 117,123 ****
  
  /* Allow the user to specify sys_call_table addresses */
  static unsigned long sys_call_table_addr[4] = { 0,0,0,0 };
! #ifdef module_param_array
  module_param_array(sys_call_table_addr, long, NULL, 0);
  #else
  MODULE_PARM(sys_call_table_addr, "1-4l");
--- 117,123 ----
  
  /* Allow the user to specify sys_call_table addresses */
  static unsigned long sys_call_table_addr[4] = { 0,0,0,0 };
! #if defined(module_param_array) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
  module_param_array(sys_call_table_addr, long, NULL, 0);
  #else
  MODULE_PARM(sys_call_table_addr, "1-4l");
***************
*** 134,140 ****
  MODULE_PARM_DESC(probe_carefully, "Probe for system call tables carefully");
  
  static int probe_ignore_syscalls[8] = { -1, -1, -1, -1, -1, -1, -1, -1 };
! #ifdef module_param_array
  module_param_array(probe_ignore_syscalls, int, NULL, 0);
  #else
  MODULE_PARM(probe_ignore_syscalls, "1-8i");
--- 134,140 ----
  MODULE_PARM_DESC(probe_carefully, "Probe for system call tables carefully");
  
  static int probe_ignore_syscalls[8] = { -1, -1, -1, -1, -1, -1, -1, -1 };
! #if defined(module_param_array) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
  module_param_array(probe_ignore_syscalls, int, NULL, 0);
  #else
  MODULE_PARM(probe_ignore_syscalls, "1-8i");
***************
*** 161,167 ****
  MODULE_PARM_DESC(probe_debug, "Debugging level");
  
  static unsigned long probe_debug_addr[4] = { 0,0,0,0 };
! #ifdef module_param_array
  module_param_array(probe_debug_addr, long, NULL, 0);
  #else
  MODULE_PARM(probe_debug_addr, "1-4l");
--- 161,167 ----
  MODULE_PARM_DESC(probe_debug, "Debugging level");
  
  static unsigned long probe_debug_addr[4] = { 0,0,0,0 };
! #if defined(module_param_array) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
  module_param_array(probe_debug_addr, long, NULL, 0);
  #else
  MODULE_PARM(probe_debug_addr, "1-4l");
***************
*** 643,649 ****
      0x3ffff,
      0x30000,
  #else
!     0, 0, 0, 0
  #endif
  
  
--- 643,649 ----
      0x3ffff,
      0x30000,
  #else
!     0, 0, 0, 0,
  #endif
  
  
***************
*** 782,788 ****
      0x3ffff,
      0x30000,
  #else
!     0, 0, 0, 0
  #endif
  
      /* number and list of unimplemented system calls */
--- 782,788 ----
      0x3ffff,
      0x30000,
  #else
!     0, 0, 0, 0,
  #endif
  
      /* number and list of unimplemented system calls */
***************
*** 877,883 ****
      0x3ffff,
      0x30000,
  #else
!     0, 0, 0, 0
  #endif
  
      /* number and list of unimplemented system calls */
--- 877,883 ----
      0x3ffff,
      0x30000,
  #else
!     0, 0, 0, 0,
  #endif
  
      /* number and list of unimplemented system calls */
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.12 openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.13
*** openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.12	Mon Nov 28 22:20:28 2005
--- openafs/src/afs/LINUX/osi_vfsops.c	Thu Jun  1 11:59:56 2006
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.12 2005/11/29 03:20:28 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.13 2006/06/01 15:59:56 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
***************
*** 344,353 ****
      struct vcache *vcp = VTOAFS(ip);
  
      AFS_GLOCK();
!     if (VREFCOUNT(vcp) == 2) {
! 	if (VREFCOUNT(vcp) == 2)
! 	    afs_InactiveVCache(vcp, NULL);
!     }
      AFS_GUNLOCK();
  }
  
--- 344,351 ----
      struct vcache *vcp = VTOAFS(ip);
  
      AFS_GLOCK();
!     if (VREFCOUNT(vcp) == 2) 
! 	afs_InactiveVCache(vcp, NULL);
      AFS_GUNLOCK();
  }
  
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.40 openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.41
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.40	Wed Jan 11 16:38:30 2006
--- openafs/src/afs/LINUX/osi_vnodeops.c	Tue Jun 13 12:00:38 2006
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.40 2006/01/11 21:38:30 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.41 2006/06/13 16:00:38 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 463,468 ****
--- 463,487 ----
      code = afs_lockctl(vcp, &flock, cmd, credp);
      AFS_GUNLOCK();
  
+ #ifdef AFS_LINUX24_ENV
+     if (code == 0 && (cmd == F_SETLK || cmd == F_SETLKW)) {
+        struct file_lock flp2;
+        flp2 = *flp;
+ #ifdef AFS_LINUX26_ENV
+        flp2.fl_flags &=~ FL_SLEEP;
+ #endif
+        code = posix_lock_file(fp, &flp2);
+        osi_Assert(code != -EAGAIN); /* there should be no conflicts */
+        if (code) {
+            struct AFS_FLOCK flock2;
+            flock2 = flock;
+            flock2.l_type = F_UNLCK;
+            AFS_GLOCK();
+            afs_lockctl(vcp, &flock2, F_SETLK, credp);
+            AFS_GUNLOCK();
+        }
+     }
+ #endif
      /* Convert flock back to Linux's file_lock */
      flp->fl_type = flock.l_type;
      flp->fl_pid = flock.l_pid;
Index: openafs/src/afs/NBSD/osi_machdep.h
diff -c openafs/src/afs/NBSD/osi_machdep.h:1.1.8.1 openafs/src/afs/NBSD/osi_machdep.h:1.1.8.2
*** openafs/src/afs/NBSD/osi_machdep.h:1.1.8.1	Wed Apr 13 22:31:40 2005
--- openafs/src/afs/NBSD/osi_machdep.h	Mon May 22 15:08:46 2006
***************
*** 24,30 ****
  /* #include <sys/unix_defs.h> */
  
  #define getpid()		curproc
- extern struct simplelock afs_rxglobal_lock;
  
  /* 
   * Time related macros
--- 24,29 ----
Index: openafs/src/afs/OBSD/osi_machdep.h
diff -c openafs/src/afs/OBSD/osi_machdep.h:1.16.2.5 openafs/src/afs/OBSD/osi_machdep.h:1.16.2.6
*** openafs/src/afs/OBSD/osi_machdep.h:1.16.2.5	Mon May 23 17:17:29 2005
--- openafs/src/afs/OBSD/osi_machdep.h	Mon May 22 15:08:47 2006
***************
*** 16,30 ****
   * afs_osi.h.
   */
  
! /* $Id: osi_machdep.h,v 1.16.2.5 2005/05/23 21:17:29 shadow Exp $ */
  
  #ifndef _OSI_MACHDEP_H_
  #define _OSI_MACHDEP_H_
  
  #include <sys/lock.h>
  
- extern struct simplelock afs_rxglobal_lock;
- 
  #define M_AFSFID	(M_TEMP-1)
  #define M_AFSBUFHDR	(M_TEMP-2)
  #define M_AFSBUFFER	(M_TEMP-3)
--- 16,28 ----
   * afs_osi.h.
   */
  
! /* $Id: osi_machdep.h,v 1.16.2.6 2006/05/22 19:08:47 shadow Exp $ */
  
  #ifndef _OSI_MACHDEP_H_
  #define _OSI_MACHDEP_H_
  
  #include <sys/lock.h>
  
  #define M_AFSFID	(M_TEMP-1)
  #define M_AFSBUFHDR	(M_TEMP-2)
  #define M_AFSBUFFER	(M_TEMP-3)
Index: openafs/src/afs/SOLARIS/osi_machdep.h
diff -c openafs/src/afs/SOLARIS/osi_machdep.h:1.7.2.1 openafs/src/afs/SOLARIS/osi_machdep.h:1.7.2.2
*** openafs/src/afs/SOLARIS/osi_machdep.h:1.7.2.1	Wed Apr 13 22:31:42 2005
--- openafs/src/afs/SOLARIS/osi_machdep.h	Mon May 22 15:08:47 2006
***************
*** 69,75 ****
   */
  #include <sys/mutex.h>
  extern kmutex_t afs_global_lock;
- extern kmutex_t afs_rxglobal_lock;
  
  #define AFS_GLOCK()	mutex_enter(&afs_global_lock);
  #define AFS_GUNLOCK()	mutex_exit(&afs_global_lock);
--- 69,74 ----
Index: openafs/src/afs/VNOPS/afs_vnop_flock.c
diff -c openafs/src/afs/VNOPS/afs_vnop_flock.c:1.24.2.4 openafs/src/afs/VNOPS/afs_vnop_flock.c:1.24.2.6
*** openafs/src/afs/VNOPS/afs_vnop_flock.c:1.24.2.4	Mon Feb 27 15:35:12 2006
--- openafs/src/afs/VNOPS/afs_vnop_flock.c	Fri Jun  2 17:23:52 2006
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.24.2.4 2006/02/27 20:35:12 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.24.2.6 2006/06/02 21:23:52 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 24,29 ****
--- 24,30 ----
  #include "afs/afs_cbqueue.h"
  #include "afs/nfsclient.h"
  #include "afs/afs_osidnlc.h"
+ #include "afs/unified_afs.h"
  
  /* Static prototypes */
  static int HandleGetLock(register struct vcache *avc,
***************
*** 422,428 ****
  		break;
  	    }
  	    /* now, if we got EWOULDBLOCK, and we're supposed to wait, we do */
! 	    if (((code == EWOULDBLOCK) || (code == EAGAIN))
  		&& !(acom & LOCK_NB)) {
  		/* sleep for a second, allowing interrupts */
  		ReleaseWriteLock(&avc->lock);
--- 423,430 ----
  		break;
  	    }
  	    /* now, if we got EWOULDBLOCK, and we're supposed to wait, we do */
! 	    if (((code == EWOULDBLOCK) || (code == EAGAIN) || 
! 		 (code == UAEWOULDBLOCK) || (code == UAEAGAIN))
  		&& !(acom & LOCK_NB)) {
  		/* sleep for a second, allowing interrupts */
  		ReleaseWriteLock(&avc->lock);
Index: openafs/src/bucoord/commands.c
diff -c openafs/src/bucoord/commands.c:1.14.2.3 openafs/src/bucoord/commands.c:1.14.2.4
*** openafs/src/bucoord/commands.c:1.14.2.3	Mon Jul 11 15:29:33 2005
--- openafs/src/bucoord/commands.c	Tue Apr 11 15:28:20 2006
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bucoord/commands.c,v 1.14.2.3 2005/07/11 19:29:33 shadow Exp $");
  
  #include <afs/stds.h>
  #if defined(AFS_LINUX24_ENV)
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bucoord/commands.c,v 1.14.2.4 2006/04/11 19:28:20 shadow Exp $");
  
  #include <afs/stds.h>
  #if defined(AFS_LINUX24_ENV)
***************
*** 1964,1970 ****
      code = bc_StartDmpRst(bc_globalConfig, dumpPath, vsName, volsToDump,
  			  /*destServer */ 0, /*destPartition */ 0,
  			  /*fromDate */ 0,
! 			  /*newExt */ 0, /*oldFlag */ 0,
  			  parent, level, bc_Dumper, portp, /*portCount */ 1,
  			  baseds, doAppend, dontExecute);
      if (code)
--- 1964,1970 ----
      code = bc_StartDmpRst(bc_globalConfig, dumpPath, vsName, volsToDump,
  			  /*destServer */ 0, /*destPartition */ 0,
  			  /*fromDate */ 0,
! 			  /*newExt */ NULL, /*oldFlag */ 0,
  			  parent, level, bc_Dumper, portp, /*portCount */ 1,
  			  baseds, doAppend, dontExecute);
      if (code)
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.1.2.32 openafs/src/config/NTMakefile.amd64_w2k:1.1.2.36
*** openafs/src/config/NTMakefile.amd64_w2k:1.1.2.32	Sun Apr  9 01:01:58 2006
--- openafs/src/config/NTMakefile.amd64_w2k	Sun Jun  4 23:30:02 2006
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=4
! AFSPRODUCT_VER_PATCH=0101
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=4
! AFSPRODUCT_VER_PATCH=0151
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.46.2.47 openafs/src/config/NTMakefile.i386_nt40:1.46.2.51
*** openafs/src/config/NTMakefile.i386_nt40:1.46.2.47	Sun Apr  9 01:01:58 2006
--- openafs/src/config/NTMakefile.i386_nt40	Sun Jun  4 23:30:02 2006
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=4
! AFSPRODUCT_VER_PATCH=0101
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=4
! AFSPRODUCT_VER_PATCH=0151
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_w2k
diff -c openafs/src/config/NTMakefile.i386_w2k:1.1.2.34 openafs/src/config/NTMakefile.i386_w2k:1.1.2.38
*** openafs/src/config/NTMakefile.i386_w2k:1.1.2.34	Sun Apr  9 01:01:58 2006
--- openafs/src/config/NTMakefile.i386_w2k	Sun Jun  4 23:30:02 2006
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=4
! AFSPRODUCT_VER_PATCH=0101
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=4
! AFSPRODUCT_VER_PATCH=0151
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/param.i386_obsd39.h
diff -c /dev/null openafs/src/config/param.i386_obsd39.h:1.1
*** /dev/null	Tue Jun 13 12:10:27 2006
--- openafs/src/config/param.i386_obsd39.h	Thu Mar  9 10:27:18 2006
***************
*** 0 ****
--- 1,69 ----
+ /*
+  * Jim Rees, University of Michigan CITI
+  */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define SYS_NAME		"i386_obsd39"
+ #define SYS_NAME_ID		SYS_NAME_ID_i386_obsd39
+ 
+ #define AFS_XBSD_ENV		1	/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV	1
+ 
+ #define AFS_NAMEI_ENV		1	/* User space interface to file system */
+ #define AFS_64BIT_ENV		1
+ #define AFS_64BIT_CLIENT	1
+ #define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
+ #define AFS_OBSD_ENV		1
+ #define AFS_OBSD34_ENV		1
+ #define AFS_OBSD35_ENV		1
+ #define AFS_OBSD36_ENV		1
+ #define AFS_OBSD37_ENV		1
+ #define AFS_OBSD38_ENV		1
+ #define AFS_OBSD39_ENV		1
+ #define AFS_NONFSTRANS		1
+ #define AFS_VM_RDWR_ENV		1
+ #define AFS_VFS_ENV		1
+ #define AFS_VFSINCL_ENV		1
+ 
+ #define FTRUNC O_TRUNC
+ 
+ #define AFS_SYSCALL		208
+ #define AFS_MOUNT_AFS		"afs"
+ 
+ #define RXK_LISTENER_ENV	1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ #define AFSLITTLE_ENDIAN	1
+ 
+ #ifndef IGNORE_STDS_H
+ #include <afs/afs_sysnames.h>
+ #endif
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #ifdef MULTIPROCESSOR
+ #define AFS_GLOBAL_SUNLOCK	1
+ #endif
+ #define	AFS_SHORTGID		0	/* are group id's short? */
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/export/Makefile.in
diff -c openafs/src/export/Makefile.in:1.15.2.4 openafs/src/export/Makefile.in:1.15.2.5
*** openafs/src/export/Makefile.in:1.15.2.4	Sat Apr 23 20:59:03 2005
--- openafs/src/export/Makefile.in	Thu Apr 27 13:35:19 2006
***************
*** 127,132 ****
--- 127,144 ----
  ${DEST}/root.client/usr/vice/etc/dkload/export64.ext.nonfs: @AIX64@export64.ext.nonfs
  @AIX64@	${INSTALL} $? $@
  
+ ${DESTDIR}${afskerneldir}/export.ext: export.ext
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afskerneldir}/export64.ext: @AIX64@export64.ext
+ @AIX64@	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afskerneldir}/export.ext.nonfs: export.ext.nonfs
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afskerneldir}/export64.ext.nonfs: @AIX64@export64.ext.nonfs
+ @AIX64@	${INSTALL} $? $@
+ 
  ${DEST}/lib/afs/export.exp: export.exp
  	${INSTALL} $? $@
  
***************
*** 168,173 ****
--- 180,197 ----
  ${DEST}/root.client/usr/vice/etc/dkload/cfgafs64: @AIX64@cfgafs64
  @AIX64@	${INSTALL} $? $@
  
+ ${DESTDIR}${afskerneldir}/cfgexport: cfgexport
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afskerneldir}/cfgexport64: @AIX64@cfgexport64
+ @AIX64@	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afskerneldir}/cfgafs: cfgafs
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afskerneldir}/cfgafs64: @AIX64@cfgafs64
+ @AIX64@	${INSTALL} $? $@
+ 
  dest:    ${DEST}/root.client/usr/vice/etc/dkload/export.ext \
  	${DEST}/root.client/usr/vice/etc/dkload/export.ext.nonfs \
  	${DEST}/root.client/usr/vice/etc/dkload/export64.ext.nonfs \
Index: openafs/src/libafs/MakefileProto.AIX.in
diff -c openafs/src/libafs/MakefileProto.AIX.in:1.23.2.1 openafs/src/libafs/MakefileProto.AIX.in:1.23.2.2
*** openafs/src/libafs/MakefileProto.AIX.in:1.23.2.1	Tue Apr 19 11:55:20 2005
--- openafs/src/libafs/MakefileProto.AIX.in	Thu Apr 27 13:35:20 2006
***************
*** 126,131 ****
--- 126,137 ----
  dest_afs.ext.64: $(DEST)/root.client/usr/vice/etc/dkload/afs.ext.64
  	echo Install for 64-bit Kernel Complete
  
+ install_afs.ext.32: $(DESTDIR)$(afskerneldir)/afs.ext.32
+ 	echo Install for 32-bit Kernel Complete
+ 
+ install_afs.ext.64: $(DESTDIR)$(afskerneldir)/afs.ext.64
+ 	echo Install for 64-bit Kernel Complete
+ 
  # Standard AFS->NFS translator support is removed in AFS 3.5 in favor of
  # the iauth authentication mechanism. The model was changed by IBM in the
  # middle of an OS release. So iauth is only supported on AIX 4.1.5 and 
***************
*** 133,145 ****
  # they are ever made. AIX 4.3 also uses the iauth translator.
  
  LIBAFSIAUTH = afs.ext.32.iauth
- LIBAFS = afs.ext.32
  
  DEST_LIBAFSIAUTH = $(DEST)/root.client/usr/vice/etc/dkload/$(LIBAFSIAUTH)
- DEST_LIBAFS = $(DEST)/root.client/usr/vice/etc/dkload/$(LIBAFS)
  
  INST_LIBAFSIAUTH = ${DESTDIR}${afskerneldir}/$(LIBAFSIAUTH)
- INST_LIBAFS = ${DESTDIR}${afskerneldir}/$(LIBAFS)
  
  $(DEST)/root.client/usr/vice/etc/dkload/afs.ext.32: afs.ext.32
  	$(INSTALL) -f $? $@
--- 139,148 ----
***************
*** 151,162 ****
  	-${STRIP} -X 64 $@
  	$(INSTALL) -f $?.map $@.map
  	
! $(DEST_LIBAFSIAUTH): $(LIBAFSIAUTH)
  	$(INSTALL) -f $? $@
! 	-${STRIP} $@
  	$(INSTALL) -f $?.map $@.map
! 	
! $(INST_LIBAFS): $(LIBAFS)
  	$(INSTALL) -f $? $@
  	-${STRIP} $@
  	$(INSTALL) -f $?.map $@.map
--- 154,170 ----
  	-${STRIP} -X 64 $@
  	$(INSTALL) -f $?.map $@.map
  	
! $(DESTDIR)$(afskerneldir)/afs.ext.32: afs.ext.32
  	$(INSTALL) -f $? $@
! 	-${STRIP} -X 32 $@
  	$(INSTALL) -f $?.map $@.map
! 
! $(DESTDIR)$(afskerneldir)/afs.ext.64: afs.ext.64
! 	$(INSTALL) -f $? $@
! 	-${STRIP} -X 64 $@
! 	$(INSTALL) -f $?.map $@.map
! 
! $(DEST_LIBAFSIAUTH): $(LIBAFSIAUTH)
  	$(INSTALL) -f $? $@
  	-${STRIP} $@
  	$(INSTALL) -f $?.map $@.map
Index: openafs/src/packaging/MacOS/OpenAFS.Info.plist
diff -c openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.17 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.18
*** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.17	Mon Apr 10 16:29:43 2006
--- openafs/src/packaging/MacOS/OpenAFS.Info.plist	Wed Jun  7 01:05:54 2006
***************
*** 3,15 ****
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.4.1</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.4.1</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
--- 3,15 ----
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.4.2-beta1</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.4.2-beta1</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
Index: openafs/src/packaging/MacOS/OpenAFS.info
diff -c openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.31 openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.32
*** openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.31	Mon Apr 10 16:29:43 2006
--- openafs/src/packaging/MacOS/OpenAFS.info	Wed Jun  7 01:05:54 2006
***************
*** 1,5 ****
  Title OpenAFS
! Version 1.4.1
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
--- 1,5 ----
  Title OpenAFS
! Version 1.4.2-beta1
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
Index: openafs/src/packaging/MacOS/buildpkg.sh
diff -c openafs/src/packaging/MacOS/buildpkg.sh:1.4.2.9 openafs/src/packaging/MacOS/buildpkg.sh:1.4.2.10
*** openafs/src/packaging/MacOS/buildpkg.sh:1.4.2.9	Thu Mar 23 11:08:34 2006
--- openafs/src/packaging/MacOS/buildpkg.sh	Mon May  8 15:28:08 2006
***************
*** 143,150 ****
  
      ln -s ../../Library/OpenAFS/Tools/root.client/usr/vice/etc/afsd $PKGROOT/usr/sbin/afsd
  
!     mkdir -p $PKGROOT/Library/Kerberos\ Plug-Ins
!     ln -s ../../Library/OpenAFS/Tools/root.client/Library/Kerberos\ Plug-Ins/aklog.loginLogout $PKGROOT/Library/Kerberos\ Plug-Ins/
  
      chown -R root${SEP}wheel $PKGROOT/usr
      chmod -R og-w $PKGROOT/usr
--- 143,150 ----
  
      ln -s ../../Library/OpenAFS/Tools/root.client/usr/vice/etc/afsd $PKGROOT/usr/sbin/afsd
  
! #    mkdir -p $PKGROOT/Library/Kerberos\ Plug-Ins
! #    ln -s ../../Library/OpenAFS/Tools/root.client/Library/Kerberos\ Plug-Ins/aklog.loginLogout $PKGROOT/Library/Kerberos\ Plug-Ins/
  
      chown -R root${SEP}wheel $PKGROOT/usr
      chmod -R og-w $PKGROOT/usr
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.58.2.30 openafs/src/rx/rx.c:1.58.2.31
*** openafs/src/rx/rx.c:1.58.2.30	Tue Nov 29 02:01:50 2005
--- openafs/src/rx/rx.c	Mon May 22 15:08:48 2006
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58.2.30 2005/11/29 07:01:50 jaltman Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58.2.31 2006/05/22 19:08:48 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
***************
*** 441,450 ****
      if (!uniprocessor)
  	rx_sleepLock = alloc_spinlock(LAST_HELD_ORDER - 10, "rx_sleepLock");
  #endif /* KERNEL && AFS_HPUX110_ENV */
- #else /* RX_ENABLE_LOCKS */
- #if defined(KERNEL) && defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_OBSD_ENV)
-     mutex_init(&afs_rxglobal_lock, "afs_rxglobal_lock", MUTEX_DEFAULT, NULL);
- #endif /* AFS_GLOBAL_SUNLOCK */
  #endif /* RX_ENABLE_LOCKS */
  
      rxi_nCalls = 0;
--- 441,446 ----
Index: openafs/src/rx/rx_getaddr.c
diff -c openafs/src/rx/rx_getaddr.c:1.15.2.7 openafs/src/rx/rx_getaddr.c:1.15.2.11
*** openafs/src/rx/rx_getaddr.c:1.15.2.7	Tue Sep 20 20:34:13 2005
--- openafs/src/rx/rx_getaddr.c	Mon Jun 12 23:54:18 2006
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_getaddr.c,v 1.15.2.7 2005/09/21 00:34:13 shadow Exp $");
  
  #ifndef AFS_DJGPP_ENV
  #ifndef KERNEL
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_getaddr.c,v 1.15.2.11 2006/06/13 03:54:18 shadow Exp $");
  
  #ifndef AFS_DJGPP_ENV
  #ifndef KERNEL
***************
*** 140,146 ****
  */
  #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
  int
! rx_getAllAddr(afs_int32 buffer[], int maxSize)
  {
      size_t needed;
      int mib[6];
--- 140,146 ----
  */
  #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
  int
! rx_getAllAddr_internal(afs_int32 buffer[], int maxSize, int loopbacks)
  {
      size_t needed;
      int mib[6];
***************
*** 189,197 ****
  	}
  	if ((ifm->ifm_flags & IFF_UP) == 0)
  	    continue;		/* not up */
- 	if (ifm->ifm_flags & IFF_LOOPBACK) {
- 	    continue;		/* skip aliased loopbacks as well. */
- 	}
  	while (addrcount > 0) {
  	    struct sockaddr_in *a;
  
--- 189,194 ----
***************
*** 207,212 ****
--- 204,213 ----
  	    if (count >= maxSize)	/* no more space */
  		dpf(("Too many interfaces..ignoring 0x%x\n",
  		       a->sin_addr.s_addr));
+ 	    else if (!loopbacks && a->sin_addr.s_addr == htonl(0x7f000001)) 
+ 		continue;	/* skip loopback address as well. */
+ 	    else if (loopbacks && ifm->ifm_flags & IFF_LOOPBACK) 
+ 		continue;	/* skip aliased loopbacks as well. */
  	    else
  		buffer[count++] = a->sin_addr.s_addr;
  	    addrcount--;
***************
*** 230,236 ****
      struct sockaddr_dl *sdl;
      struct rt_addrinfo info;
      char *buf, *lim, *next;
!     int count = 0, addrcount = 0;
  
      mib[0] = CTL_NET;
      mib[1] = PF_ROUTE;
--- 231,237 ----
      struct sockaddr_dl *sdl;
      struct rt_addrinfo info;
      char *buf, *lim, *next;
!     int count = 0, addrcount = 0, i;
  
      mib[0] = CTL_NET;
      mib[1] = PF_ROUTE;
***************
*** 315,320 ****
--- 316,331 ----
      free(buf);
      return count;
  }
+ 
+ 
+ int
+ rx_getAllAddr(afs_int32 buffer[], int maxSize)
+ {
+     return rx_getAllAddr_internal(buffer, maxSize, 0);
+ }
+ /* this function returns the total number of interface addresses
+ ** the buffer has to be passed in by the caller
+ */
  #else
  static int
  rx_getAllAddr_internal(afs_int32 buffer[], int maxSize, int loopbacks)
***************
*** 418,424 ****
  #endif
  
  #if !defined(AFS_USERSPACE_IP_ADDR)
!     count = rx_getAllAddr_internal(addrBuffer, 1024, 1);
      for (i = 0; i < count; i++) {
  	maskBuffer[i] = htonl(0xffffffff);
  	mtuBuffer[i] = htonl(1500);
--- 429,435 ----
  #endif
  
  #if !defined(AFS_USERSPACE_IP_ADDR)
!     count = rx_getAllAddr_internal(addrBuffer, 1024, 0);
      for (i = 0; i < count; i++) {
  	maskBuffer[i] = htonl(0xffffffff);
  	mtuBuffer[i] = htonl(1500);
Index: openafs/src/rx/rx_kernel.h
diff -c openafs/src/rx/rx_kernel.h:1.13.2.1 openafs/src/rx/rx_kernel.h:1.13.2.2
*** openafs/src/rx/rx_kernel.h:1.13.2.1	Wed Oct  5 01:58:42 2005
--- openafs/src/rx/rx_kernel.h	Wed May 31 12:01:45 2006
***************
*** 43,48 ****
--- 43,49 ----
  
  #ifndef AFS_DARWIN80_ENV
  #define ifnet_mtu(x) (x)->if_mtu
+ #define ifnet_flags(x) (x?(x)->if_flags:0)
  #define AFS_IFNET_T struct ifnet *
  #else
  #define AFS_IFNET_T ifnet_t
Index: openafs/src/rx/xdr_rx.c
diff -c openafs/src/rx/xdr_rx.c:1.10.2.3 openafs/src/rx/xdr_rx.c:1.10.2.4
*** openafs/src/rx/xdr_rx.c:1.10.2.3	Tue May 24 19:14:44 2005
--- openafs/src/rx/xdr_rx.c	Wed May 31 12:01:45 2006
***************
*** 19,27 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/xdr_rx.c,v 1.10.2.3 2005/05/24 23:14:44 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
  #include "h/types.h"
  #include "h/uio.h"
--- 19,28 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/xdr_rx.c,v 1.10.2.4 2006/05/31 16:01:45 rees Exp $");
  
  #ifdef KERNEL
+ #include "afs/sysincludes.h"
  #ifndef UKERNEL
  #include "h/types.h"
  #include "h/uio.h"
***************
*** 49,55 ****
  #include "rx/xdr.h"
  #include "netinet/in.h"
  #else /* !UKERNEL */
- #include "afs/sysincludes.h"
  #include "rpc/types.h"
  #include "rpc/xdr.h"
  #endif /* !UKERNEL */
--- 50,55 ----
Index: openafs/src/rxkad/private_data.h
diff -c openafs/src/rxkad/private_data.h:1.4 openafs/src/rxkad/private_data.h:1.4.2.1
*** openafs/src/rxkad/private_data.h:1.4	Tue Jul 15 19:16:42 2003
--- openafs/src/rxkad/private_data.h	Tue May 23 12:31:02 2006
***************
*** 48,62 ****
      afs_int32 ipAddr;		/* or an approximation to it */
  };
  
  /* private data in client-side security object */
  struct rxkad_cprivate {
      afs_int32 kvno;		/* key version of ticket */
!     afs_int32 ticketLen;	/* length of ticket */
      fc_KeySchedule keysched;	/* the session key */
      fc_InitializationVector ivec;	/* initialization vector for cbc */
      char ticket[MAXKTCTICKETLEN];	/* the ticket for the server */
-     rxkad_type type;		/* always client */
-     rxkad_level level;		/* minimum security level of client */
  };
  
  /* Per connection client-side info */
--- 48,64 ----
      afs_int32 ipAddr;		/* or an approximation to it */
  };
  
+ #define PDATA_SIZE(l) (sizeof(struct rxkad_cprivate) - MAXKTCTICKETLEN + (l))
+ 
  /* private data in client-side security object */
  struct rxkad_cprivate {
      afs_int32 kvno;		/* key version of ticket */
!     afs_int16 ticketLen;	/* length of ticket */
!     rxkad_type type;		/* always client */
!     rxkad_level level;		/* minimum security level of client */
      fc_KeySchedule keysched;	/* the session key */
      fc_InitializationVector ivec;	/* initialization vector for cbc */
      char ticket[MAXKTCTICKETLEN];	/* the ticket for the server */
  };
  
  /* Per connection client-side info */
Index: openafs/src/rxkad/rxkad_client.c
diff -c openafs/src/rxkad/rxkad_client.c:1.18.2.4 openafs/src/rxkad/rxkad_client.c:1.18.2.5
*** openafs/src/rxkad/rxkad_client.c:1.18.2.4	Mon Feb 27 19:19:20 2006
--- openafs/src/rxkad/rxkad_client.c	Tue May 23 12:31:02 2006
***************
*** 19,25 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxkad/rxkad_client.c,v 1.18.2.4 2006/02/28 00:19:20 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/stds.h"
--- 19,25 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxkad/rxkad_client.c,v 1.18.2.5 2006/05/23 16:31:02 jaltman Exp $");
  
  #ifdef KERNEL
  #include "afs/stds.h"
***************
*** 181,187 ****
      struct rx_securityClass *tsc;
      struct rxkad_cprivate *tcp;
      int code;
!     int size;
  
      size = sizeof(struct rx_securityClass);
      tsc = (struct rx_securityClass *)rxi_Alloc(size);
--- 181,187 ----
      struct rx_securityClass *tsc;
      struct rxkad_cprivate *tcp;
      int code;
!     int size, psize;
  
      size = sizeof(struct rx_securityClass);
      tsc = (struct rx_securityClass *)rxi_Alloc(size);
***************
*** 189,203 ****
      tsc->refCount = 1;		/* caller gets one for free */
      tsc->ops = &rxkad_client_ops;
  
!     size = sizeof(struct rxkad_cprivate);
!     tcp = (struct rxkad_cprivate *)rxi_Alloc(size);
!     memset((void *)tcp, 0, size);
      tsc->privateData = (char *)tcp;
      tcp->type |= rxkad_client;
      tcp->level = level;
      code = fc_keysched(sessionkey, tcp->keysched);
      if (code) {
! 	rxi_Free(tcp, sizeof(struct rxkad_cprivate));
  	rxi_Free(tsc, sizeof(struct rx_securityClass));
  	return 0;		/* bad key */
      }
--- 189,203 ----
      tsc->refCount = 1;		/* caller gets one for free */
      tsc->ops = &rxkad_client_ops;
  
!     psize = PDATA_SIZE(ticketLen);
!     tcp = (struct rxkad_cprivate *)rxi_Alloc(psize);
!     memset((void *)tcp, 0, psize);
      tsc->privateData = (char *)tcp;
      tcp->type |= rxkad_client;
      tcp->level = level;
      code = fc_keysched(sessionkey, tcp->keysched);
      if (code) {
! 	rxi_Free(tcp, psize);
  	rxi_Free(tsc, sizeof(struct rx_securityClass));
  	return 0;		/* bad key */
      }
***************
*** 205,211 ****
      tcp->kvno = kvno;		/* key version number */
      tcp->ticketLen = ticketLen;	/* length of ticket */
      if (tcp->ticketLen > MAXKTCTICKETLEN) {
! 	rxi_Free(tcp, sizeof(struct rxkad_cprivate));
  	rxi_Free(tsc, sizeof(struct rx_securityClass));
  	return 0;		/* bad key */
      }
--- 205,211 ----
      tcp->kvno = kvno;		/* key version number */
      tcp->ticketLen = ticketLen;	/* length of ticket */
      if (tcp->ticketLen > MAXKTCTICKETLEN) {
! 	rxi_Free(tcp, psize);
  	rxi_Free(tsc, sizeof(struct rx_securityClass));
  	return 0;		/* bad key */
      }
Index: openafs/src/rxkad/rxkad_common.c
diff -c openafs/src/rxkad/rxkad_common.c:1.20.2.9 openafs/src/rxkad/rxkad_common.c:1.20.2.10
*** openafs/src/rxkad/rxkad_common.c:1.20.2.9	Mon Feb 27 19:19:20 2006
--- openafs/src/rxkad/rxkad_common.c	Tue May 23 12:31:02 2006
***************
*** 23,29 ****
  #define INCLUDE_RXKAD_PRIVATE_DECLS
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxkad/rxkad_common.c,v 1.20.2.9 2006/02/28 00:19:20 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 23,29 ----
  #define INCLUDE_RXKAD_PRIVATE_DECLS
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxkad/rxkad_common.c,v 1.20.2.10 2006/05/23 16:31:02 jaltman Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 68,74 ****
  #include <strings.h>
  #endif
  #endif
! 
  #endif /* KERNEL */
  
  #include <des/stats.h>
--- 68,74 ----
  #include <strings.h>
  #endif
  #endif
! #include <afs/afsutil.h>
  #endif /* KERNEL */
  
  #include <des/stats.h>
***************
*** 311,317 ****
      tcp = (struct rxkad_cprivate *)aobj->privateData;
      rxi_Free(aobj, sizeof(struct rx_securityClass));
      if (tcp->type & rxkad_client) {
! 	rxi_Free(tcp, sizeof(struct rxkad_cprivate));
      } else if (tcp->type & rxkad_server) {
  	rxi_Free(tcp, sizeof(struct rxkad_sprivate));
      } else {
--- 311,318 ----
      tcp = (struct rxkad_cprivate *)aobj->privateData;
      rxi_Free(aobj, sizeof(struct rx_securityClass));
      if (tcp->type & rxkad_client) {
! 	afs_int32 psize = PDATA_SIZE(tcp->ticketLen);
! 	rxi_Free(tcp, psize);
      } else if (tcp->type & rxkad_server) {
  	rxi_Free(tcp, sizeof(struct rxkad_sprivate));
      } else {
Index: openafs/src/shlibafsrpc/Makefile.in
diff -c openafs/src/shlibafsrpc/Makefile.in:1.15.2.7 openafs/src/shlibafsrpc/Makefile.in:1.15.2.8
*** openafs/src/shlibafsrpc/Makefile.in:1.15.2.7	Sat Dec 10 13:45:40 2005
--- openafs/src/shlibafsrpc/Makefile.in	Wed Jun  7 00:22:27 2006
***************
*** 55,60 ****
--- 55,62 ----
  	xdr_int32.o \
  	xdr_int64.o \
  	xdr_afsuuid.o \
+ 	xdr_update.o \
+ 	xdr_refernce.o \
  	AFS_component_version_number.o
  
  RXOBJS =\
***************
*** 280,286 ****
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.15.2.7 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
--- 282,288 ----
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.15.2.8 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
Index: openafs/src/util/serverLog.c
diff -c openafs/src/util/serverLog.c:1.22.2.10 openafs/src/util/serverLog.c:1.22.2.11
*** openafs/src/util/serverLog.c:1.22.2.10	Mon Jul 11 15:29:39 2005
--- openafs/src/util/serverLog.c	Wed Jun  7 00:27:20 2006
***************
*** 20,26 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/serverLog.c,v 1.22.2.10 2005/07/11 19:29:39 shadow Exp $");
  
  #include <stdio.h>
  #ifdef AFS_NT40_ENV
--- 20,26 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/serverLog.c,v 1.22.2.11 2006/06/07 04:27:20 shadow Exp $");
  
  #include <stdio.h>
  #ifdef AFS_NT40_ENV
***************
*** 313,332 ****
  	printf("Unable to open log file %s\n", fileName);
  	return -1;
      }
- #if defined(AFS_PTHREAD_ENV)
      /* redirect stdout and stderr so random printf's don't write to data */
!     assert(freopen(NULLDEV, "w", stdout) != NULL);
!     assert(freopen(NULLDEV, "w", stderr) != NULL);
  
      assert(pthread_mutex_init(&serverLogMutex, NULL) == 0);
  
      serverLogFD = tempfd;
- #else
-     close(tempfd);		/* just checking.... */
-     (void)freopen(fileName, "w", stdout);
-     (void)freopen(fileName, "w", stderr);
-     serverLogFD = fileno(stdout);
- #endif /* AFS_PTHREAD_ENV */
  
      return 0;
  }				/*OpenLog */
--- 313,336 ----
  	printf("Unable to open log file %s\n", fileName);
  	return -1;
      }
      /* redirect stdout and stderr so random printf's don't write to data */
!     (void)freopen(fileName, "a", stdout);
!     (void)freopen(fileName, "a", stderr);
! #ifdef HAVE_SETVBUF
! #ifdef SETVBUF_REVERSED
!     setvbuf(stderr, _IONBF, NULL, 0);
! #else
!     setvbuf(stderr, NULL, _IONBF, 0);
! #endif
! #else
!     setbuf(stderr, NULL);
! #endif
  
+ #if defined(AFS_PTHREAD_ENV)
      assert(pthread_mutex_init(&serverLogMutex, NULL) == 0);
+ #endif /* AFS_PTHREAD_ENV */
  
      serverLogFD = tempfd;
  
      return 0;
  }				/*OpenLog */
***************
*** 356,382 ****
      }
  #endif
  
- #if defined(AFS_PTHREAD_ENV)
      LOCK_SERVERLOG();
      if (serverLogFD > 0)
  	close(serverLogFD);
      serverLogFD = open(fileName, O_WRONLY | O_APPEND | O_CREAT | (isfifo?O_NONBLOCK:0), 0666);
!     UNLOCK_SERVERLOG();
!     return serverLogFD < 0 ? -1 : 0;
  #else
  
-     tempfd = open(fileName, O_WRONLY | O_APPEND | O_CREAT | (isfifo?O_NONBLOCK:0), 0666);
-     if (tempfd < 0) {
- 	printf("Unable to open log file %s\n", fileName);
- 	return -1;
      }
!     close(tempfd);
! 
!     (void)freopen(fileName, "a", stdout);
!     (void)freopen(fileName, "a", stderr);
!     serverLogFD = fileno(stdout);
! 
! 
!     return 0;
! #endif /* AFS_PTHREAD_ENV */
  }
--- 360,383 ----
      }
  #endif
  
      LOCK_SERVERLOG();
      if (serverLogFD > 0)
  	close(serverLogFD);
      serverLogFD = open(fileName, O_WRONLY | O_APPEND | O_CREAT | (isfifo?O_NONBLOCK:0), 0666);
!     if (serverLogFD > 0) {
! 	(void)freopen(fileName, "a", stdout);
! 	(void)freopen(fileName, "a", stderr);
! #ifdef HAVE_SETVBUF
! #ifdef SETVBUF_REVERSED
! 	setvbuf(stderr, _IONBF, NULL, 0);
  #else
+ 	setvbuf(stderr, NULL, _IONBF, 0);
+ #endif
+ #else
+ 	setbuf(stderr, NULL);
+ #endif
  
      }
!     UNLOCK_SERVERLOG();
!     return serverLogFD < 0 ? -1 : 0;
  }
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.81.2.25 openafs/src/viced/afsfileprocs.c:1.81.2.28
*** openafs/src/viced/afsfileprocs.c:1.81.2.25	Fri Apr  7 01:36:59 2006
--- openafs/src/viced/afsfileprocs.c	Wed May 10 01:01:08 2006
***************
*** 29,35 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.25 2006/04/07 05:36:59 jaltman Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 29,35 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.28 2006/05/10 05:01:08 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 655,664 ****
  #endif /* AFS_PTHREAD_ENV */
      }
  
!     if (client->host->hcps.prlist_len && !client->host->hcps.prlist_val) {
  	ViceLog(0,
! 		("CheckRights: len=%u, for host=0x%x\n",
! 		 client->host->hcps.prlist_len, client->host->host));
      } else
  	acl_CheckRights(ACL, &client->host->hcps, &hrights);
      H_UNLOCK;
--- 655,667 ----
  #endif /* AFS_PTHREAD_ENV */
      }
  
!     if (!client->host->hcps.prlist_len || !client->host->hcps.prlist_val) {
! 	char hoststr[16];
  	ViceLog(0,
! 		("CheckRights: len=%u, for host=%s:%d\n",
! 		 client->host->hcps.prlist_len, 
! 		 afs_inet_ntoa_r(client->host->host, hoststr),
! 		 ntohs(client->host->port)));
      } else
  	acl_CheckRights(ACL, &client->host->hcps, &hrights);
      H_UNLOCK;
***************
*** 3179,3184 ****
--- 3182,3191 ----
  		 afs_uint32 Length, afs_uint32 FileLength,
  		 struct AFSFetchStatus * OutStatus, struct AFSVolSync * Sync)
  {
+     if (FileLength > 0x7fffffff || Pos > 0x7fffffff || 
+ 	(0x7fffffff - Pos) < Length)
+         return EFBIG;
+ 
      return common_StoreData64(acall, Fid, InStatus, Pos, Length, FileLength,
  	                      OutStatus, Sync);
  }				/*SRXAFS_StoreData */
***************
*** 6947,6953 ****
  	errorCode = rx_WritevAlloc(Call, tiov, &tnio, RX_MAXIOVECS, wlen);
  	if (errorCode <= 0) {
  	    FDH_CLOSE(fdP);
- 	    VTakeOffline(volptr);
  	    return EIO;
  	}
  	wlen = errorCode;
--- 6954,6959 ----
Index: openafs/src/viced/host.c
diff -c openafs/src/viced/host.c:1.57.2.29 openafs/src/viced/host.c:1.57.2.36
*** openafs/src/viced/host.c:1.57.2.29	Thu Mar 30 11:29:22 2006
--- openafs/src/viced/host.c	Wed Jun  7 00:55:25 2006
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.57.2.29 2006/03/30 16:29:22 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.57.2.36 2006/06/07 04:55:25 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 161,166 ****
--- 161,168 ----
  static void
  FreeCE(register struct client *entry)
  {
+     entry->VenusEpoch = 0;
+     entry->sid = 0;
      entry->next = CEFree;
      CEFree = entry;
      CEs--;
***************
*** 729,738 ****
  	    if ((client->ViceId != ANONYMOUSID) && client->CPS.prlist_val)
  		free(client->CPS.prlist_val);
  	    client->CPS.prlist_val = NULL;
- 	    if (client->tcon) {
- 		rx_SetSpecific(client->tcon, rxcon_client_key, (void *)0);
- 		rx_PutConnection(client->tcon);
- 	    }
  	    CurrentConnections--;
  	    *cp = client->next;
  	    ReleaseWriteLock(&client->lock);
--- 731,736 ----
***************
*** 755,772 ****
  	    Console--;
  	if ((rxconn = host->callback_rxcon)) {
  	    host->callback_rxcon = (struct rx_connection *)0;
- 	    /*
- 	     * If rx_DestroyConnection calls h_FreeConnection we will
- 	     * deadlock on the host_glock_mutex. Work around the problem
- 	     * by unhooking the client from the connection before
- 	     * destroying the connection.
- 	     */
- 	    client = rx_GetSpecific(rxconn, rxcon_client_key);
- 	    if (client && client->tcon == rxconn) {
- 		rx_PutConnection(client->tcon);
- 		client->tcon = NULL;
- 	    }
- 	    rx_SetSpecific(rxconn, rxcon_client_key, (void *)0);
  	    rx_DestroyConnection(rxconn);
  	}
  	if (host->hcps.prlist_val)
--- 753,758 ----
***************
*** 825,848 ****
  }				/*h_TossStuff_r */
  
  
- /* Called by rx when a server connection disappears */
- int
- h_FreeConnection(struct rx_connection *tcon)
- {
-     register struct client *client;
- 
-     client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
-     if (client) {
- 	H_LOCK;
- 	if (client->tcon == tcon) {
- 	    rx_PutConnection(client->tcon);
- 	    client->tcon = (struct rx_connection *)0;
- 	}
- 	H_UNLOCK;
-     }
-     return 0;
- }				/*h_FreeConnection */
- 
  
  /* h_Enumerate: Calls (*proc)(host, held, param) for at least each host in the
   * system at the start of the enumeration (perhaps more).  Hosts may be deleted
--- 811,816 ----
***************
*** 953,958 ****
--- 921,932 ----
      /* hash into proper bucket */
      index = h_HashIndex(addr);
  
+     /* don't add the same entry multiple times */
+     for (chain = hostHashTable[index]; chain; chain = chain->next) {
+ 	if (chain->hostPtr == host && chain->addr == addr && chain->port == port)
+ 	    return;
+     }
+ 
      /* insert into beginning of list for this bucket */
      chain = (struct h_hashChain *)malloc(sizeof(struct h_hashChain));
      if (!chain) {
***************
*** 964,970 ****
      chain->addr = addr;
      chain->port = port;
      hostHashTable[index] = chain;
- 
  }
  
  /*
--- 938,943 ----
***************
*** 1321,1372 ****
  		    h_Lock_r(oldHost);
  
                      if (oldHost->interface) {
  			afsUUID uuid = oldHost->interface->uuid;
                          cb_conn = oldHost->callback_rxcon;
                          rx_GetConnection(cb_conn);
  			rx_SetConnDeadTime(cb_conn, 2);
  			rx_SetConnHardDeadTime(cb_conn, AFS_HARDDEADTIME);
  			H_UNLOCK;
! 			code = RXAFSCB_ProbeUuid(cb_conn, &uuid);
  			H_LOCK;
  			rx_SetConnDeadTime(cb_conn, 50);
  			rx_SetConnHardDeadTime(cb_conn, AFS_HARDDEADTIME);
                          rx_PutConnection(cb_conn);
                          cb_conn=NULL;
! 			if (code && MultiProbeAlternateAddress_r(oldHost)) {
                              probefail = 1;
                          }
                      } else {
                          probefail = 1;
                      }
  
-                     if (probefail) {
-                         /* The old host is either does not have a Uuid,
-                          * is not responding to Probes, 
-                          * or does not have a matching Uuid. 
-                          * Delete it! */
-                         oldHost->hostFlags |= HOSTDELETED;
-                         h_Unlock_r(oldHost);
- 			/* Let the holder be last release */
- 			if (!oheld) {
- 			    h_Release_r(oldHost);
- 			}
- 			oldHost = NULL;
-                     }
-                 }
- 		if (oldHost) {
  		    /* This is a new address for an existing host. Update
  		     * the list of interfaces for the existing host and
  		     * delete the host structure we just allocated. */
  		    if (oldHost->host != haddr || oldHost->port != hport) {
  			ViceLog(25,
  				("CB: new addr %s:%d for old host %s:%d\n",
  				  afs_inet_ntoa_r(haddr, hoststr),
  				  ntohs(hport), 
  				  afs_inet_ntoa_r(oldHost->host, hoststr2),
  				  ntohs(oldHost->port)));
! 			if (oldHost->host == haddr) {
! 			    /* We have just been contacted by a client behind a NAT */
  			    removeInterfaceAddr_r(oldHost, oldHost->host, oldHost->port);
  			} else {
  			    int i, found;
--- 1294,1347 ----
  		    h_Lock_r(oldHost);
  
                      if (oldHost->interface) {
+ 			int code2;
  			afsUUID uuid = oldHost->interface->uuid;
                          cb_conn = oldHost->callback_rxcon;
                          rx_GetConnection(cb_conn);
  			rx_SetConnDeadTime(cb_conn, 2);
  			rx_SetConnHardDeadTime(cb_conn, AFS_HARDDEADTIME);
  			H_UNLOCK;
! 			code2 = RXAFSCB_ProbeUuid(cb_conn, &uuid);
  			H_LOCK;
  			rx_SetConnDeadTime(cb_conn, 50);
  			rx_SetConnHardDeadTime(cb_conn, AFS_HARDDEADTIME);
                          rx_PutConnection(cb_conn);
                          cb_conn=NULL;
! 			if (code2) {
! 			    /* The primary address is either not responding or
! 			     * is not the client we are looking for.  
! 			     * MultiProbeAlternateAddress_r() will remove the
! 			     * alternate interfaces that do not have the same
! 			     * Uuid. */
! 			    ViceLog(0,("CB: ProbeUuid for %s:%d failed %d\n",
! 					 afs_inet_ntoa_r(oldHost->host, hoststr),
! 					 ntohs(oldHost->port),code2));
! 			    MultiProbeAlternateAddress_r(oldHost);
                              probefail = 1;
                          }
                      } else {
                          probefail = 1;
                      }
  
  		    /* This is a new address for an existing host. Update
  		     * the list of interfaces for the existing host and
  		     * delete the host structure we just allocated. */
  		    if (oldHost->host != haddr || oldHost->port != hport) {
+ 			struct rx_connection *rxconn;
+ 
  			ViceLog(25,
  				("CB: new addr %s:%d for old host %s:%d\n",
  				  afs_inet_ntoa_r(haddr, hoststr),
  				  ntohs(hport), 
  				  afs_inet_ntoa_r(oldHost->host, hoststr2),
  				  ntohs(oldHost->port)));
! 			if (probefail || oldHost->host == haddr) {
! 			    /* The probe failed which means that the old address is 
! 			     * either unreachable or is not the same host we were just
! 			     * contacted by.  We will also remove addresses if only
! 			     * the port has changed because that indicates the client
! 			     * is behind a NAT. 
! 			     */
  			    removeInterfaceAddr_r(oldHost, oldHost->host, oldHost->port);
  			} else {
  			    int i, found;
***************
*** 1389,1394 ****
--- 1364,1385 ----
  			addInterfaceAddr_r(oldHost, haddr, hport);
  			oldHost->host = haddr;
  			oldHost->port = hport;
+ 			rxconn = oldHost->callback_rxcon;
+ 			oldHost->callback_rxcon = host->callback_rxcon;
+ 			host->callback_rxcon = NULL;
+ 			
+ 			if (rxconn) {
+ 			    struct client *client;
+ 			    /*
+ 			     * If rx_DestroyConnection calls h_FreeConnection we will
+ 			     * deadlock on the host_glock_mutex. Work around the problem
+ 			     * by unhooking the client from the connection before
+ 			     * destroying the connection.
+ 			     */
+ 			    client = rx_GetSpecific(rxconn, rxcon_client_key);
+ 			    rx_SetSpecific(rxconn, rxcon_client_key, (void *)0);
+ 			    rx_DestroyConnection(rxconn);
+ 			}
  		    }
  		    host->hostFlags |= HOSTDELETED;
  		    h_Unlock_r(host);
***************
*** 1602,1608 ****
      int created = 0;
  
      client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
!     if (client) {
  	client->refCount++;
  	h_Hold_r(client->host);
  	if (!client->deleted && client->prfail != 2) {	
--- 1593,1600 ----
      int created = 0;
  
      client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
!     if (client && client->sid == rxr_CidOf(tcon) 
! 	&& client->VenusEpoch == rxr_GetEpoch(tcon)) {
  	client->refCount++;
  	h_Hold_r(client->host);
  	if (!client->deleted && client->prfail != 2) {	
***************
*** 1675,1700 ****
  	for (client = host->FirstClient; client; client = client->next) {
  	    if (!client->deleted && (client->sid == rxr_CidOf(tcon))
  		&& (client->VenusEpoch == rxr_GetEpoch(tcon))) {
- 		if (client->tcon && (client->tcon != tcon)) {
- 		    ViceLog(0,
- 			    ("*** Vid=%d, sid=%x, tcon=%x, Tcon=%x ***\n",
- 			     client->ViceId, client->sid, client->tcon,
- 			     tcon));
- 		    oldClient =
- 			(struct client *)rx_GetSpecific(client->tcon,
- 							rxcon_client_key);
- 		    if (oldClient) {
- 			if (oldClient == client) {
- 			    rx_SetSpecific(client->tcon, rxcon_client_key,
- 					   NULL);
- 			} else
- 			    ViceLog(0,
- 				    ("Client-conn mismatch: CL1=%x, CN=%x, CL2=%x\n",
- 				     client, client->tcon, oldClient));
- 		    }
- 		    rx_PutConnection(client->tcon);
- 		    client->tcon = (struct rx_connection *)0;
- 		}
  		client->refCount++;
  		H_UNLOCK;
  		ObtainWriteLock(&client->lock);
--- 1667,1672 ----
***************
*** 1787,1793 ****
       * the RPC from the other client structure's rock.
       */
      oldClient = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
!     if (oldClient && oldClient->tcon == tcon) {
  	char hoststr[16];
  	if (!oldClient->deleted) {
  	    /* if we didn't create it, it's not ours to put back */
--- 1759,1766 ----
       * the RPC from the other client structure's rock.
       */
      oldClient = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
!     if (oldClient && oldClient->sid == rxr_CidOf(tcon)
! 	&& oldClient->VenusEpoch == rxr_GetEpoch(tcon)) {
  	char hoststr[16];
  	if (!oldClient->deleted) {
  	    /* if we didn't create it, it's not ours to put back */
***************
*** 1801,1809 ****
  		    free(client->CPS.prlist_val);
  		client->CPS.prlist_val = NULL;
  		client->CPS.prlist_len = 0;
- 		if (client->tcon) {
- 		    rx_SetSpecific(client->tcon, rxcon_client_key, (void *)0);
- 		}
  	    }
  	    /* We should perhaps check for 0 here */
  	    client->refCount--;
--- 1774,1779 ----
***************
*** 1816,1823 ****
  	    oldClient->refCount++;
  	    client = oldClient;
  	} else {
- 	    rx_PutConnection(oldClient->tcon);
- 	    oldClient->tcon = (struct rx_connection *)0;
  	    ViceLog(0, ("FindClient: deleted client %x(%x) already had conn %x (host %s:%d), stolen by client %x(%x)\n", 
  			oldClient, oldClient->sid, tcon, 
  			afs_inet_ntoa_r(rxr_HostOf(tcon), hoststr),
--- 1786,1791 ----
***************
*** 1834,1841 ****
  	h_Unlock_r(host);
  	CurrentConnections++;	/* increment number of connections */
      }
-     rx_GetConnection(tcon);
-     client->tcon = tcon;
      rx_SetSpecific(tcon, rxcon_client_key, client);
      ReleaseWriteLock(&client->lock);
  
--- 1802,1807 ----
***************
*** 1867,1896 ****
      H_LOCK;
      *cp = NULL;
      client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
!     if (client == NULL || client->tcon == NULL) {
  	ViceLog(0,
  		("GetClient: no client in conn %x (host %x:%d), VBUSYING\n",
  		 tcon, rxr_HostOf(tcon),ntohs(rxr_PortOf(tcon))));
  	H_UNLOCK;
  	return VBUSY;
      }
!     if (rxr_CidOf(client->tcon) != client->sid) {
  	ViceLog(0,
  		("GetClient: tcon %x tcon sid %d client sid %d\n",
! 		 client->tcon, rxr_CidOf(client->tcon), client->sid));
  	H_UNLOCK;
  	return VBUSY;
      }
-     if (!(client && client->tcon && rxr_CidOf(client->tcon) == client->sid)) {
- 	if (!client)
- 	    ViceLog(0, ("GetClient: no client in conn %x\n", tcon));
- 	else
- 	    ViceLog(0,
- 		    ("GetClient: tcon %x tcon sid %d client sid %d\n",
- 		     client->tcon, client->tcon ? rxr_CidOf(client->tcon)
- 		     : -1, client->sid));
- 	assert(0);
-     }
      if (client && client->LastCall > client->expTime && client->expTime) {
  	char hoststr[16];
  	ViceLog(1,
--- 1833,1852 ----
      H_LOCK;
      *cp = NULL;
      client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
!     if (client == NULL) {
  	ViceLog(0,
  		("GetClient: no client in conn %x (host %x:%d), VBUSYING\n",
  		 tcon, rxr_HostOf(tcon),ntohs(rxr_PortOf(tcon))));
  	H_UNLOCK;
  	return VBUSY;
      }
!     if (rxr_CidOf(tcon) != client->sid || rxr_GetEpoch(tcon) != client->VenusEpoch) {
  	ViceLog(0,
  		("GetClient: tcon %x tcon sid %d client sid %d\n",
! 		 tcon, rxr_CidOf(tcon), client->sid));
  	H_UNLOCK;
  	return VBUSY;
      }
      if (client && client->LastCall > client->expTime && client->expTime) {
  	char hoststr[16];
  	ViceLog(1,
***************
*** 1984,1990 ****
      (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
      for (client = host->FirstClient; client; client = client->next) {
  	if (!client->deleted) {
- 	    if (client->tcon) {
  		(void)afs_snprintf(tmpStr, sizeof tmpStr,
  				   "    user id=%d,  name=%s, sl=%s till %s",
  				   client->ViceId, h_UserName(client),
--- 1940,1945 ----
***************
*** 1997,2008 ****
  							 sizeof(tbuffer))
  				   : "No Limit\n");
  		(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
- 	    } else {
- 		(void)afs_snprintf(tmpStr, sizeof tmpStr,
- 				   "    user=%s, no current server connection\n",
- 				   h_UserName(client));
- 		(void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
- 	    }
  	    (void)afs_snprintf(tmpStr, sizeof tmpStr, "      CPS-%d is [",
  			       client->CPS.prlist_len);
  	    (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
--- 1952,1957 ----
***************
*** 2396,2401 ****
--- 2345,2352 ----
  		}
  	    } else {
  		if (!(host->hostFlags & VENUSDOWN) && host->cblist) {
+ 		    char hoststr[16];
+ 		    (void)afs_inet_ntoa_r(host->host, hoststr);
  		    if (host->interface) {
  			afsUUID uuid = host->interface->uuid;
  			H_UNLOCK;
***************
*** 2403,2413 ****
  			H_LOCK;
  			if (code) {
  			    if (MultiProbeAlternateAddress_r(host)) {
! 				char hoststr[16];
! 				(void)afs_inet_ntoa_r(host->host, hoststr);
! 				ViceLog(0,
! 					("ProbeUuid failed for host %s:%d\n",
! 					 hoststr, ntohs(host->port)));
  				host->hostFlags |= VENUSDOWN;
  			    }
  			}
--- 2354,2361 ----
  			H_LOCK;
  			if (code) {
  			    if (MultiProbeAlternateAddress_r(host)) {
! 				ViceLog(0,("CheckHost: Probing all interfaces of host %s:%d failed, code %d\n",
! 					    hoststr, ntohs(host->port), code));
  				host->hostFlags |= VENUSDOWN;
  			    }
  			}
***************
*** 2416,2426 ****
  			code = RXAFSCB_Probe(cb_conn);
  			H_LOCK;
  			if (code) {
- 			    char hoststr[16];
- 			    (void)afs_inet_ntoa_r(host->host, hoststr);
  			    ViceLog(0,
! 				    ("Probe failed for host %s:%d\n", hoststr,
! 				     ntohs(host->port)));
  			    host->hostFlags |= VENUSDOWN;
  			}
  		    }
--- 2364,2372 ----
  			code = RXAFSCB_Probe(cb_conn);
  			H_LOCK;
  			if (code) {
  			    ViceLog(0,
! 				    ("CheckHost: Probe failed for host %s:%d, code %d\n", 
! 				     hoststr, ntohs(host->port), code));
  			    host->hostFlags |= VENUSDOWN;
  			}
  		    }
***************
*** 2481,2502 ****
      afs_uint16 myPort;
      int found;
      struct Interface *interface;
  
      assert(host);
      assert(interf);
  
-     ViceLog(125,
- 	    ("initInterfaceAddr : host %x numAddr %d\n", host->host,
- 	     interf->numberOfInterfaces));
- 
      number = interf->numberOfInterfaces;
      myAddr = host->host;	/* current interface address */
      myPort = host->port;	/* current port */
  
      /* validation checks */
      if (number < 0 || number > AFS_MAX_INTERFACE_ADDR) {
  	ViceLog(0,
! 		("Number of alternate addresses returned is %d\n", number));
  	return -1;
      }
  
--- 2427,2449 ----
      afs_uint16 myPort;
      int found;
      struct Interface *interface;
+     char hoststr[16];
  
      assert(host);
      assert(interf);
  
      number = interf->numberOfInterfaces;
      myAddr = host->host;	/* current interface address */
      myPort = host->port;	/* current port */
  
+     ViceLog(125,
+ 	    ("initInterfaceAddr : host %s:%d numAddr %d\n", 
+ 	      afs_inet_ntoa_r(myAddr, hoststr), ntohs(myPort), number));
+ 
      /* validation checks */
      if (number < 0 || number > AFS_MAX_INTERFACE_ADDR) {
  	ViceLog(0,
! 		("Invalid number of alternate addresses is %d\n", number));
  	return -1;
      }
  
***************
*** 2552,2558 ****
      host->interface = interface;
  
      for (i = 0; i < host->interface->numberOfInterfaces; i++) {
- 	char hoststr[16];
  	ViceLog(125, ("--- alt address %s:%d\n", 
  		       afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr),
  		       ntohs(host->interface->interface[i].port)));
--- 2499,2504 ----
Index: openafs/src/viced/host.h
diff -c openafs/src/viced/host.h:1.9.2.8 openafs/src/viced/host.h:1.9.2.9
*** openafs/src/viced/host.h:1.9.2.8	Mon Mar 13 19:33:46 2006
--- openafs/src/viced/host.h	Wed Jun  7 00:41:19 2006
***************
*** 113,120 ****
      struct client *next;	/* next client entry for host */
      struct host *host;		/* ptr to parent host entry */
      afs_int32 sid;		/* Connection number from this host */
-     struct rx_connection *tcon;	/* most recent server connection
- 				 * associated with this client */
      prlist CPS;			/* cps for authentication */
      int ViceId;			/* Vice ID of user */
      afs_int32 expTime;		/* RX-only: expiration time */
--- 113,118 ----
***************
*** 205,211 ****
  extern void   hashInsert_r(afs_uint32 addr, afs_uint16 port, 
  			   struct host* host);
  extern struct host *h_LookupUuid_r(afsUUID * uuidp);
- extern int h_FreeConnection(struct rx_connection *tcon);
  extern void h_Enumerate(int (*proc) (), char *param);
  extern struct host *h_GetHost_r(struct rx_connection *tcon);
  extern struct client *h_FindClient_r(struct rx_connection *tcon);
--- 203,208 ----
Index: openafs/src/viced/viced.c
diff -c openafs/src/viced/viced.c:1.58.2.11 openafs/src/viced/viced.c:1.58.2.12
*** openafs/src/viced/viced.c:1.58.2.11	Wed Feb 22 00:02:04 2006
--- openafs/src/viced/viced.c	Wed Jun  7 00:41:20 2006
***************
*** 20,26 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/viced.c,v 1.58.2.11 2006/02/22 05:02:04 jaltman Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 20,26 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/viced.c,v 1.58.2.12 2006/06/07 04:41:20 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 1827,1833 ****
  		("Failed to initialize RX, probably two servers running.\n"));
  	exit(-1);
      }
-     rx_SetDestroyConnProc(tservice, (void (*)())h_FreeConnection);
      rx_SetMinProcs(tservice, 3);
      rx_SetMaxProcs(tservice, lwps);
      rx_SetCheckReach(tservice, 1);
--- 1827,1832 ----
Index: openafs/src/vlserver/vlserver.c
diff -c openafs/src/vlserver/vlserver.c:1.18.2.3 openafs/src/vlserver/vlserver.c:1.18.2.4
*** openafs/src/vlserver/vlserver.c:1.18.2.3	Tue Feb 21 23:09:32 2006
--- openafs/src/vlserver/vlserver.c	Wed Apr 26 11:24:14 2006
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.18.2.3 2006/02/22 04:09:32 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.18.2.4 2006/04/26 15:24:14 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 179,186 ****
  	} else if (strcmp(argv[index], "-nojumbo") == 0) {
  	    rxJumbograms = 0;
  
! 	} else if (!strcmp(argv[i], "-rxmaxmtu")) {
! 	    if ((i + 1) >= argc) {
  		fprintf(stderr, "missing argument for -rxmaxmtu\n"); 
  		return -1; 
  	    }
--- 179,186 ----
  	} else if (strcmp(argv[index], "-nojumbo") == 0) {
  	    rxJumbograms = 0;
  
! 	} else if (!strcmp(argv[index], "-rxmaxmtu")) {
! 	    if ((index + 1) >= argc) {
  		fprintf(stderr, "missing argument for -rxmaxmtu\n"); 
  		return -1; 
  	    }
Index: openafs/src/vol/namei_ops.c
diff -c openafs/src/vol/namei_ops.c:1.21.2.4 openafs/src/vol/namei_ops.c:1.21.2.5
*** openafs/src/vol/namei_ops.c:1.21.2.4	Tue Nov  1 11:45:44 2005
--- openafs/src/vol/namei_ops.c	Mon Jun 12 20:00:17 2006
***************
*** 13,19 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/namei_ops.c,v 1.21.2.4 2005/11/01 16:45:44 shadow Exp $");
  
  #ifdef AFS_NAMEI_ENV
  #include <stdio.h>
--- 13,19 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/namei_ops.c,v 1.21.2.5 2006/06/13 00:00:17 shadow Exp $");
  
  #ifdef AFS_NAMEI_ENV
  #include <stdio.h>
***************
*** 693,708 ****
  		FDH_REALLYCLOSE(fdP);
  		return -1;
  	    }
  	}
  	if (count == 0) {
  	    IHandle_t *th;
  	    IH_INIT(th, ih->ih_dev, ih->ih_vid, ino);
! #if 0
! 	    /* This triggers in the fileserver on the volume index vnodes */
! 	    if (th->ih_refcnt > 1)
! 		Log("Warning: Leaked ref on ihandle dev %d vid %d ino %lld\n",
! 		    th->ih_dev, th->ih_vid, (int64_t) th->ih_ino);
! #endif
  	    namei_HandleToName(&name, th);
  	    IH_RELEASE(th);
  	    code = unlink(name.n_path);
--- 693,716 ----
  		FDH_REALLYCLOSE(fdP);
  		return -1;
  	    }
+ 	} else {
+ 	    IHandle_t *th;
+ 	    IH_INIT(th, ih->ih_dev, ih->ih_vid, ino);
+ 	    Log("Warning: Lost ref on ihandle dev %d vid %d ino %lld\n",
+ 		th->ih_dev, th->ih_vid, (int64_t) th->ih_ino);
+ 	    IH_RELEASE(th);
+ 	  
+ 	    /* If we're less than 0, someone presumably unlinked;
+ 	       don't bother setting count to 0, but we need to drop a lock */
+ 	    if (namei_SetLinkCount(fdP, ino, 0, 1) < 0) {
+ 		FDH_REALLYCLOSE(fdP);
+ 		return -1;
+ 	    }
  	}
  	if (count == 0) {
  	    IHandle_t *th;
  	    IH_INIT(th, ih->ih_dev, ih->ih_vid, ino);
! 
  	    namei_HandleToName(&name, th);
  	    IH_RELEASE(th);
  	    code = unlink(name.n_path);
Index: openafs/src/volser/dumpstuff.c
diff -c openafs/src/volser/dumpstuff.c:1.25 openafs/src/volser/dumpstuff.c:1.25.2.1
*** openafs/src/volser/dumpstuff.c:1.25	Sat Nov 22 23:53:44 2003
--- openafs/src/volser/dumpstuff.c	Mon Apr 17 11:22:26 2006
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/dumpstuff.c,v 1.25 2003/11/23 04:53:44 jaltman Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/dumpstuff.c,v 1.25.2.1 2006/04/17 15:22:26 jaltman Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
***************
*** 211,219 ****
  {
      register b1, b0;
      b1 = iod_getc(iodp);
      b0 = iod_getc(iodp);
      *sp = (b1 << 8) | b0;
!     return b0 != EOF;
  }
  
  static int
--- 211,223 ----
  {
      register b1, b0;
      b1 = iod_getc(iodp);
+     if (b1 == EOF)
+ 	return 0;
      b0 = iod_getc(iodp);
+     if (b0 == EOF)
+ 	return 0;
      *sp = (b1 << 8) | b0;
!     return 1;
  }
  
  static int
***************
*** 221,244 ****
  {
      afs_uint32 register b3, b2, b1, b0;
      b3 = iod_getc(iodp);
      b2 = iod_getc(iodp);
      b1 = iod_getc(iodp);
      b0 = iod_getc(iodp);
      *lp = (((((b3 << 8) | b2) << 8) | b1) << 8) | b0;
!     return b0 != EOF;
  }
  
  static void
  ReadString(register struct iod *iodp, register char *to, register int maxa)
  {
      register int c;
      while (maxa--) {
! 	if ((*to++ = iod_getc(iodp)) == 0)
  	    break;
      }
      if (to[-1]) {
  	while ((c = iod_getc(iodp)) && c != EOF);
! 	to[-1] = 0;
      }
  }
  
--- 225,262 ----
  {
      afs_uint32 register b3, b2, b1, b0;
      b3 = iod_getc(iodp);
+     if (b3 == EOF)
+ 	return 0;
      b2 = iod_getc(iodp);
+     if (b2 == EOF)
+ 	return 0;
      b1 = iod_getc(iodp);
+     if (b1 == EOF)
+ 	return 0;
      b0 = iod_getc(iodp);
+     if (b0 == EOF)
+ 	return 0;
      *lp = (((((b3 << 8) | b2) << 8) | b1) << 8) | b0;
!     return 1;
  }
  
  static void
  ReadString(register struct iod *iodp, register char *to, register int maxa)
  {
      register int c;
+     int first = 1;
+ 
+     *to = '\0';
+     if (maxa == 0)
+ 	return;
+ 
      while (maxa--) {
! 	if ((*to++ = c = iod_getc(iodp)) == 0 || c == EOF)
  	    break;
      }
      if (to[-1]) {
  	while ((c = iod_getc(iodp)) && c != EOF);
! 	to[-1] = '\0';
      }
  }
  
***************
*** 955,962 ****
  	     vcp->diskSize ? 0 : size - vcp->diskSize) >> vcp->logSize;
  	if (nVnodes > 0) {
  	    Buf = (afs_int32 *) malloc(nVnodes * sizeof(afs_int32));
! 	    if (Buf == NULL)
  		return 1;
  	    memset((char *)Buf, 0, nVnodes * sizeof(afs_int32));
  	    STREAM_SEEK(afile, offset = vcp->diskSize, 0);
  	    while (1) {
--- 973,983 ----
  	     vcp->diskSize ? 0 : size - vcp->diskSize) >> vcp->logSize;
  	if (nVnodes > 0) {
  	    Buf = (afs_int32 *) malloc(nVnodes * sizeof(afs_int32));
! 	    if (Buf == NULL) {
! 		STREAM_CLOSE(afile);
! 		FDH_CLOSE(fdP);
  		return 1;
+ 	    }
  	    memset((char *)Buf, 0, nVnodes * sizeof(afs_int32));
  	    STREAM_SEEK(afile, offset = vcp->diskSize, 0);
  	    while (1) {
***************
*** 991,998 ****
      register Volume *vp;
      struct iod iod;
      register struct iod *iodp = &iod;
!     afs_int32 *b1 = 0, *b2 = 0;
!     int s1 = 0, s2 = 0, delo = 0, tdelo;
      int tag;
  
      iod_Init(iodp, call);
--- 1012,1019 ----
      register Volume *vp;
      struct iod iod;
      register struct iod *iodp = &iod;
!     afs_int32 *b1 = NULL, *b2 = NULL;
!     int s1 = 0, s2 = 0, delo = incremental, tdelo;
      int tag;
  
      iod_Init(iodp, call);
***************
*** 1009,1015 ****
      if (ReadVolumeHeader(iodp, &vol) == VOLSERREAD_DUMPERROR)
  	return VOLSERREAD_DUMPERROR;
  
!     delo = ProcessIndex(vp, vLarge, &b1, &s1, 0);
      if (!delo)
  	delo = ProcessIndex(vp, vSmall, &b2, &s2, 0);
      if (delo) {
--- 1030,1037 ----
      if (ReadVolumeHeader(iodp, &vol) == VOLSERREAD_DUMPERROR)
  	return VOLSERREAD_DUMPERROR;
  
!     if (!delo)
! 	delo = ProcessIndex(vp, vLarge, &b1, &s1, 0);
      if (!delo)
  	delo = ProcessIndex(vp, vSmall, &b2, &s2, 0);
      if (delo) {
***************
*** 1017,1023 ****
  	    free((char *)b1);
  	if (b2)
  	    free((char *)b2);
! 	b1 = b2 = 0;
      }
  
      strncpy(vol.name, cookie->name, VOLSER_OLDMAXVOLNAME);
--- 1039,1046 ----
  	    free((char *)b1);
  	if (b2)
  	    free((char *)b2);
! 	b1 = b2 = NULL;
! 	s1 = s2 = 0;
      }
  
      strncpy(vol.name, cookie->name, VOLSER_OLDMAXVOLNAME);
***************
*** 1035,1045 ****
  	tag = iod_getc(iodp);
  	if (tag != D_VOLUMEHEADER)
  	    break;
  	if (ReadVolumeHeader(iodp, &vol) == VOLSERREAD_DUMPERROR) {
  	    error = VOLSERREAD_DUMPERROR;
  	    goto out;
  	}
- 	tdelo = -1;
      }
      if (tag != D_DUMPEND || !ReadInt32(iodp, &endMagic)
  	|| endMagic != DUMPENDMAGIC) {
--- 1058,1068 ----
  	tag = iod_getc(iodp);
  	if (tag != D_VOLUMEHEADER)
  	    break;
+ 
  	if (ReadVolumeHeader(iodp, &vol) == VOLSERREAD_DUMPERROR) {
  	    error = VOLSERREAD_DUMPERROR;
  	    goto out;
  	}
      }
      if (tag != D_DUMPEND || !ReadInt32(iodp, &endMagic)
  	|| endMagic != DUMPENDMAGIC) {
***************
*** 1056,1063 ****
      }
  
      if (!delo) {
! 	ProcessIndex(vp, vLarge, &b1, &s1, 1);
! 	ProcessIndex(vp, vSmall, &b2, &s2, 1);
      }
  
    clean:
--- 1079,1091 ----
      }
  
      if (!delo) {
! 	delo = ProcessIndex(vp, vLarge, &b1, &s1, 1);
! 	if (!delo)
! 	    ProcessIndex(vp, vSmall, &b2, &s2, 1);
! 	if (delo) {
! 	    error = VOLSERREAD_DUMPERROR;
! 	    goto clean;
! 	}
      }
  
    clean:
***************
*** 1104,1110 ****
  	if (!ReadInt32(iodp, (afs_uint32 *) & vnodeNumber))
  	    break;
  
! 	ReadInt32(iodp, &vnode->uniquifier);
  	while ((tag = iod_getc(iodp)) > D_MAX && tag != EOF) {
  	    haveStuff = 1;
  	    switch (tag) {
--- 1132,1139 ----
  	if (!ReadInt32(iodp, (afs_uint32 *) & vnodeNumber))
  	    break;
  
! 	if (!ReadInt32(iodp, &vnode->uniquifier))
! 	    return VOLSERREAD_DUMPERROR;
  	while ((tag = iod_getc(iodp)) > D_MAX && tag != EOF) {
  	    haveStuff = 1;
  	    switch (tag) {
***************
*** 1114,1149 ****
  	    case 'l':
  		{
  		    unsigned short tlc;
! 		    ReadShort(iodp, &tlc);
  		    vnode->linkCount = (signed int)tlc;
  		}
  		break;
  	    case 'v':
! 		ReadInt32(iodp, &vnode->dataVersion);
  		break;
  	    case 'm':
! 		ReadInt32(iodp, &vnode->unixModifyTime);
  		break;
  	    case 's':
! 		ReadInt32(iodp, &vnode->serverModifyTime);
  		break;
  	    case 'a':
! 		ReadInt32(iodp, &vnode->author);
  		break;
  	    case 'o':
! 		ReadInt32(iodp, &vnode->owner);
  		break;
  	    case 'g':
! 		ReadInt32(iodp, (afs_uint32 *) & vnode->group);
  		break;
  	    case 'b':{
  		    unsigned short modeBits;
! 		    ReadShort(iodp, &modeBits);
  		    vnode->modeBits = (unsigned int)modeBits;
  		    break;
  		}
  	    case 'p':
! 		ReadInt32(iodp, &vnode->parent);
  		break;
  	    case 'A':
  		ReadByteString(iodp, (byte *) VVnodeDiskACL(vnode),
--- 1143,1187 ----
  	    case 'l':
  		{
  		    unsigned short tlc;
! 		    if (!ReadShort(iodp, &tlc))
! 			return VOLSERREAD_DUMPERROR;
  		    vnode->linkCount = (signed int)tlc;
  		}
  		break;
  	    case 'v':
! 		if (!ReadInt32(iodp, &vnode->dataVersion))
! 		    return VOLSERREAD_DUMPERROR;
  		break;
  	    case 'm':
! 		if (!ReadInt32(iodp, &vnode->unixModifyTime))
! 		    return VOLSERREAD_DUMPERROR;
  		break;
  	    case 's':
! 		if (!ReadInt32(iodp, &vnode->serverModifyTime))
! 		    return VOLSERREAD_DUMPERROR;
  		break;
  	    case 'a':
! 		if (!ReadInt32(iodp, &vnode->author))
! 		    return VOLSERREAD_DUMPERROR;
  		break;
  	    case 'o':
! 		if (!ReadInt32(iodp, &vnode->owner))
! 		    return VOLSERREAD_DUMPERROR;
  		break;
  	    case 'g':
! 		if (!ReadInt32(iodp, (afs_uint32 *) & vnode->group))
! 		    return VOLSERREAD_DUMPERROR;
  		break;
  	    case 'b':{
  		    unsigned short modeBits;
! 		    if (!ReadShort(iodp, &modeBits))
! 			return VOLSERREAD_DUMPERROR;
  		    vnode->modeBits = (unsigned int)modeBits;
  		    break;
  		}
  	    case 'p':
! 		if (!ReadInt32(iodp, &vnode->parent))
! 		    return VOLSERREAD_DUMPERROR;
  		break;
  	    case 'A':
  		ReadByteString(iodp, (byte *) VVnodeDiskACL(vnode),
***************
*** 1243,1249 ****
      }
      iod_ungetc(iodp, tag);
  
- 
      return 0;
  }
  
--- 1281,1286 ----
Index: openafs/src/volser/vos.c
diff -c openafs/src/volser/vos.c:1.40.2.13 openafs/src/volser/vos.c:1.40.2.14
*** openafs/src/volser/vos.c:1.40.2.13	Thu Dec 15 23:26:40 2005
--- openafs/src/volser/vos.c	Mon Apr 17 11:00:46 2006
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40.2.13 2005/12/16 04:26:40 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40.2.14 2006/04/17 15:00:46 jaltman Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 5574,5580 ****
  	code = ktime_DateToInt32(as->parms[4].items->data, &fromdate);
  	if (code) {
  	    fprintf(STDERR, "vos: failed to parse date '%s' (error=%d))\n",
! 		    as->parms[1].items->data, code);
  	    return code;
  	}
      }
--- 5574,5580 ----
  	code = ktime_DateToInt32(as->parms[4].items->data, &fromdate);
  	if (code) {
  	    fprintf(STDERR, "vos: failed to parse date '%s' (error=%d))\n",
! 		    as->parms[4].items->data, code);
  	    return code;
  	}
      }
