<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.14.2.7 openafs/src/afs/afs_call.c:1.14.2.9
*** openafs/src/afs/afs_call.c:1.14.2.7	Mon Apr 22 23:32:31 2002
--- openafs/src/afs/afs_call.c	Sat Jun  8 16:29:49 2002
***************
*** 10,16 ****
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_call.c,v 1.14.2.7 2002/04/23 03:32:31 zacheiss Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_call.c,v 1.14.2.9 2002/06/08 20:29:49 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 544,553 ****
  #endif
  	afs_cold_shutdown = 0;
  	if (parm == 1) afs_cold_shutdown = 1;
! 	if (afs_globalVFS != 0) {
! 	    afs_warn("AFS isn't unmounted yet! Call aborted\n");
! 	    code = EACCES;
! 	}
  	afs_shutdown();
      }
  
--- 544,552 ----
  #endif
  	afs_cold_shutdown = 0;
  	if (parm == 1) afs_cold_shutdown = 1;
! 	if (afs_globalVFS != 0) 
! 	    afs_warn("AFS isn't unmounted yet!\n");
! 
  	afs_shutdown();
      }
  
Index: openafs/src/afs/afs_callback.c
diff -c openafs/src/afs/afs_callback.c:1.6.2.5 openafs/src/afs/afs_callback.c:1.6.2.8
*** openafs/src/afs/afs_callback.c:1.6.2.5	Sun Apr 21 16:23:56 2002
--- openafs/src/afs/afs_callback.c	Sat Jun  8 07:00:28 2002
***************
*** 16,22 ****
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_callback.c,v 1.6.2.5 2002/04/21 20:23:56 zacheiss Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
--- 16,22 ----
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_callback.c,v 1.6.2.8 2002/06/08 11:00:28 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
***************
*** 1125,1131 ****
      struct rx_call *a_call,
      afs_int32 a_index,
      char **a_name,
!     afs_int32 *a_hosts)
  {
      afs_int32 i, j;
      struct cell *tcell;
--- 1125,1131 ----
      struct rx_call *a_call,
      afs_int32 a_index,
      char **a_name,
!     serverList *a_hosts)
  {
      afs_int32 i, j;
      struct cell *tcell;
***************
*** 1137,1163 ****
  #endif /* RX_ENABLE_LOCKS */
      AFS_STATCNT(SRXAFSCB_GetCellServDB);
  
-     memset(a_hosts, 0, AFSMAXCELLHOSTS * sizeof(afs_int32));
- 
-     /* search the list for the cell with this index */
-     ObtainReadLock(&amp;afs_xcell);
- 
      tcell = afs_GetCellByIndex(a_index, READ_LOCK, 0);
  
      if (!tcell) {
        i = 0;
      } else {
        p_name = tcell-&gt;cellName;
!       for (j = 0 ; j &lt; AFSMAXCELLHOSTS &amp;&amp; tcell-&gt;cellHosts[j] ; j++) {
! 	a_hosts[j] = ntohl(tcell-&gt;cellHosts[j]-&gt;addr-&gt;sa_ip);
!       }
        i = strlen(p_name);
        afs_PutCell(tcell, READ_LOCK);
      }
  
!     t_name = (char *)rxi_Alloc(i+1);
      if (t_name == NULL) {
!         ReleaseReadLock(&amp;afs_xcell);
  #ifdef RX_ENABLE_LOCKS
  	AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
--- 1137,1163 ----
  #endif /* RX_ENABLE_LOCKS */
      AFS_STATCNT(SRXAFSCB_GetCellServDB);
  
      tcell = afs_GetCellByIndex(a_index, READ_LOCK, 0);
  
      if (!tcell) {
        i = 0;
+       a_hosts-&gt;serverList_val = 0;
+       a_hosts-&gt;serverList_len = 0;
      } else {
        p_name = tcell-&gt;cellName;
!       for (j = 0 ; j &lt; AFSMAXCELLHOSTS &amp;&amp; tcell-&gt;cellHosts[j] ; j++)
! 	;
        i = strlen(p_name);
+       a_hosts-&gt;serverList_val = (afs_int32 *)afs_osi_Alloc(j*sizeof(afs_int32));
+       a_hosts-&gt;serverList_len = j;
+       for (j = 0 ; j &lt; AFSMAXCELLHOSTS &amp;&amp; tcell-&gt;cellHosts[j] ; j++)
+ 	a_hosts-&gt;serverList_val[j] = ntohl(tcell-&gt;cellHosts[j]-&gt;addr-&gt;sa_ip);
        afs_PutCell(tcell, READ_LOCK);
      }
  
!     t_name = (char *)afs_osi_Alloc(i+1);
      if (t_name == NULL) {
!       afs_osi_Free(a_hosts-&gt;serverList_val, (j*sizeof(afs_int32)));
  #ifdef RX_ENABLE_LOCKS
  	AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
***************
*** 1168,1175 ****
      if (p_name)
  	memcpy(t_name, p_name, i);
  
-     ReleaseReadLock(&amp;afs_xcell);
- 
  #ifdef RX_ENABLE_LOCKS
      AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
--- 1168,1173 ----
***************
*** 1234,1240 ****
  	plen = strlen(p_name);
      else
  	plen = 0;
!     t_name = (char *)rxi_Alloc(plen+1);
      if (t_name == NULL) {
          ReleaseReadLock(&amp;afs_xcell);
  #ifdef RX_ENABLE_LOCKS
--- 1232,1238 ----
  	plen = strlen(p_name);
      else
  	plen = 0;
!     t_name = (char *)afs_osi_Alloc(plen+1);
      if (t_name == NULL) {
          ReleaseReadLock(&amp;afs_xcell);
  #ifdef RX_ENABLE_LOCKS
***************
*** 1340,1346 ****
       * Currently only support version 1
       */
      allocsize = sizeof(cm_initparams_v1);
!     t_config = (afs_uint32 *)rxi_Alloc(allocsize);
      if (t_config == NULL) {
  #ifdef RX_ENABLE_LOCKS
  	AFS_GUNLOCK();
--- 1338,1344 ----
       * Currently only support version 1
       */
      allocsize = sizeof(cm_initparams_v1);
!     t_config = (afs_uint32 *)afs_osi_Alloc(allocsize);
      if (t_config == NULL) {
  #ifdef RX_ENABLE_LOCKS
  	AFS_GUNLOCK();
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.22.2.4 openafs/src/afs/afs_pioctl.c:1.22.2.5
*** openafs/src/afs/afs_pioctl.c:1.22.2.4	Tue Apr 23 21:41:16 2002
--- openafs/src/afs/afs_pioctl.c	Fri Jun  7 20:18:35 2002
***************
*** 10,16 ****
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_pioctl.c,v 1.22.2.4 2002/04/24 01:41:16 zacheiss Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_pioctl.c,v 1.22.2.5 2002/06/08 00:18:35 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 1414,1420 ****
        memcpy((char *)&amp;flag, ain, sizeof(afs_int32));		/* primary id flag */
        ain += sizeof(afs_int32);			/* skip id field */
        /* rest is cell name, look it up */
!       if (flag &amp; 0x8000) {			/* XXX Use Constant XXX */
  	  flag &amp;= ~0x8000;
  	  set_parent_pag = 1;
        }
--- 1414,1421 ----
        memcpy((char *)&amp;flag, ain, sizeof(afs_int32));		/* primary id flag */
        ain += sizeof(afs_int32);			/* skip id field */
        /* rest is cell name, look it up */
!       /* some versions of gcc appear to need != 0 in order to get this right */
!       if (flag &amp; 0x8000 != 0) {			/* XXX Use Constant XXX */
  	  flag &amp;= ~0x8000;
  	  set_parent_pag = 1;
        }
Index: openafs/src/afs/afs_segments.c
diff -c openafs/src/afs/afs_segments.c:1.5.2.1 openafs/src/afs/afs_segments.c:1.5.2.2
*** openafs/src/afs/afs_segments.c:1.5.2.1	Wed Dec 26 15:29:19 2001
--- openafs/src/afs/afs_segments.c	Fri Jun  7 20:31:42 2002
***************
*** 13,19 ****
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_segments.c,v 1.5.2.1 2001/12/26 20:29:19 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
--- 13,19 ----
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_segments.c,v 1.5.2.2 2002/06/08 00:31:42 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
***************
*** 284,289 ****
--- 284,291 ----
        if (j) {
  	static afs_uint32 lp1 = 10000, lp2 = 10000;
  	struct AFSStoreStatus InStatus;
+ 	struct AFSFetchStatus OutStatus;
+ 	int doProcessFS = 0;
  	afs_uint32 base, bytes, nchunks;
  	int nomore;
  	unsigned int first;
***************
*** 475,481 ****
                       * one which has the writing bit turned on. */
  		}
  		if (!code) {
- 		    struct AFSFetchStatus OutStatus;
  		    struct AFSVolSync tsync;
  #ifdef RX_ENABLE_LOCKS
  		    AFS_GUNLOCK();
--- 477,482 ----
***************
*** 486,504 ****
  #endif /* RX_ENABLE_LOCKS */
  		    hadd32(newDV, 1);
  		    XSTATS_END_TIME;
!       
! 		    /* Now copy out return params */
! 		    UpgradeSToWLock(&amp;avc-&gt;lock,28);    /* keep out others for a while */
! 		    if (!code) {  /* must wait til RPC completes to be sure of this info */
! 			afs_ProcessFS(avc, &amp;OutStatus, areq);
! 			/* Keep last (max) size of file on server to see if
! 			 * we need to call afs_StoreMini to extend the file.
! 			 */
! 			if (!moredata)
! 			    maxStoredLength = OutStatus.Length;
! 
! 		    }
! 		    ConvertWToSLock(&amp;avc-&gt;lock);
  		}
  		if (tcall) {
  #ifdef RX_ENABLE_LOCKS
--- 487,493 ----
  #endif /* RX_ENABLE_LOCKS */
  		    hadd32(newDV, 1);
  		    XSTATS_END_TIME;
! 		    if (!code) doProcessFS = 1; /* Flag to run afs_ProcessFS() later on */		    
  		}
  		if (tcall) {
  #ifdef RX_ENABLE_LOCKS
***************
*** 536,541 ****
--- 525,543 ----
  		tdc-&gt;f.states &amp;= ~DWriting;  /* correct?*/
  		tdc-&gt;flags |= DFEntryMod;
  		lockedPutDCache(tdc);
+ 	    }
+ 
+ 	    if (doProcessFS) {
+ 		/* Now copy out return params */
+ 		UpgradeSToWLock(&amp;avc-&gt;lock,28);    /* keep out others for a while */
+ 		afs_ProcessFS(avc, &amp;OutStatus, areq);
+ 		/* Keep last (max) size of file on server to see if
+ 		 * we need to call afs_StoreMini to extend the file.
+ 		 */
+ 		if (!moredata)
+ 		    maxStoredLength = OutStatus.Length;
+ 		ConvertWToSLock(&amp;avc-&gt;lock);
+ 		doProcessFS = 0;
  	    }
  
  	    if (code) {
Index: openafs/src/afs/sysincludes.h
diff -c openafs/src/afs/sysincludes.h:1.6.4.1 openafs/src/afs/sysincludes.h:1.6.4.2
*** openafs/src/afs/sysincludes.h:1.6.4.1	Wed Sep 19 18:25:22 2001
--- openafs/src/afs/sysincludes.h	Sat Jun  8 00:47:34 2002
***************
*** 268,274 ****
  #endif /* AFS_SUN5_ENV */
  
  #include "../rpc/types.h"
! #include "../rpc/xdr.h"
  
  #ifdef AFS_AIX32_ENV
  #  include "net/spl.h"
--- 268,274 ----
  #endif /* AFS_SUN5_ENV */
  
  #include "../rpc/types.h"
! #include "../rx/xdr.h"
  
  #ifdef AFS_AIX32_ENV
  #  include "net/spl.h"
***************
*** 363,369 ****
  #undef register
  #endif	/* AFS_ALPHA_ENV */
  
! #include &lt;rpc/xdr.h&gt;
  #include &lt;sys/proc.h&gt;
  #include &lt;sys/ioctl.h&gt;
  
--- 363,369 ----
  #undef register
  #endif	/* AFS_ALPHA_ENV */
  
! #include &lt;rx/xdr.h&gt;
  #include &lt;sys/proc.h&gt;
  #include &lt;sys/ioctl.h&gt;
  
Index: openafs/src/afs/VNOPS/afs_vnop_attrs.c
diff -c openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.8.4.1 openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.8.4.2
*** openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.8.4.1	Tue Apr 23 21:41:40 2002
--- openafs/src/afs/VNOPS/afs_vnop_attrs.c	Fri Jun  7 20:19:39 2002
***************
*** 21,27 ****
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.8.4.1 2002/04/24 01:41:40 zacheiss Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 21,27 ----
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.8.4.2 2002/06/08 00:19:39 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 93,99 ****
      attrs-&gt;va_nlink = avc-&gt;m.LinkCount;
      attrs-&gt;va_size = avc-&gt;m.Length;
      attrs-&gt;va_atime.tv_sec = attrs-&gt;va_mtime.tv_sec = attrs-&gt;va_ctime.tv_sec =
! 	avc-&gt;m.Date;
      /* set microseconds to be dataversion # so that we approximate NFS-style
       * use of mtime as a dataversion #.  We take it mod 512K because
       * microseconds *must* be less than a million, and 512K is the biggest
--- 93,99 ----
      attrs-&gt;va_nlink = avc-&gt;m.LinkCount;
      attrs-&gt;va_size = avc-&gt;m.Length;
      attrs-&gt;va_atime.tv_sec = attrs-&gt;va_mtime.tv_sec = attrs-&gt;va_ctime.tv_sec =
! 	(int)avc-&gt;m.Date;
      /* set microseconds to be dataversion # so that we approximate NFS-style
       * use of mtime as a dataversion #.  We take it mod 512K because
       * microseconds *must* be less than a million, and 512K is the biggest
Index: openafs/src/afs/VNOPS/afs_vnop_remove.c
diff -c openafs/src/afs/VNOPS/afs_vnop_remove.c:1.4.4.7 openafs/src/afs/VNOPS/afs_vnop_remove.c:1.4.4.8
*** openafs/src/afs/VNOPS/afs_vnop_remove.c:1.4.4.7	Tue Apr 23 21:41:41 2002
--- openafs/src/afs/VNOPS/afs_vnop_remove.c	Fri Jun  7 20:13:41 2002
***************
*** 22,28 ****
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.4.4.7 2002/04/24 01:41:41 zacheiss Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 22,28 ----
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.4.4.8 2002/06/08 00:13:41 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 356,362 ****
  	char *unlname = newname();
  
  	ReleaseWriteLock(&amp;adp-&gt;lock);
! 	code = afsrename(adp, aname, adp, unlname, acred);
  	Tnam1 = unlname;
  	if (!code) {
  	    tvc-&gt;mvid = (struct VenusFid *)unlname;
--- 356,362 ----
  	char *unlname = newname();
  
  	ReleaseWriteLock(&amp;adp-&gt;lock);
! 	code = afsrename(adp, aname, adp, unlname, acred, &amp;treq);
  	Tnam1 = unlname;
  	if (!code) {
  	    tvc-&gt;mvid = (struct VenusFid *)unlname;
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.13.2.5 openafs/src/afsd/afsd.c:1.13.2.6
*** openafs/src/afsd/afsd.c:1.13.2.5	Sun Jan 20 03:20:58 2002
--- openafs/src/afsd/afsd.c	Fri Jun  7 21:34:03 2002
***************
*** 55,61 ****
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/afsd/afsd.c,v 1.13.2.5 2002/01/20 08:20:58 shadow Exp $");
  
  #define VFS 1
  
--- 55,61 ----
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/afsd/afsd.c,v 1.13.2.6 2002/06/08 01:34:03 zacheiss Exp $");
  
  #define VFS 1
  
***************
*** 1290,1296 ****
  	 * Cold shutdown is the default
  	 */
  	printf("afsd: Shutting down all afs processes and afs state\n");
! 	call_syscall(AFSOP_SHUTDOWN, 1);
  	exit(0);
      }
      if (as-&gt;parms[21].items) {
--- 1290,1300 ----
  	 * Cold shutdown is the default
  	 */
  	printf("afsd: Shutting down all afs processes and afs state\n");
! 	code = call_syscall(AFSOP_SHUTDOWN, 1);
! 	if (code) {
! 	    printf("afsd: AFS still mounted; Not shutting down\n");
! 	    exit(1);
! 	}
  	exit(0);
      }
      if (as-&gt;parms[21].items) {
Index: openafs/src/des/crypt.c
diff -c openafs/src/des/crypt.c:1.7 openafs/src/des/crypt.c:1.7.2.1
*** openafs/src/des/crypt.c:1.7	Mon Aug  6 20:05:00 2001
--- openafs/src/des/crypt.c	Fri Jun  7 20:23:48 2002
***************
*** 37,43 ****
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/des/crypt.c,v 1.7 2001/08/07 00:05:00 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include &lt;windows.h&gt;
--- 37,43 ----
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/des/crypt.c,v 1.7.2.1 2002/06/08 00:23:48 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include &lt;windows.h&gt;
***************
*** 88,94 ****
   * define "LONG_IS_32_BITS" only if sizeof(long)==4.
   * This avoids use of bit fields (your compiler may be sloppy with them).
   */
! #if !defined(cray)
  #define	LONG_IS_32_BITS
  #endif
  
--- 88,94 ----
   * define "LONG_IS_32_BITS" only if sizeof(long)==4.
   * This avoids use of bit fields (your compiler may be sloppy with them).
   */
! #if !defined(cray) &amp;&amp; !defined(AFS_ALPHA_LINUX20_ENV) &amp;&amp; !defined(AFS_IA64_LINUX20_ENV)
  #define	LONG_IS_32_BITS
  #endif
  
***************
*** 249,261 ****
  	struct {
  #if defined(LONG_IS_32_BITS)
  		/* long is often faster than a 32-bit bit field */
- #if defined(AFS_IA64_LINUX20_ENV)
- 		int	i0;
- 		int	i1;
- #else
  		long	i0;
  		long	i1;
- #endif
  #else
  		long	i0: 32;
  		long	i1: 32;
--- 249,256 ----
Index: openafs/src/dir/buffer.c
diff -c openafs/src/dir/buffer.c:1.5.2.3 openafs/src/dir/buffer.c:1.5.2.4
*** openafs/src/dir/buffer.c:1.5.2.3	Wed May  8 14:59:53 2002
--- openafs/src/dir/buffer.c	Fri Jun  7 20:16:59 2002
***************
*** 10,16 ****
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/dir/buffer.c,v 1.5.2.3 2002/05/08 18:59:53 shadow Exp $");
  
  #include &lt;stdlib.h&gt;
  #include &lt;lock.h&gt;
--- 10,16 ----
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/dir/buffer.c,v 1.5.2.4 2002/06/08 00:16:59 shadow Exp $");
  
  #include &lt;stdlib.h&gt;
  #include &lt;lock.h&gt;
***************
*** 132,139 ****
      if ( tb = phTable[pHash(fid)] ) {  /* ASSMT HERE */
  	if (bufmatch(tb)) {
  	    ObtainWriteLock(&amp;tb-&gt;lock);
- 	    ReleaseWriteLock(&amp;afs_bufferLock);
  	    tb-&gt;lockers++;
  	    tb-&gt;accesstime = ++timecounter;
  	    ReleaseWriteLock(&amp;tb-&gt;lock);
  	    return tb-&gt;data;
--- 132,139 ----
      if ( tb = phTable[pHash(fid)] ) {  /* ASSMT HERE */
  	if (bufmatch(tb)) {
  	    ObtainWriteLock(&amp;tb-&gt;lock);
  	    tb-&gt;lockers++;
+ 	    ReleaseWriteLock(&amp;afs_bufferLock);
  	    tb-&gt;accesstime = ++timecounter;
  	    ReleaseWriteLock(&amp;tb-&gt;lock);
  	    return tb-&gt;data;
***************
*** 144,151 ****
  	    if (bufmatch(tb2)) {
  	      buf_Front(bufhead,tb,tb2);
  	      ObtainWriteLock(&amp;tb2-&gt;lock);
- 	      ReleaseWriteLock(&amp;afs_bufferLock);
  	      tb2-&gt;lockers++;
  	      tb2-&gt;accesstime = ++timecounter;
  	      ReleaseWriteLock(&amp;tb2-&gt;lock);
  	      return tb2-&gt;data;
--- 144,151 ----
  	    if (bufmatch(tb2)) {
  	      buf_Front(bufhead,tb,tb2);
  	      ObtainWriteLock(&amp;tb2-&gt;lock);
  	      tb2-&gt;lockers++;
+ 	      ReleaseWriteLock(&amp;afs_bufferLock);
  	      tb2-&gt;accesstime = ++timecounter;
  	      ReleaseWriteLock(&amp;tb2-&gt;lock);
  	      return tb2-&gt;data;
***************
*** 154,161 ****
  	      if (bufmatch(tb)) {
  		buf_Front(bufhead,tb2,tb);
  		ObtainWriteLock(&amp;tb-&gt;lock);
- 		ReleaseWriteLock(&amp;afs_bufferLock);
  		tb-&gt;lockers++;
  		tb-&gt;accesstime = ++timecounter;
  		ReleaseWriteLock(&amp;tb-&gt;lock);
  		return tb-&gt;data;
--- 154,161 ----
  	      if (bufmatch(tb)) {
  		buf_Front(bufhead,tb2,tb);
  		ObtainWriteLock(&amp;tb-&gt;lock);
  		tb-&gt;lockers++;
+ 		ReleaseWriteLock(&amp;afs_bufferLock);
  		tb-&gt;accesstime = ++timecounter;
  		ReleaseWriteLock(&amp;tb-&gt;lock);
  		return tb-&gt;data;
***************
*** 175,182 ****
      tb = newslot(fid, page, (tb ? tb : tb2));
      ios++;
      ObtainWriteLock(&amp;tb-&gt;lock);
-     ReleaseWriteLock(&amp;afs_bufferLock);
      tb-&gt;lockers++;
      if (ReallyRead(tb-&gt;fid,tb-&gt;page,tb-&gt;data)) {
  	tb-&gt;lockers--;
          FidZap(tb-&gt;fid);	/* disaster */
--- 175,182 ----
      tb = newslot(fid, page, (tb ? tb : tb2));
      ios++;
      ObtainWriteLock(&amp;tb-&gt;lock);
      tb-&gt;lockers++;
+     ReleaseWriteLock(&amp;afs_bufferLock);
      if (ReallyRead(tb-&gt;fid,tb-&gt;page,tb-&gt;data)) {
  	tb-&gt;lockers--;
          FidZap(tb-&gt;fid);	/* disaster */
***************
*** 396,403 ****
      ObtainWriteLock(&amp;afs_bufferLock);
      tb = newslot(fid,page,0);
      ObtainWriteLock(&amp;tb-&gt;lock);
-     ReleaseWriteLock(&amp;afs_bufferLock);
      tb-&gt;lockers++;
      ReleaseWriteLock(&amp;tb-&gt;lock);
      return tb-&gt;data;
  }
--- 396,403 ----
      ObtainWriteLock(&amp;afs_bufferLock);
      tb = newslot(fid,page,0);
      ObtainWriteLock(&amp;tb-&gt;lock);
      tb-&gt;lockers++;
+     ReleaseWriteLock(&amp;afs_bufferLock);
      ReleaseWriteLock(&amp;tb-&gt;lock);
      return tb-&gt;data;
  }
Index: openafs/src/fsint/afsaux.c
diff -c openafs/src/fsint/afsaux.c:1.5 openafs/src/fsint/afsaux.c:1.5.4.1
*** openafs/src/fsint/afsaux.c:1.5	Thu Jul 12 15:58:36 2001
--- openafs/src/fsint/afsaux.c	Sat Jun  8 00:47:42 2002
***************
*** 14,20 ****
  #include &lt;afs/param.h&gt;
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/fsint/afsaux.c,v 1.5 2001/07/12 19:58:36 shadow Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
--- 14,20 ----
  #include &lt;afs/param.h&gt;
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/fsint/afsaux.c,v 1.5.4.1 2002/06/08 04:47:42 shadow Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
***************
*** 28,34 ****
  #else
  #include "../h/types.h"
  #include "../rpc/types.h"
! #include "../rpc/xdr.h"
  #endif
  #if !defined(AFS_ALPHA_ENV)
  #ifndef	XDR_GETINT32
--- 28,34 ----
  #else
  #include "../h/types.h"
  #include "../rpc/types.h"
! #include "../rx/xdr.h"
  #endif
  #if !defined(AFS_ALPHA_ENV)
  #ifndef	XDR_GETINT32
***************
*** 37,45 ****
  #ifndef	XDR_PUTINT32
  #define	XDR_PUTINT32	XDR_PUTLONG
  #endif
- #endif
- #ifndef AFS_LINUX22_ENV
- #include "../rpc/auth.h"
  #endif
  #endif /* defined(UKERNEL) */
  #include "../afsint/afsint.h"
--- 37,42 ----
Index: openafs/src/fsint/afsint.xg
diff -c openafs/src/fsint/afsint.xg:1.3.6.2 openafs/src/fsint/afsint.xg:1.3.6.3
*** openafs/src/fsint/afsint.xg:1.3.6.2	Wed Dec 26 15:58:07 2001
--- openafs/src/fsint/afsint.xg	Sat Jun  8 03:45:49 2002
***************
*** 45,51 ****
  %#define SymbolicLink 3 
  
  %#ifdef	KERNEL
! %#define	xdr_array(a,b,c,d,e,f)	xdr_arrayN(a,b,c,d,e,f)
  %#endif
  
  struct BD {
--- 45,51 ----
  %#define SymbolicLink 3 
  
  %#ifdef	KERNEL
! %#define	afs_xdr_array(a,b,c,d,e,f)	afs_xdr_arrayN(a,b,c,d,e,f)
  %#endif
  
  struct BD {
Index: openafs/src/fsint/common.xg
diff -c openafs/src/fsint/common.xg:1.2 openafs/src/fsint/common.xg:1.2.8.1
*** openafs/src/fsint/common.xg:1.2	Sat Nov  4 05:04:30 2000
--- openafs/src/fsint/common.xg	Sat Jun  8 06:23:08 2002
***************
*** 136,142 ****
  };
  
  const AFSMAXCELLHOSTS = 8;	/*Max VLDB servers per cell*/
! typedef afs_int32 serverList[AFSMAXCELLHOSTS];
  
  typedef afs_uint32 cacheConfig&lt;&gt;;
  
--- 136,142 ----
  };
  
  const AFSMAXCELLHOSTS = 8;	/*Max VLDB servers per cell*/
! typedef afs_int32 serverList&lt;AFSMAXCELLHOSTS&gt;;
  
  typedef afs_uint32 cacheConfig&lt;&gt;;
  
Index: openafs/src/libafs/Makefile.common
diff -c openafs/src/libafs/Makefile.common:1.14.2.1 openafs/src/libafs/Makefile.common:1.14.2.2
*** openafs/src/libafs/Makefile.common:1.14.2.1	Sat Oct 13 00:21:38 2001
--- openafs/src/libafs/Makefile.common	Sat Jun  8 00:47:42 2002
***************
*** 91,97 ****
--- 91,99 ----
  	afs_volume.o \
  	afsaux.o		\
  	Kvice.xdr.o	\
+ 	xdr_array.o	\
  	xdr_arrayn.o	\
+ 	xdr_int64.o	\
  	Kvice.cs.o	\
  	fcrypt.o		\
  	rx.o		\
***************
*** 118,123 ****
--- 120,126 ----
  	rxkad_client.o	\
  	rxkad_common.o	\
  	xdr_afsuuid.o	\
+ 	xdr.o		\
  	afs_uuid.o $(AFS_OS_OBJS)
  
  # These next two allow nfs and nonfs builds to occur in the same directory.
***************
*** 306,311 ****
--- 309,320 ----
  afsaux.o: $(AFSINT)/afsaux.c
  	$(CRULE1);
  xdr_arrayn.o: $(RX)/xdr_arrayn.c
+ 	$(CRULE1);
+ xdr_array.o: $(RX)/xdr_array.c
+ 	$(CRULE1);
+ xdr_int64.o: $(RX)/xdr_int64.c
+ 	$(CRULE1);
+ xdr.o: $(RX)/xdr.c
  	$(CRULE1);
  Kvldbint.cs.o: $(AFSINT)/Kvldbint.cs.c
  	$(CRULE1);
Index: openafs/src/libafs/MakefileProto.AIX.in
diff -c openafs/src/libafs/MakefileProto.AIX.in:1.10 openafs/src/libafs/MakefileProto.AIX.in:1.10.2.1
*** openafs/src/libafs/MakefileProto.AIX.in:1.10	Tue Sep 11 02:25:54 2001
--- openafs/src/libafs/MakefileProto.AIX.in	Sat Jun  8 00:47:42 2002
***************
*** 37,46 ****
  	osi_misc.o \
  	osi_sleep.o \
  	osi_timeout.o \
! 	osi_vm.o \
! 	xdr.o \
! 	xdr_array.o \
! 	xdr_int64.o
  
  AFSNOIAUTHOBJS = \
  	afs_call.o \
--- 37,43 ----
  	osi_misc.o \
  	osi_sleep.o \
  	osi_timeout.o \
! 	osi_vm.o
  
  AFSNOIAUTHOBJS = \
  	afs_call.o \
***************
*** 157,170 ****
  
  # Object build rules:
  # Common objects
- xdr.o: $(RX)/xdr.c
- 	$(CRULE1)
- xdr_int64.o: $(RX)/xdr_int64.c
- 	$(CRULE1)
- 
- xdr_array.o: $(RX)/xdr_array.c
- 	$(CRULE1)
- 
  osi_assem.o:	${AFS}/osi_assem.s
  	${AS} -o osi_assem.o ${AFS}/osi_assem.s
  osi_config.o: $(AFS)/osi_config.c
--- 154,159 ----
Index: openafs/src/libafs/MakefileProto.DARWIN.in
diff -c openafs/src/libafs/MakefileProto.DARWIN.in:1.8.2.3 openafs/src/libafs/MakefileProto.DARWIN.in:1.8.2.4
*** openafs/src/libafs/MakefileProto.DARWIN.in:1.8.2.3	Sat Oct 13 00:21:38 2001
--- openafs/src/libafs/MakefileProto.DARWIN.in	Sat Jun  8 00:47:42 2002
***************
*** 1,5 ****
  #/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */
! # $Header: /data/cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.8.2.3 2001/10/13 04:21:38 shadow Exp $
  # 
  # MakefileProto for Digital Unix systems
  #
--- 1,5 ----
  #/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */
! # $Header: /data/cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.8.2.4 2002/06/08 04:47:42 shadow Exp $
  # 
  # MakefileProto for Digital Unix systems
  #
***************
*** 34,43 ****
  	osi_sleep.o \
  	osi_vm.o \
  	osi_vnodeops.o \
! 	osi_module.o \
! 	xdr.o \
! 	xdr_array.o \
! 	xdr_int64.o
  
  
  #AFS_OS_NFSOBJS = osi_vfsops_nfs.o
--- 34,40 ----
  	osi_sleep.o \
  	osi_vm.o \
  	osi_vnodeops.o \
! 	osi_module.o
  
  
  #AFS_OS_NFSOBJS = osi_vfsops_nfs.o
***************
*** 135,144 ****
  osi_vnodeops.o: $(AFS)/osi_vnodeops.c
  	$(CRULE1)
  osi_module.o: $(AFS)/osi_module.c
- 	$(CRULE1)
- xdr.o: $(RX)/xdr.c
- 	$(CRULE1)
- xdr_array.o: $(RX)/xdr_array.c
- 	$(CRULE1)
- xdr_int64.o: $(RX)/xdr_int64.c
  	$(CRULE1)
--- 132,135 ----
Index: openafs/src/libafs/MakefileProto.FBSD.in
diff -c openafs/src/libafs/MakefileProto.FBSD.in:1.7.2.1 openafs/src/libafs/MakefileProto.FBSD.in:1.7.2.2
*** openafs/src/libafs/MakefileProto.FBSD.in:1.7.2.1	Sat Oct 13 00:21:38 2001
--- openafs/src/libafs/MakefileProto.FBSD.in	Sat Jun  8 00:47:42 2002
***************
*** 30,37 ****
  	osi_misc.o \
  	osi_sleep.o \
  	osi_vm.o \
! 	osi_vnodeops.o \
! 	xdr_int64.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
--- 30,36 ----
  	osi_misc.o \
  	osi_sleep.o \
  	osi_vm.o \
! 	osi_vnodeops.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
***************
*** 147,152 ****
  osi_vm.o: $(AFS)/osi_vm.c
  	$(CRULE1)
  osi_vnodeops.o: $(AFS)/osi_vnodeops.c
- 	$(CRULE1)
- xdr_int64.o: $(RX)/xdr_int64.c
  	$(CRULE1)
--- 146,149 ----
Index: openafs/src/libafs/MakefileProto.HPUX.in
diff -c openafs/src/libafs/MakefileProto.HPUX.in:1.7 openafs/src/libafs/MakefileProto.HPUX.in:1.7.2.1
*** openafs/src/libafs/MakefileProto.HPUX.in:1.7	Fri Sep  7 19:35:19 2001
--- openafs/src/libafs/MakefileProto.HPUX.in	Sat Jun  8 00:47:42 2002
***************
*** 36,43 ****
  	osi_misc.o \
  	osi_sleep.o \
  	osi_vnodeops.o \
! 	osi_vm.o \
! 	xdr_int64.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
--- 36,42 ----
  	osi_misc.o \
  	osi_sleep.o \
  	osi_vnodeops.o \
! 	osi_vm.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
***************
*** 195,202 ****
  osi_vm.o: $(AFS)/osi_vm.c
  	$(CRULE1)
  osi_vnodeops.o: $(AFS)/osi_vnodeops.c
- 	$(CRULE1)
- xdr_int64.o: $(RX)/xdr_int64.c
  	$(CRULE1)
  
  # This is a list of header files compiled with the -g option. It allows
--- 194,199 ----
Index: openafs/src/libafs/MakefileProto.IRIX.in
diff -c openafs/src/libafs/MakefileProto.IRIX.in:1.11.2.4 openafs/src/libafs/MakefileProto.IRIX.in:1.11.2.5
*** openafs/src/libafs/MakefileProto.IRIX.in:1.11.2.4	Wed Dec 26 15:19:14 2001
--- openafs/src/libafs/MakefileProto.IRIX.in	Sat Jun  8 00:47:42 2002
***************
*** 37,44 ****
  	osi_misc.o \
  	osi_sleep.o \
  	osi_vm.o \
! 	osi_vnodeops.o \
! 	xdr_int64.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
--- 37,43 ----
  	osi_misc.o \
  	osi_sleep.o \
  	osi_vm.o \
! 	osi_vnodeops.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
***************
*** 505,510 ****
  osi_vm.o: $(AFS)/osi_vm.c
  	$(CRULE1)
  osi_vnodeops.o: $(AFS)/osi_vnodeops.c
- 	$(CRULE1)
- xdr_int64.o: $(RX)/xdr_int64.c
  	$(CRULE1)
--- 504,507 ----
Index: openafs/src/libafs/MakefileProto.LINUX.in
diff -c openafs/src/libafs/MakefileProto.LINUX.in:1.11.2.7 openafs/src/libafs/MakefileProto.LINUX.in:1.11.2.8
*** openafs/src/libafs/MakefileProto.LINUX.in:1.11.2.7	Tue May 14 18:53:49 2002
--- openafs/src/libafs/MakefileProto.LINUX.in	Sat Jun  8 00:47:42 2002
***************
*** 42,51 ****
  	osi_sysctl.o \
  	osi_vfsops.o \
  	osi_vm.o \
! 	osi_vnodeops.o \
! 	xdr.o \
! 	xdr_array.o \
! 	xdr_int64.o
  
  AFS_OS_NFSOBJS =
  
--- 42,48 ----
  	osi_sysctl.o \
  	osi_vfsops.o \
  	osi_vm.o \
! 	osi_vnodeops.o
  
  AFS_OS_NFSOBJS =
  
***************
*** 311,320 ****
  osi_vm.o: $(AFS)/osi_vm.c
  	$(CRULE1)
  osi_vnodeops.o: $(AFS)/osi_vnodeops.c
- 	$(CRULE1)
- xdr.o: $(RX)/xdr.c
- 	$(CRULE1)
- xdr_int64.o: $(RX)/xdr_int64.c
- 	$(CRULE1)
- xdr_array.o: $(RX)/xdr_array.c
  	$(CRULE1)
--- 308,311 ----
Index: openafs/src/libafs/MakefileProto.OBSD.in
diff -c openafs/src/libafs/MakefileProto.OBSD.in:1.1.2.1 openafs/src/libafs/MakefileProto.OBSD.in:1.1.2.2
*** openafs/src/libafs/MakefileProto.OBSD.in:1.1.2.1	Wed Sep 19 18:59:44 2001
--- openafs/src/libafs/MakefileProto.OBSD.in	Sat Jun  8 00:47:42 2002
***************
*** 30,37 ****
  	osi_misc.o \
  	osi_sleep.o \
  	osi_vm.o \
! 	osi_vnodeops.o \
! 	xdr_int64.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
--- 30,36 ----
  	osi_misc.o \
  	osi_sleep.o \
  	osi_vm.o \
! 	osi_vnodeops.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
***************
*** 147,152 ****
  osi_vm.o: $(AFS)/osi_vm.c
  	$(CRULE1)
  osi_vnodeops.o: $(AFS)/osi_vnodeops.c
- 	$(CRULE1)
- xdr_int64.o: $(RX)/xdr_int64.c
  	$(CRULE1)
--- 146,149 ----
Index: openafs/src/libafs/MakefileProto.SOLARIS.in
diff -c openafs/src/libafs/MakefileProto.SOLARIS.in:1.10.2.1 openafs/src/libafs/MakefileProto.SOLARIS.in:1.10.2.2
*** openafs/src/libafs/MakefileProto.SOLARIS.in:1.10.2.1	Sat Oct 13 00:21:38 2001
--- openafs/src/libafs/MakefileProto.SOLARIS.in	Sat Jun  8 00:47:42 2002
***************
*** 34,41 ****
  	osi_file.o \
  	osi_sleep.o \
  	osi_vm.o \
! 	osi_vnodeops.o \
! 	xdr_int64.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
--- 34,40 ----
  	osi_file.o \
  	osi_sleep.o \
  	osi_vm.o \
! 	osi_vnodeops.o
  
  AFS_OS_NFSOBJS = \
  	osi_vfsops_nfs.o
***************
*** 197,202 ****
  osi_vm.o: $(AFS)/osi_vm.c
  	$(CRULE1)
  osi_vnodeops.o: $(AFS)/osi_vnodeops.c
- 	$(CRULE1)
- xdr_int64.o: $(RX)/xdr_int64.c
  	$(CRULE1)
--- 196,199 ----
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.9.2.6 openafs/src/rx/rx_kcommon.c:1.9.2.7
*** openafs/src/rx/rx_kcommon.c:1.9.2.6	Mon Apr 29 15:17:00 2002
--- openafs/src/rx/rx_kcommon.c	Sat Jun  8 20:46:47 2002
***************
*** 14,20 ****
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_kcommon.c,v 1.9.2.6 2002/04/29 19:17:00 zacheiss Exp $");
  
  #include "../rx/rx_kcommon.h"
  
--- 14,20 ----
  #include &lt;afsconfig.h&gt;
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_kcommon.c,v 1.9.2.7 2002/06/09 00:46:47 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  
***************
*** 998,1004 ****
--- 998,1019 ----
   */
  int rxk_ListenerPid; /* Used to signal process to wakeup at shutdown */
  
+ #ifdef AFS_SUN5_ENV
+ /*
+  * Run the listener as a kernel process.
+  */
+ void rxk_Listener(void)
+ {
+     extern id_t syscid;
+     void rxk_ListenerProc(void);
+     if (newproc(rxk_ListenerProc, syscid, 59))
+ 	osi_Panic("rxk_Listener: failed to fork listener process!\n");
+ }
+ 
+ void rxk_ListenerProc(void)
+ #else /* AFS_SUN5_ENV */
  void rxk_Listener(void)
+ #endif /* AFS_SUN5_ENV */
  {
      struct rx_packet *rxp = NULL;
      int code;
***************
*** 1013,1021 ****
  #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
      rxk_ListenerPid = current_proc()-&gt;p_pid;
  #endif
! #if defined(RX_ENABLE_LOCKS)
      AFS_GUNLOCK();
! #endif /* RX_ENABLE_LOCKS */
  
      while (afs_termState != AFSOP_STOP_RXK_LISTENER) {
  	if (rxp) {
--- 1028,1036 ----
  #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
      rxk_ListenerPid = current_proc()-&gt;p_pid;
  #endif
! #if defined(RX_ENABLE_LOCKS) &amp;&amp; !defined(AFS_SUN5_ENV)
      AFS_GUNLOCK();
! #endif /* RX_ENABLE_LOCKS &amp;&amp; !AFS_SUN5_ENV */
  
      while (afs_termState != AFSOP_STOP_RXK_LISTENER) {
  	if (rxp) {
***************
*** 1047,1052 ****
--- 1062,1075 ----
  #if defined(AFS_LINUX22_ENV) || defined(AFS_SUN5_ENV)
      afs_osi_Wakeup(&amp;rxk_ListenerPid);
  #endif
+ #ifdef AFS_SUN5_ENV
+     AFS_GUNLOCK();
+ #ifdef HAVE_P_COREFILE
+     if (!curproc-&gt;p_corefile)  /* newproc doesn't set it, but exit frees it */
+ 	curproc-&gt;p_corefile = refstr_alloc("core");
+ #endif
+     exit(CLD_EXITED, 0);
+ #endif /* AFS_SUN5_ENV */
  }
  
  #if !defined(AFS_LINUX20_ENV) &amp;&amp; !defined(AFS_SUN5_ENV) &amp;&amp; !defined(AFS_DARWIN_ENV) &amp;&amp; !defined(AFS_XBSD_ENV)
Index: openafs/src/rx/rx_kcommon.h
diff -c openafs/src/rx/rx_kcommon.h:1.4.4.2 openafs/src/rx/rx_kcommon.h:1.4.4.3
*** openafs/src/rx/rx_kcommon.h:1.4.4.2	Sat Oct 13 00:21:49 2001
--- openafs/src/rx/rx_kcommon.h	Sat Jun  8 00:47:43 2002
***************
*** 90,98 ****
  #include "../afs/afs_osi.h"
  #include "../rx/rx_kmutex.h"
  #include "../afs/lock.h"
! #ifndef AFS_LINUX22_ENV
! #include "../rpc/xdr.h"
! #endif
  #include "../rx/rx.h"
  #include "../rx/rx_globals.h"
  #include "../afs/longc_procs.h"
--- 90,96 ----
  #include "../afs/afs_osi.h"
  #include "../rx/rx_kmutex.h"
  #include "../afs/lock.h"
! #include "../rx/xdr.h"
  #include "../rx/rx.h"
  #include "../rx/rx_globals.h"
  #include "../afs/longc_procs.h"
Index: openafs/src/rx/xdr.c
diff -c openafs/src/rx/xdr.c:1.3 openafs/src/rx/xdr.c:1.3.4.1
*** openafs/src/rx/xdr.c:1.3	Thu Jul 12 15:58:56 2001
--- openafs/src/rx/xdr.c	Sat Jun  8 00:47:43 2002
***************
*** 34,40 ****
  #include &lt;afs/param.h&gt;
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/xdr.c,v 1.3 2001/07/12 19:58:56 shadow Exp $");
  
  /*
   * xdr.c, Generic XDR routines implementation.
--- 34,40 ----
  #include &lt;afs/param.h&gt;
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/xdr.c,v 1.3.4.1 2002/06/08 04:47:43 shadow Exp $");
  
  /*
   * xdr.c, Generic XDR routines implementation.
***************
*** 129,150 ****
  	return (FALSE);
  }
  
! 
  /*
   * XDR afs_int32 integers
   * same as xdr_u_long - open coded to save a proc call!
   */
  bool_t
! xdr_long(xdrs, lp)
  	register XDR *xdrs;
! 	long *lp;
  {
  
  	if (xdrs-&gt;x_op == XDR_ENCODE)
! 		return (XDR_PUTINT32(xdrs, lp));
  
  	if (xdrs-&gt;x_op == XDR_DECODE)
! 		return (XDR_GETINT32(xdrs, lp));
  
  	if (xdrs-&gt;x_op == XDR_FREE)
  		return (TRUE);
--- 129,150 ----
  	return (FALSE);
  }
  
! #else
  /*
   * XDR afs_int32 integers
   * same as xdr_u_long - open coded to save a proc call!
   */
  bool_t
! xdr_int(xdrs, lp)
  	register XDR *xdrs;
! 	int *lp;
  {
  
  	if (xdrs-&gt;x_op == XDR_ENCODE)
! 		return (XDR_PUTINT32(xdrs, (long *)lp));
  
  	if (xdrs-&gt;x_op == XDR_DECODE)
! 		return (XDR_GETINT32(xdrs, (long *)lp));
  
  	if (xdrs-&gt;x_op == XDR_FREE)
  		return (TRUE);
***************
*** 157,194 ****
   * same as xdr_long - open coded to save a proc call!
   */
  bool_t
! xdr_u_long(xdrs, ulp)
  	register XDR *xdrs;
! 	u_long *ulp;
  {
  
  	if (xdrs-&gt;x_op == XDR_DECODE)
  		return (XDR_GETINT32(xdrs, (long *)ulp));
- 
  	if (xdrs-&gt;x_op == XDR_ENCODE)
  		return (XDR_PUTINT32(xdrs, (long *)ulp));
- 
  	if (xdrs-&gt;x_op == XDR_FREE)
  		return (TRUE);
- 
  	return (FALSE);
  }
! #else
  /*
   * XDR afs_int32 integers
   * same as xdr_u_long - open coded to save a proc call!
   */
  bool_t
! xdr_int(xdrs, lp)
  	register XDR *xdrs;
! 	int *lp;
  {
  
  	if (xdrs-&gt;x_op == XDR_ENCODE)
! 		return (XDR_PUTINT32(xdrs, (long *)lp));
  
  	if (xdrs-&gt;x_op == XDR_DECODE)
! 		return (XDR_GETINT32(xdrs, (long *)lp));
  
  	if (xdrs-&gt;x_op == XDR_FREE)
  		return (TRUE);
--- 157,193 ----
   * same as xdr_long - open coded to save a proc call!
   */
  bool_t
! xdr_u_int(xdrs, ulp)
  	register XDR *xdrs;
! 	int *ulp;
  {
  
  	if (xdrs-&gt;x_op == XDR_DECODE)
  		return (XDR_GETINT32(xdrs, (long *)ulp));
  	if (xdrs-&gt;x_op == XDR_ENCODE)
  		return (XDR_PUTINT32(xdrs, (long *)ulp));
  	if (xdrs-&gt;x_op == XDR_FREE)
  		return (TRUE);
  	return (FALSE);
  }
! #endif
! 
! 
  /*
   * XDR afs_int32 integers
   * same as xdr_u_long - open coded to save a proc call!
   */
  bool_t
! xdr_long(xdrs, lp)
  	register XDR *xdrs;
! 	long *lp;
  {
  
  	if (xdrs-&gt;x_op == XDR_ENCODE)
! 		return (XDR_PUTINT32(xdrs, lp));
  
  	if (xdrs-&gt;x_op == XDR_DECODE)
! 		return (XDR_GETINT32(xdrs, lp));
  
  	if (xdrs-&gt;x_op == XDR_FREE)
  		return (TRUE);
***************
*** 201,220 ****
   * same as xdr_long - open coded to save a proc call!
   */
  bool_t
! xdr_u_int(xdrs, ulp)
  	register XDR *xdrs;
! 	int *ulp;
  {
  
  	if (xdrs-&gt;x_op == XDR_DECODE)
  		return (XDR_GETINT32(xdrs, (long *)ulp));
  	if (xdrs-&gt;x_op == XDR_ENCODE)
  		return (XDR_PUTINT32(xdrs, (long *)ulp));
  	if (xdrs-&gt;x_op == XDR_FREE)
  		return (TRUE);
  	return (FALSE);
  }
! #endif
  /*
   * XDR chars
   */
--- 200,222 ----
   * same as xdr_long - open coded to save a proc call!
   */
  bool_t
! xdr_u_long(xdrs, ulp)
  	register XDR *xdrs;
! 	u_long *ulp;
  {
  
  	if (xdrs-&gt;x_op == XDR_DECODE)
  		return (XDR_GETINT32(xdrs, (long *)ulp));
+ 
  	if (xdrs-&gt;x_op == XDR_ENCODE)
  		return (XDR_PUTINT32(xdrs, (long *)ulp));
+ 
  	if (xdrs-&gt;x_op == XDR_FREE)
  		return (TRUE);
+ 
  	return (FALSE);
  }
! 
  /*
   * XDR chars
   */
Index: openafs/src/rx/xdr.h
diff -c openafs/src/rx/xdr.h:1.4 openafs/src/rx/xdr.h:1.4.4.1
*** openafs/src/rx/xdr.h:1.4	Wed May 30 15:39:30 2001
--- openafs/src/rx/xdr.h	Sat Jun  8 00:47:43 2002
***************
*** 65,70 ****
--- 65,97 ----
  void *afs_osi_Alloc();
  #define	osi_alloc		afs_osi_Alloc
  #define	osi_free		afs_osi_Free
+ 
+ #ifndef UKERNEL
+ #define xdr_void afs_xdr_void
+ #define xdr_int afs_xdr_int
+ #define xdr_u_int afs_xdr_u_int
+ #define xdr_short afs_xdr_short
+ #define xdr_u_short afs_xdr_u_short
+ #define xdr_long afs_xdr_long
+ #define xdr_u_long afs_xdr_u_long
+ #define xdr_char afs_xdr_char
+ #define xdr_u_char afs_xdr_u_char
+ #define xdr_bool afs_xdr_bool
+ #define xdr_enum afs_xdr_enum
+ #define xdr_array afs_xdr_array
+ #define xdr_arrayN afs_xdr_arrayN
+ #define xdr_bytes afs_xdr_bytes
+ #define xdr_opaque afs_xdr_opaque
+ #define xdr_string afs_xdr_string
+ #define xdr_union afs_xdr_union
+ #define xdr_float afs_xdr_float
+ #define xdr_double afs_xdr_double
+ #define xdr_reference afs_xdr_reference
+ #define xdr_wrapstring afs_xdr_wrapstring
+ #define xdr_vector afs_xdr_vector
+ #define xdr_int64 afs_xdr_int64
+ #define xdr_uint64 afs_xdr_uint64
+ #endif
  #endif
  #ifndef major		/* ouch! */
  #include &lt;sys/types.h&gt;
Index: openafs/src/rx/xdr_rx.c
diff -c openafs/src/rx/xdr_rx.c:1.4 openafs/src/rx/xdr_rx.c:1.4.4.1
*** openafs/src/rx/xdr_rx.c:1.4	Thu Jul  5 11:20:44 2001
--- openafs/src/rx/xdr_rx.c	Sat Jun  8 00:47:43 2002
***************
*** 18,24 ****
  #endif
  #include &lt;afsconfig.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/rx/xdr_rx.c,v 1.4 2001/07/05 15:20:44 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 18,24 ----
  #endif
  #include &lt;afsconfig.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/rx/xdr_rx.c,v 1.4.4.1 2002/06/08 04:47:43 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 45,51 ****
  #define u_quad_t __u_quad_t
  #endif
  #endif
! #include "../rpc/xdr.h"
  #include "../netinet/in.h"
  #else /* !UKERNEL */
  #include "../afs/sysincludes.h"
--- 45,51 ----
  #define u_quad_t __u_quad_t
  #endif
  #endif
! #include "../rx/xdr.h"
  #include "../netinet/in.h"
  #else /* !UKERNEL */
  #include "../afs/sysincludes.h"
Index: openafs/src/rxgen/rpc_main.c
diff -c openafs/src/rxgen/rpc_main.c:1.12.2.3 openafs/src/rxgen/rpc_main.c:1.12.2.4
*** openafs/src/rxgen/rpc_main.c:1.12.2.3	Sat Oct 13 00:21:56 2001
--- openafs/src/rxgen/rpc_main.c	Sat Jun  8 00:47:44 2002
***************
*** 36,42 ****
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/rxgen/rpc_main.c,v 1.12.2.3 2001/10/13 04:21:56 shadow Exp $");
  
  #include &lt;limits.h&gt;
  #include &lt;stdio.h&gt;
--- 36,42 ----
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/rxgen/rpc_main.c,v 1.12.2.4 2002/06/08 04:47:44 shadow Exp $");
  
  #include &lt;limits.h&gt;
  #include &lt;stdio.h&gt;
***************
*** 436,449 ****
  	    f_print(fout, "#include \"../h/stat.h\"\n");
  	    f_print(fout, "#include \"../netinet/in.h\"\n");
  	    f_print(fout, "#include \"../h/time.h\"\n");
- 	    f_print(fout, "#ifndef AFS_LINUX22_ENV\n");
- 	    f_print(fout, "#include \"../rpc/types.h\"\n");
- 	    f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
- 	    f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
  	    f_print(fout, "#include \"../rx/xdr.h\"\n");
- 	    f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
- 	    f_print(fout, "#include \"../rpc/xdr.h\"\n");
- 	    f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
  	    f_print(fout, "#include \"../afsint/rxgen_consts.h\"\n");
  	} else {
  	    f_print(fout, "#include &lt;rx/xdr.h&gt;\n");
--- 436,442 ----
***************
*** 570,582 ****
  	f_print(fout, "#define u_quad_t __u_quad_t\n");
  	f_print(fout, "#endif\n");
  	f_print(fout, "#endif\n");
- 	f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
  	f_print(fout, "#include \"../rx/xdr.h\"\n");
- 	f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
- 	f_print(fout, "extern bool_t xdr_int64();\n");
- 	f_print(fout, "extern bool_t xdr_uint64();\n");
- 	f_print(fout, "#include \"../rpc/xdr.h\"\n");
- 	f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
  	f_print(fout, "#endif /* XDR_GETLONG */\n");
  	f_print(fout, "#endif   /* UKERNEL */\n");
  	f_print(fout, "#include \"../afsint/rxgen_consts.h\"\n");
--- 563,569 ----
***************
*** 752,762 ****
  	    f_print(fout, "#include \"../netinet/in.h\"\n");
  	    f_print(fout, "#include \"../h/time.h\"\n");
  	    f_print(fout, "#include \"../rpc/types.h\"\n");
- 	    f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
  	    f_print(fout, "#include \"../rx/xdr.h\"\n");
- 	    f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
- 	    f_print(fout, "#include \"../rpc/xdr.h\"\n");
- 	    f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
  	    f_print(fout, "#include \"../afsint/rxgen_consts.h\"\n");
  	    f_print(fout, "#include \"../afs/afs_osi.h\"\n");
  	    f_print(fout, "#include \"../rx/rx.h\"\n");
--- 739,745 ----
***************
*** 827,837 ****
  	    f_print(fout, "#include \"../netinet/in.h\"\n");
  	    f_print(fout, "#include \"../h/time.h\"\n");
  	    f_print(fout, "#include \"../rpc/types.h\"\n");
- 	    f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
  	    f_print(fout, "#include \"../rx/xdr.h\"\n");
- 	    f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
- 	    f_print(fout, "#include \"../rpc/xdr.h\"\n");
- 	    f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
  	    f_print(fout, "#include \"../afsint/rxgen_consts.h\"\n");
  	    f_print(fout, "#include \"../afs/afs_osi.h\"\n");
  	    f_print(fout, "#include \"../rx/rx.h\"\n");
--- 810,816 ----
Index: openafs/src/rxkad/rxkad_client.c
diff -c openafs/src/rxkad/rxkad_client.c:1.7.2.1 openafs/src/rxkad/rxkad_client.c:1.7.2.2
*** openafs/src/rxkad/rxkad_client.c:1.7.2.1	Sat Oct 13 00:21:56 2001
--- openafs/src/rxkad/rxkad_client.c	Sat Jun  8 00:47:45 2002
***************
*** 18,24 ****
  #include &lt;afs/param.h&gt;
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_client.c,v 1.7.2.1 2001/10/13 04:21:56 shadow Exp $");
  
  #ifdef KERNEL
  #include "../afs/stds.h"
--- 18,24 ----
  #include &lt;afs/param.h&gt;
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_client.c,v 1.7.2.2 2002/06/08 04:47:45 shadow Exp $");
  
  #ifdef KERNEL
  #include "../afs/stds.h"
***************
*** 34,40 ****
  #endif /* !UKERNEL */
  #ifndef AFS_LINUX22_ENV
  #include "../rpc/types.h"
! #include "../rpc/xdr.h"
  #endif
  #include "../rx/rx.h"
  #else /* ! KERNEL */
--- 34,40 ----
  #endif /* !UKERNEL */
  #ifndef AFS_LINUX22_ENV
  #include "../rpc/types.h"
! #include "../rx/xdr.h"
  #endif
  #include "../rx/rx.h"
  #else /* ! KERNEL */
Index: openafs/src/rxkad/rxkad_common.c
diff -c openafs/src/rxkad/rxkad_common.c:1.8.2.2 openafs/src/rxkad/rxkad_common.c:1.8.2.3
*** openafs/src/rxkad/rxkad_common.c:1.8.2.2	Thu Apr 25 17:19:52 2002
--- openafs/src/rxkad/rxkad_common.c	Sat Jun  8 00:47:45 2002
***************
*** 16,22 ****
  #include &lt;afs/param.h&gt;
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_common.c,v 1.8.2.2 2002/04/25 21:19:52 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 16,22 ----
  #include &lt;afs/param.h&gt;
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_common.c,v 1.8.2.3 2002/06/08 04:47:45 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 29,35 ****
  #include "../h/time.h"
  #ifndef AFS_LINUX22_ENV
  #include "../rpc/types.h"
! #include "../rpc/xdr.h"
  #endif /* AFS_LINUX22_ENV */
  #else /* !UKERNEL */
  #include "../afs/sysincludes.h"
--- 29,35 ----
  #include "../h/time.h"
  #ifndef AFS_LINUX22_ENV
  #include "../rpc/types.h"
! #include "../rx/xdr.h"
  #endif /* AFS_LINUX22_ENV */
  #else /* !UKERNEL */
  #include "../afs/sysincludes.h"
Index: openafs/src/util/NTMakefile
diff -c openafs/src/util/NTMakefile:1.4 openafs/src/util/NTMakefile:1.4.2.1
*** openafs/src/util/NTMakefile:1.4	Sat Sep  8 00:31:32 2001
--- openafs/src/util/NTMakefile	Fri Jun  7 20:20:26 2002
***************
*** 29,35 ****
  $(DESTDIR)\include\afs\dirent.h: dirent_nt.h
  	$(COPY) $** $@
  
! $(DESTDIR)\include\afs\dirpath.h: dirpath.hin
  	$(COPY) $** $@
  
  LIBFILE = $(DESTDIR)\lib\afs\afsutil.lib
--- 29,35 ----
  $(DESTDIR)\include\afs\dirent.h: dirent_nt.h
  	$(COPY) $** $@
  
! $(DESTDIR)\include\afs\dirpath.h: dirpath_nt.h
  	$(COPY) $** $@
  
  LIBFILE = $(DESTDIR)\lib\afs\afsutil.lib
Index: openafs/src/util/dirpath_nt.h
diff -c /dev/null openafs/src/util/dirpath_nt.h:1.1.4.1
*** /dev/null	Sat Jun  8 20:53:30 2002
--- openafs/src/util/dirpath_nt.h	Fri Jun  7 20:20:26 2002
***************
*** 0 ****
--- 1,325 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #ifndef _DIRPATH_H
+ #define _DIRPATH_H
+ 
+ /* Dirpath package: Rationale and Usage
+  *
+  * With the port of AFS to Windows NT, it becomes necessary to support
+  * storing AFS system files (binaries, logs, etc.) in a user-specified
+  * installation directory.  This breaks from the traditional notion of
+  * all AFS system files being stored under /usr/afs or /usr/vice.
+  *
+  * The core concept is that there is a dynamically determined installation
+  * directory that is the prefix to a well-known AFS tree.  The structure
+  * of this well-known AFS tree remains unchanged.  For example, AFS server
+  * binaries reside in &lt;install dir&gt;/usr/afs/bin, server configuration files
+  * reside in &lt;install dir&gt;/usr/afs/etc, etcetera.  This scheme allows the
+  * flexibility required by NT, without requiring file-location changes
+  * on Unix (for which &lt;install dir&gt; can simply be null).
+  *
+  * Thus file paths can no longer be hard-coded; rather, all file paths are
+  * specified via the macros provided by this package.
+  *
+  * Utilizing a dynamically determined installation directory forces the
+  * notion of local versus canonical (wire-format) paths.  A local path is
+  * fully qualified (with a syntax determined by the native filesystem type)
+  * whereas a canonical path specifies location only within the well-known AFS
+  * tree.  Supporting the notion of canonical paths allows the same path to
+  * be sent to servers on different machines, having different installation
+  * directories, with the desired result.
+  *
+  * For example, 'bos create &lt;mach&gt; kaserver simple /usr/afs/bin/kasever' will
+  * work both on a Unix machine, where the kaserver executable actually resides
+  * in /usr/afs/bin, and on a NT machine, where the kaserver may reside in
+  * C:/Program Files/Transarc/AFS Server/usr/afs/bin.
+  *
+  * Conversion functions are provided that translate canonical (wire-format)
+  * paths to fully qualified local paths; see the documentation in dirpath.c
+  * for details.  Note that these conversion functions also accomodate fully
+  * qualified paths on the wire, for exceptional cases where this feature
+  * may be required.  Again, these conversion functions have been implemented
+  * such that no file-location changes are required on Unix.
+  *
+  * The path macros provided here are divided into local (AFSDIR_*) and
+  * canonical (AFSDIR_CANONICAL_*).  The canonical macros MUST be used by
+  * commands that send a non-user-specified path to a server (i.e., over
+  * the wire).  The local macros MUST be used in all other cases.
+  */
+ 
+ 
+ 
+ #include &lt;afs/param.h&gt;
+ 
+ #ifdef AFS_NT40_ENV
+ #include &lt;windef.h&gt;
+ #endif
+ #include &lt;limits.h&gt;
+ 
+ /* Max dir path size for afs install dirs */
+ #ifdef AFS_NT40_ENV
+ #define AFSDIR_PATH_MAX MAX_PATH
+ #else /* unices */
+ #define AFSDIR_PATH_MAX    _POSIX_PATH_MAX
+ #endif
+  
+ 
+ /* ---------------------  Exported functions ---------------------- */
+ 
+ 
+ #define AFSDIR_CLIENT_PATHS_OK 0x1   /* client paths initialized correctly */
+ #define AFSDIR_SERVER_PATHS_OK 0x2   /* server paths initialized correctly */
+ extern unsigned int initAFSDirPath(void);
+ 
+ extern int
+ ConstructLocalPath(const char *cpath,
+ 		   const char *relativeTo,
+ 		   char **fullPathBufp);
+ extern int
+ ConstructLocalBinPath(const char *cpath,
+ 		      char **fullPathBufp);
+ extern int
+ ConstructLocalLogPath(const char *cpath,
+ 		      char **fullPathBufp);
+ 
+ 
+ 
+ /* -----------------  Directory/file name macros ------------------ */
+ 
+ /* afs installation dir names */
+ #define AFSDIR_ETC_DIR   "etc"
+ #define AFSDIR_BIN_DIR   "bin"
+ #define AFSDIR_CORES_DIR "cores"
+ #define AFSDIR_DB_DIR    "db"
+ #define AFSDIR_LOGS_DIR  "logs"
+ #define AFSDIR_LOCAL_DIR "local"
+ #define AFSDIR_BACKUP_DIR "backup"
+ #define AFSDIR_MIGR_DIR  "local/migrate"
+ #define AFSDIR_BIN_FILE_DIR  "local/migrate/bin_files"
+ 
+ /* file names */ 
+ #define AFSDIR_THISCELL_FILE    "ThisCell"
+ #define AFSDIR_CELLSERVDB_FILE  "CellServDB"
+ #define AFSDIR_KEY_FILE         "KeyFile"
+ #define AFSDIR_ULIST_FILE       "UserList"
+ #define AFSDIR_NOAUTH_FILE      "NoAuth"
+ #define AFSDIR_BUDBLOG_FILE     "BackupLog"
+ #define AFSDIR_TAPECONFIG_FILE  "tapeconfig"
+ #define AFSDIR_KALOGDB_FILE    	"AuthLog"
+ #define AFSDIR_KALOG_FILE       "AuthLog"
+ #define AFSDIR_KADB_FILE        "kaserver"
+ #define AFSDIR_NTPD_FILE        "ntpd"
+ #define AFSDIR_PRDB_FILE        "prdb"
+ #define AFSDIR_PTLOG_FILE       "PtLog"
+ #define AFSDIR_KCONF_FILE       "krb.conf"
+ #define AFSDIR_VLDB_FILE        "vldb"
+ #define AFSDIR_VLOG_FILE        "VLLog"
+ #define AFSDIR_CORE_FILE        "core"
+ #define AFSDIR_SLVGLOG_FILE     "SalvageLog"
+ #define AFSDIR_SALVAGER_FILE    "salvager"
+ #define AFSDIR_SLVGLOCK_FILE    "salvage.lock"
+ #define AFSDIR_BOZCONF_FILE     "BosConfig"
+ #define AFSDIR_BOZCONFNEW_FILE  "BosConfig.new"
+ #define AFSDIR_BOZINIT_FILE     "BozoInit"
+ #define AFSDIR_BOZLOG_FILE      "BosLog"
+ #define AFSDIR_BOSVR_FILE       "bosserver"
+ #define AFSDIR_VOLSERLOG_FILE   "VolserLog"
+ #define AFSDIR_AUDIT_FILE       "Audit"
+ 
+ #define AFSDIR_ROOTVOL_FILE     "RootVolume"
+ #define AFSDIR_HOSTDUMP_FILE    "hosts.dump"
+ #define AFSDIR_CLNTDUMP_FILE    "client.dump"
+ #define AFSDIR_CBKDUMP_FILE     "callback.dump"
+ #define AFSDIR_OLDSYSID_FILE    "sysid.old"
+ #define AFSDIR_SYSID_FILE       "sysid"
+ #define AFSDIR_FILELOG_FILE     "FileLog"
+ #define AFSDIR_MIGRATE_LOGNAME  "wtlog."
+ 
+ #define AFSDIR_CELLSERVDB_FILE_NTCLIENT  "afsdcell.ini"
+ 
+ #define AFSDIR_NETINFO_FILE     "NetInfo"
+ #define AFSDIR_NETRESTRICT_FILE "NetRestrict"
+ 
+ #define AFSDIR_LOCALRESIDENCY_FILE "LocalResidency"
+ #define AFSDIR_WEIGHTINGCONST_FILE "Weight.LocalConstants"
+ #define AFSDIR_THRESHOLDCONST_FILE "Thershold.LocalConstants"
+ 
+ /* -------------- Canonical (wire-format) path macros -------------- */
+ 
+ /* Each of the following is a canonical form of the corresponding
+  * local (AFSDIR_*) path macro.
+  */
+ 
+ #define AFSDIR_CANONICAL_USR_DIRPATH            "/usr"
+ #define AFSDIR_CANONICAL_SERVER_AFS_DIRPATH     "/usr/afs"
+ #define AFSDIR_CANONICAL_CLIENT_VICE_DIRPATH    "/usr/vice"
+ #ifdef AFS_DARWIN_ENV
+ #define AFSDIR_ALTERNATE_CLIENT_VICE_DIRPATH    "/var/db/openafs"
+ #endif
+ 
+ #define AFSDIR_CANONICAL_SERVER_BIN_DIRPATH \
+ AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_BIN_DIR
+ 
+ #define AFSDIR_CANONICAL_SERVER_ETC_DIRPATH \
+ AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_ETC_DIR
+ 
+ #define AFSDIR_CANONICAL_SERVER_LOGS_DIRPATH \
+ AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_LOGS_DIR
+ 
+ #define AFSDIR_CANONICAL_SERVER_LOCAL_DIRPATH \
+ AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_LOCAL_DIR
+ 
+ 
+ #define AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH \
+ AFSDIR_CANONICAL_SERVER_BIN_DIRPATH "/" AFSDIR_SALVAGER_FILE
+ 
+ #define AFSDIR_CANONICAL_SERVER_SLVGLOG_FILEPATH \
+ AFSDIR_CANONICAL_SERVER_LOGS_DIRPATH "/" AFSDIR_SLVGLOG_FILE
+ 
+ 
+ /* ---------------------  Local path macros ---------------------- */
+ 
+ /* Note: On NT, these should be used only after calling initAFSDirPath().
+  *       On Unix, the paths are implicitly initialized.
+  */
+ 
+ /* enums for indexes into the pathname array */
+ typedef enum afsdir_id { 
+       AFSDIR_USR_DIRPATH_ID,
+       AFSDIR_SERVER_AFS_DIRPATH_ID,
+       AFSDIR_SERVER_ETC_DIRPATH_ID,
+       AFSDIR_SERVER_BIN_DIRPATH_ID,
+       AFSDIR_SERVER_CORES_DIRPATH_ID,
+       AFSDIR_SERVER_DB_DIRPATH_ID,
+       AFSDIR_SERVER_LOGS_DIRPATH_ID,
+       AFSDIR_SERVER_LOCAL_DIRPATH_ID,
+       AFSDIR_SERVER_BACKUP_DIRPATH_ID,
+       AFSDIR_CLIENT_VICE_DIRPATH_ID,
+       AFSDIR_CLIENT_ETC_DIRPATH_ID,
+       AFSDIR_SERVER_THISCELL_FILEPATH_ID,
+       AFSDIR_SERVER_CELLSERVDB_FILEPATH_ID,
+       AFSDIR_SERVER_NOAUTH_FILEPATH_ID,
+       AFSDIR_SERVER_KEY_FILEPATH_ID,
+       AFSDIR_SERVER_ULIST_FILEPATH_ID,
+       AFSDIR_SERVER_BUDBLOG_FILEPATH_ID,
+       AFSDIR_SERVER_TAPECONFIG_FILEPATH_ID,
+       AFSDIR_SERVER_KALOGDB_FILEPATH_ID,
+       AFSDIR_SERVER_KALOG_FILEPATH_ID,
+       AFSDIR_SERVER_KADB_FILEPATH_ID,
+       AFSDIR_SERVER_NTPD_FILEPATH_ID,
+       AFSDIR_SERVER_PRDB_FILEPATH_ID,
+       AFSDIR_SERVER_PTLOG_FILEPATH_ID,
+       AFSDIR_SERVER_KCONF_FILEPATH_ID,
+       AFSDIR_SERVER_VLDB_FILEPATH_ID,
+       AFSDIR_SERVER_VLOG_FILEPATH_ID,
+       AFSDIR_SERVER_CORELOG_FILEPATH_ID,
+       AFSDIR_SERVER_SLVGLOG_FILEPATH_ID,
+       AFSDIR_SERVER_SALVAGER_FILEPATH_ID,
+       AFSDIR_SERVER_BOZCONF_FILEPATH_ID,
+       AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID,
+       AFSDIR_SERVER_BOZINIT_FILEPATH_ID,
+       AFSDIR_SERVER_BOZLOG_FILEPATH_ID,
+       AFSDIR_SERVER_BOSVR_FILEPATH_ID,
+       AFSDIR_SERVER_SLVGLOCK_FILEPATH_ID,
+       AFSDIR_SERVER_VOLSERLOG_FILEPATH_ID,
+       AFSDIR_SERVER_ROOTVOL_FILEPATH_ID,
+       AFSDIR_SERVER_HOSTDUMP_FILEPATH_ID,
+       AFSDIR_SERVER_CLNTDUMP_FILEPATH_ID,
+       AFSDIR_SERVER_CBKDUMP_FILEPATH_ID,
+       AFSDIR_SERVER_OLDSYSID_FILEPATH_ID,
+       AFSDIR_SERVER_SYSID_FILEPATH_ID,
+       AFSDIR_SERVER_FILELOG_FILEPATH_ID,
+       AFSDIR_SERVER_AUDIT_FILEPATH_ID,
+       AFSDIR_CLIENT_THISCELL_FILEPATH_ID,
+       AFSDIR_CLIENT_CELLSERVDB_FILEPATH_ID,
+       AFSDIR_CLIENT_NETINFO_FILEPATH_ID,
+       AFSDIR_CLIENT_NETRESTRICT_FILEPATH_ID,
+       AFSDIR_SERVER_NETINFO_FILEPATH_ID,
+       AFSDIR_SERVER_NETRESTRICT_FILEPATH_ID,
+       AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH_ID,
+       AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH_ID,
+       AFSDIR_SERVER_MIGRATE_DIRPATH_ID,
+       AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID,
+       AFSDIR_SERVER_BIN_FILE_DIRPATH_ID,
+       AFSDIR_PATHSTRING_MAX } afsdir_id_t;
+ 
+ /* getDirPath() returns a pointer to a string from an internal array of path strings 
+  */
+ const char *getDirPath(afsdir_id_t string_id);
+ 
+ /* Top level usr dir */
+ #define AFSDIR_USR_DIRPATH getDirPath(AFSDIR_USR_DIRPATH_ID)
+ 
+ /* server subdir paths */
+ #define AFSDIR_SERVER_AFS_DIRPATH getDirPath(AFSDIR_SERVER_AFS_DIRPATH_ID)
+ #define AFSDIR_SERVER_ETC_DIRPATH getDirPath(AFSDIR_SERVER_ETC_DIRPATH_ID)
+ #define AFSDIR_SERVER_BIN_DIRPATH getDirPath(AFSDIR_SERVER_BIN_DIRPATH_ID)
+ #define AFSDIR_SERVER_CORES_DIRPATH getDirPath(AFSDIR_SERVER_CORES_DIRPATH_ID)
+ #define AFSDIR_SERVER_DB_DIRPATH getDirPath(AFSDIR_SERVER_DB_DIRPATH_ID)
+ #define AFSDIR_SERVER_LOGS_DIRPATH getDirPath(AFSDIR_SERVER_LOGS_DIRPATH_ID)
+ #define AFSDIR_SERVER_LOCAL_DIRPATH getDirPath(AFSDIR_SERVER_LOCAL_DIRPATH_ID)
+ #define AFSDIR_SERVER_BACKUP_DIRPATH getDirPath(AFSDIR_SERVER_BACKUP_DIRPATH_ID)
+ #define AFSDIR_SERVER_LOCAL_DIRPATH getDirPath(AFSDIR_SERVER_LOCAL_DIRPATH_ID)
+ #define AFSDIR_SERVER_MIGRATE_DIRPATH getDirPath(AFSDIR_SERVER_MIGRATE_DIRPATH_ID)
+ #define AFSDIR_SERVER_MIGRATE_DIRPATH getDirPath(AFSDIR_SERVER_MIGRATE_DIRPATH_ID)
+ 
+ /* client subdir paths */
+ #define AFSDIR_CLIENT_VICE_DIRPATH getDirPath(AFSDIR_CLIENT_VICE_DIRPATH_ID)
+ #define AFSDIR_CLIENT_ETC_DIRPATH getDirPath(AFSDIR_CLIENT_ETC_DIRPATH_ID)
+ #define AFSDIR_SERVER_BIN_FILE_DIRPATH getDirPath(AFSDIR_SERVER_BIN_FILE_DIRPATH_ID)
+ 
+ /* server file paths */
+ #define AFSDIR_SERVER_THISCELL_FILEPATH getDirPath(AFSDIR_SERVER_THISCELL_FILEPATH_ID)
+ #define AFSDIR_SERVER_CELLSERVDB_FILEPATH getDirPath(AFSDIR_SERVER_CELLSERVDB_FILEPATH_ID)
+ #define AFSDIR_SERVER_NOAUTH_FILEPATH getDirPath(AFSDIR_SERVER_NOAUTH_FILEPATH_ID)
+ #define AFSDIR_SERVER_KEY_FILEPATH getDirPath(AFSDIR_SERVER_KEY_FILEPATH_ID)
+ #define AFSDIR_SERVER_ULIST_FILEPATH getDirPath(AFSDIR_SERVER_ULIST_FILEPATH_ID)
+ #define AFSDIR_SERVER_BUDBLOG_FILEPATH getDirPath(AFSDIR_SERVER_BUDBLOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_TAPECONFIG_FILEPATH getDirPath(AFSDIR_SERVER_TAPECONFIG_FILEPATH_ID)
+ #define AFSDIR_SERVER_KALOGDB_FILEPATH getDirPath(AFSDIR_SERVER_KALOGDB_FILEPATH_ID)
+ #define AFSDIR_SERVER_KALOG_FILEPATH getDirPath(AFSDIR_SERVER_KALOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_KADB_FILEPATH getDirPath(AFSDIR_SERVER_KADB_FILEPATH_ID)
+ #define AFSDIR_SERVER_NTPD_FILEPATH getDirPath(AFSDIR_SERVER_NTPD_FILEPATH_ID)
+ #define AFSDIR_SERVER_PRDB_FILEPATH getDirPath(AFSDIR_SERVER_PRDB_FILEPATH_ID)
+ #define AFSDIR_SERVER_PTLOG_FILEPATH getDirPath(AFSDIR_SERVER_PTLOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_KCONF_FILEPATH getDirPath(AFSDIR_SERVER_KCONF_FILEPATH_ID)
+ #define AFSDIR_SERVER_VLDB_FILEPATH getDirPath(AFSDIR_SERVER_VLDB_FILEPATH_ID)
+ #define AFSDIR_SERVER_VLOG_FILEPATH getDirPath(AFSDIR_SERVER_VLOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_CORELOG_FILEPATH getDirPath(AFSDIR_SERVER_CORELOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_SLVGLOG_FILEPATH getDirPath(AFSDIR_SERVER_SLVGLOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_SALVAGER_FILEPATH getDirPath(AFSDIR_SERVER_SALVAGER_FILEPATH_ID)
+ #define AFSDIR_SERVER_BOZCONF_FILEPATH getDirPath(AFSDIR_SERVER_BOZCONF_FILEPATH_ID)
+ #define AFSDIR_SERVER_BOZCONFNEW_FILEPATH getDirPath(AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID)
+ #define AFSDIR_SERVER_BOZINIT_FILEPATH getDirPath(AFSDIR_SERVER_BOZINIT_FILEPATH_ID)
+ #define AFSDIR_SERVER_BOZLOG_FILEPATH getDirPath(AFSDIR_SERVER_BOZLOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_BOSVR_FILEPATH getDirPath(AFSDIR_SERVER_BOSVR_FILEPATH_ID)
+ #define AFSDIR_SERVER_SLVGLOCK_FILEPATH getDirPath(AFSDIR_SERVER_SLVGLOCK_FILEPATH_ID)
+ #define AFSDIR_SERVER_VOLSERLOG_FILEPATH getDirPath(AFSDIR_SERVER_VOLSERLOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_ROOTVOL_FILEPATH getDirPath(AFSDIR_SERVER_ROOTVOL_FILEPATH_ID)
+ #define AFSDIR_SERVER_HOSTDUMP_FILEPATH getDirPath(AFSDIR_SERVER_HOSTDUMP_FILEPATH_ID)
+ #define AFSDIR_SERVER_CLNTDUMP_FILEPATH getDirPath(AFSDIR_SERVER_CLNTDUMP_FILEPATH_ID)
+ #define AFSDIR_SERVER_CBKDUMP_FILEPATH getDirPath(AFSDIR_SERVER_CBKDUMP_FILEPATH_ID)
+ #define AFSDIR_SERVER_OLDSYSID_FILEPATH getDirPath(AFSDIR_SERVER_OLDSYSID_FILEPATH_ID)
+ #define AFSDIR_SERVER_SYSID_FILEPATH getDirPath(AFSDIR_SERVER_SYSID_FILEPATH_ID)
+ #define AFSDIR_SERVER_FILELOG_FILEPATH getDirPath(AFSDIR_SERVER_FILELOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_AUDIT_FILEPATH getDirPath(AFSDIR_SERVER_AUDIT_FILEPATH_ID)
+ #define AFSDIR_SERVER_NETINFO_FILEPATH getDirPath(AFSDIR_SERVER_NETINFO_FILEPATH_ID)
+ #define AFSDIR_SERVER_NETRESTRICT_FILEPATH getDirPath(AFSDIR_SERVER_NETRESTRICT_FILEPATH_ID)
+ #define AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH_ID)
+ #define AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH_ID)
+ #define AFSDIR_SERVER_MIGRATELOG_FILEPATH getDirPath(AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID)
+ 
+ /* client file paths */
+ #define AFSDIR_CLIENT_THISCELL_FILEPATH getDirPath(AFSDIR_CLIENT_THISCELL_FILEPATH_ID)
+ #define AFSDIR_CLIENT_CELLSERVDB_FILEPATH getDirPath(AFSDIR_CLIENT_CELLSERVDB_FILEPATH_ID)  
+ #define AFSDIR_CLIENT_NETINFO_FILEPATH getDirPath(AFSDIR_CLIENT_NETINFO_FILEPATH_ID)
+ #define AFSDIR_CLIENT_NETRESTRICT_FILEPATH getDirPath(AFSDIR_CLIENT_NETRESTRICT_FILEPATH_ID)
+ 
+ #endif /* _DIRPATH_H */
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.10.2.4 openafs/src/viced/afsfileprocs.c:1.10.2.5
*** openafs/src/viced/afsfileprocs.c:1.10.2.4	Fri Apr 19 00:15:03 2002
--- openafs/src/viced/afsfileprocs.c	Fri Jun  7 20:16:09 2002
***************
*** 28,34 ****
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/viced/afsfileprocs.c,v 1.10.2.4 2002/04/19 04:15:03 zacheiss Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
--- 28,34 ----
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/viced/afsfileprocs.c,v 1.10.2.5 2002/06/08 00:16:09 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
***************
*** 1715,1720 ****
--- 1715,1721 ----
      struct client *t_client;            /* tmp ptr to client data */
      struct in_addr logHostAddr;		/* host ip holder for inet_ntoa */
  
+     FidZero(&amp;dir);
      /* Get ptr to client data for user Id for logging */
      t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); 
      logHostAddr.s_addr =  rx_HostOf(rx_PeerOf(tcon));
***************
*** 1783,1788 ****
--- 1784,1790 ----
  Bad_RemoveFile: 
      /* Update and store volume/vnode and parent vnodes back */
      PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr);
+     FidZap(&amp;dir);
      ViceLog(2, ("SAFS_RemoveFile returns %d\n",	errorCode)); 
      return errorCode;
  
***************
*** 1877,1882 ****
--- 1879,1886 ----
      struct client *t_client;            /* tmp ptr to client data */
      struct in_addr logHostAddr;		/* host ip holder for inet_ntoa */
  
+     FidZero(&amp;dir);
+ 
      /* Get ptr to client data for user Id for logging */
      t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); 
      logHostAddr.s_addr =  rx_HostOf(rx_PeerOf(tcon));
***************
*** 1944,1949 ****
--- 1948,1954 ----
  Bad_CreateFile:
      /* Update and store volume/vnode and parent vnodes back */
      PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr);
+     FidZap(&amp;dir);
      ViceLog(2, ("SAFS_CreateFile returns %d\n",	errorCode)); 
      return errorCode;
  
***************
*** 2055,2060 ****
--- 2060,2070 ----
      struct client *t_client;            /* tmp ptr to client data */
      struct in_addr logHostAddr;		/* host ip holder for inet_ntoa */
  
+     FidZero(&amp;olddir);
+     FidZero(&amp;newdir);
+     FidZero(&amp;filedir);
+     FidZero(&amp;newfiledir);
+ 
      /* Get ptr to client data for user Id for logging */
      t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); 
      logHostAddr.s_addr =  rx_HostOf(rx_PeerOf(tcon));
***************
*** 2404,2409 ****
--- 2414,2423 ----
      }
      PutVolumePackage(fileptr, (newvptr &amp;&amp; newvptr != oldvptr? newvptr : 0),
  		     oldvptr, volptr);
+     FidZap(&amp;olddir);
+     FidZap(&amp;newdir);
+     FidZap(&amp;filedir);
+     FidZap(&amp;newfiledir);
      ViceLog(2, ("SAFS_Rename returns %d\n", errorCode));
      return errorCode;
  
***************
*** 2503,2508 ****
--- 2517,2524 ----
      struct in_addr logHostAddr;		/* host ip holder for inet_ntoa */
      FdHandle_t *fdP;
  
+     FidZero(&amp;dir);
+ 
      /* Get ptr to client data for user Id for logging */
      t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); 
      logHostAddr.s_addr =  rx_HostOf(rx_PeerOf(tcon));
***************
*** 2594,2599 ****
--- 2610,2616 ----
  Bad_SymLink: 
      /* Write the all modified vnodes (parent, new files) and volume back */
      PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr);
+     FidZap(&amp;dir);
      ViceLog(2, ("SAFS_Symlink returns %d\n", errorCode));
      return errorCode;
  
***************
*** 2690,2695 ****
--- 2707,2714 ----
      struct client *t_client;            /* tmp ptr to client data */
      struct in_addr logHostAddr;		/* host ip holder for inet_ntoa */
  
+     FidZero(&amp;dir);
+ 
      /* Get ptr to client data for user Id for logging */
      t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); 
      logHostAddr.s_addr =  rx_HostOf(rx_PeerOf(tcon));
***************
*** 2794,2799 ****
--- 2813,2819 ----
  Bad_Link:
      /* Write the all modified vnodes (parent, new files) and volume back */
      PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr);
+     FidZap(&amp;dir);
      ViceLog(2, ("SAFS_Link returns %d\n", errorCode));
      return errorCode;
  
***************
*** 2894,2899 ****
--- 2914,2922 ----
      struct client *t_client;            /* tmp ptr to client data */
      struct in_addr logHostAddr;		/* host ip holder for inet_ntoa */
  
+     FidZero(&amp;dir);
+     FidZero(&amp;parentdir);
+ 
      /* Get ptr to client data for user Id for logging */
      t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); 
      logHostAddr.s_addr =  rx_HostOf(rx_PeerOf(tcon));
***************
*** 2964,2970 ****
      Update_TargetVnodeStatus(targetptr, TVS_MKDIR, client, InStatus,
  			     parentptr, volptr, 0);
  
!     /* Actually create the New directory in the directory package */
      SetDirHandle(&amp;dir, targetptr);
      assert(!(MakeDir(&amp;dir, OutFid, DirFid)));
      DFlush();
--- 2987,2993 ----
      Update_TargetVnodeStatus(targetptr, TVS_MKDIR, client, InStatus,
  			     parentptr, volptr, 0);
  
!     /* Actually create the New directory in the directory package */ 
      SetDirHandle(&amp;dir, targetptr);
      assert(!(MakeDir(&amp;dir, OutFid, DirFid)));
      DFlush();
***************
*** 2987,2992 ****
--- 3010,3017 ----
  Bad_MakeDir: 
      /* Write the all modified vnodes (parent, new files) and volume back */
      PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr);
+     FidZap(&amp;dir);
+     FidZap(&amp;parentdir);
      ViceLog(2, ("SAFS_MakeDir returns %d\n", errorCode)); 
      return errorCode;
  
***************
*** 3082,3087 ****
--- 3107,3114 ----
      struct client *t_client;            /* tmp ptr to client data */
      struct in_addr logHostAddr;		/* host ip holder for inet_ntoa */
  
+     FidZero(&amp;dir);
+ 
      /* Get ptr to client data for user Id for logging */
      t_client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key); 
      logHostAddr.s_addr =  rx_HostOf(rx_PeerOf(tcon));
***************
*** 3146,3151 ****
--- 3173,3179 ----
  Bad_RemoveDir: 
      /* Write the all modified vnodes (parent, new files) and volume back */
      PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr);
+     FidZap(&amp;dir);
      ViceLog(2, ("SAFS_RemoveDir	returns	%d\n", errorCode));
      return errorCode;
  
***************
*** 6572,6577 ****
--- 6600,6606 ----
  		    ViceLog(0,("CopyOnWrite failed: volume %u in partition %s  (tried reading %u, read %u, wrote %u, errno %u) volume needs salvage\n",
  			       V_id(volptr), volptr-&gt;partition-&gt;name, length,
  			       rdlen, wrlen, errno));
+ 		    assert(0);
                      /* Decrement this inode so salvager doesn't find it. */
  		    FDH_REALLYCLOSE(newFdP);
  		    IH_RELEASE(newH);
Index: openafs/src/viced/host.c
diff -c openafs/src/viced/host.c:1.7.2.3 openafs/src/viced/host.c:1.7.2.6
*** openafs/src/viced/host.c:1.7.2.3	Sun Apr 21 16:54:59 2002
--- openafs/src/viced/host.c	Fri Jun  7 20:17:31 2002
***************
*** 10,16 ****
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/viced/host.c,v 1.7.2.3 2002/04/21 20:54:59 zacheiss Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;errno.h&gt;
--- 10,16 ----
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/viced/host.c,v 1.7.2.6 2002/06/08 00:17:31 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;errno.h&gt;
***************
*** 534,545 ****
      register afs_uint32  hostaddr, hport;  /* net byte order */
  {
      register struct host *host;
      
      H_LOCK
!     host = h_Lookup_r(hostaddr, hport);
      if (host) {
        host-&gt;hcpsfailed = 1;
      }
      H_UNLOCK
  
  return;
--- 534,548 ----
      register afs_uint32  hostaddr, hport;  /* net byte order */
  {
      register struct host *host;
+     int held;
      
      H_LOCK
!     host = h_Lookup_r(hostaddr, hport, &amp;held);
      if (host) {
        host-&gt;hcpsfailed = 1;
      }
+     if (!held)
+       h_Release_r(host);
      H_UNLOCK
  
  return;
***************
*** 635,652 ****
  
  
  /* Lookup a host given an IP address and UDP port number. */
! struct host *h_Lookup(hostaddr, hport)
      afs_uint32 hostaddr, hport;     /* network byte order */
  {
      struct host *retVal;
      H_LOCK
!     retVal = h_Lookup_r(hostaddr, hport);
      H_UNLOCK
      return retVal;
  }
  
! struct host *h_Lookup_r(hostaddr, hport)
      afs_uint32 hostaddr, hport;     /* network byte order */
  {
      register afs_int32 now;
      register struct host *host=0;
--- 638,658 ----
  
  
  /* Lookup a host given an IP address and UDP port number. */
! struct host *h_Lookup(hostaddr, hport, heldp)
      afs_uint32 hostaddr, hport;     /* network byte order */
+     int *heldp;
  {
      struct host *retVal;
      H_LOCK
!     retVal = h_Lookup_r(hostaddr, hport, heldp);
      H_UNLOCK
      return retVal;
  }
  
! /* Note: host should be released by caller if 0 == *heldp and non-null */
! struct host *h_Lookup_r(hostaddr, hport, heldp)
      afs_uint32 hostaddr, hport;     /* network byte order */
+     int *heldp;
  {
      register afs_int32 now;
      register struct host *host=0;
***************
*** 654,670 ****
      register index = h_HashIndex(hostaddr);
      extern int hostaclRefresh;
  
      for (chain=hostHashTable[index]; chain; chain=chain-&gt;next) {
  	host = chain-&gt;hostPtr;
  	assert(host);
          if (!(host-&gt;hostFlags &amp; HOSTDELETED) &amp;&amp; chain-&gt;addr == hostaddr
  	    &amp;&amp; host-&gt;port == hport) {
              now = FT_ApproxTime();		/* always evaluate "now" */
  	    if (host-&gt;hcpsfailed || (host-&gt;cpsCall+hostaclRefresh &lt; now )) {
  		/*
! 		 * Every hostaclRefresh period (def 2 hrs) get the new membership list for the host.
! 		 * Note this could be the first time that the host is added to a group.
! 		 * Also here we also retry on previous legitimate hcps failures
  		 */
  		h_gethostcps_r(host,now);
  	    }
--- 660,689 ----
      register index = h_HashIndex(hostaddr);
      extern int hostaclRefresh;
  
+ restart:
      for (chain=hostHashTable[index]; chain; chain=chain-&gt;next) {
  	host = chain-&gt;hostPtr;
  	assert(host);
          if (!(host-&gt;hostFlags &amp; HOSTDELETED) &amp;&amp; chain-&gt;addr == hostaddr
  	    &amp;&amp; host-&gt;port == hport) {
+ 	    *heldp = h_Held_r(host);
+ 	    if (!*heldp)
+ 		h_Hold_r(host);
+ 	    h_Lock_r(host);
+ 	    if (host-&gt;hostFlags &amp; HOSTDELETED) {
+ 		h_Unlock_r(host);
+ 		if (!*heldp)
+ 		    h_Release_r(host);
+ 		goto restart;
+ 	    }
+ 	    h_Unlock_r(host);
              now = FT_ApproxTime();		/* always evaluate "now" */
  	    if (host-&gt;hcpsfailed || (host-&gt;cpsCall+hostaclRefresh &lt; now )) {
  		/*
! 		 * Every hostaclRefresh period (def 2 hrs) get the new
! 		 * membership list for the host.  Note this could be the
! 		 * first time that the host is added to a group.  Also
! 		 * here we also retry on previous legitimate hcps failures.
  		 */
  		h_gethostcps_r(host,now);
  	    }
***************
*** 947,960 ****
  retry:
      code = 0;
      identP = (struct Identity *)rx_GetSpecific(tcon, rxcon_ident_key);
!     host = h_Lookup_r(haddr, hport);
      if (host &amp;&amp; !identP &amp;&amp; !(host-&gt;Console&amp;1)) {
  	/* This is a new connection, and we already have a host
  	 * structure for this address. Verify that the identity
  	 * of the caller matches the identity in the host structure.
  	 */
- 	if (!(held = h_Held_r(host)))
- 		h_Hold_r(host);
  	h_Lock_r(host);
  	if ( !(host-&gt;hostFlags &amp; ALTADDR) )
  	{
--- 966,977 ----
  retry:
      code = 0;
      identP = (struct Identity *)rx_GetSpecific(tcon, rxcon_ident_key);
!     host = h_Lookup_r(haddr, hport, &amp;held);
      if (host &amp;&amp; !identP &amp;&amp; !(host-&gt;Console&amp;1)) {
  	/* This is a new connection, and we already have a host
  	 * structure for this address. Verify that the identity
  	 * of the caller matches the identity in the host structure.
  	 */
  	h_Lock_r(host);
  	if ( !(host-&gt;hostFlags &amp; ALTADDR) )
  	{
***************
*** 970,976 ****
  	code = RXAFSCB_WhoAreYou(host-&gt;callback_rxcon, &amp;interf);
  	H_LOCK
  	if ( code == RXGEN_OPCODE ) {
! 		identP = (struct Identity *)malloc(1);
  		identP-&gt;valid = 0;
  		rx_SetSpecific(tcon, rxcon_ident_key, identP);
  		/* The host on this connection was unable to respond to 
--- 987,993 ----
  	code = RXAFSCB_WhoAreYou(host-&gt;callback_rxcon, &amp;interf);
  	H_LOCK
  	if ( code == RXGEN_OPCODE ) {
! 		identP = (struct Identity *)malloc(sizeof(struct Identity));
  		identP-&gt;valid = 0;
  		rx_SetSpecific(tcon, rxcon_ident_key, identP);
  		/* The host on this connection was unable to respond to 
***************
*** 1016,1023 ****
  	host-&gt;hostFlags |= ALTADDR;
  	h_Unlock_r(host);
      } else if (host) {
- 	if (!(held = h_Held_r(host)))
- 		h_Hold_r(host);
  	if ( ! (host-&gt;hostFlags &amp; ALTADDR) ) 
  	{
          	/* another thread is doing the initialisation */
--- 1033,1038 ----
***************
*** 1057,1063 ****
  		code = RXAFSCB_WhoAreYou(host-&gt;callback_rxcon, &amp;interf);
  		H_LOCK
  		if ( code == RXGEN_OPCODE ) {
! 		    identP = (struct Identity *)malloc(1);
  		    identP-&gt;valid = 0;
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
  		    ViceLog(25,
--- 1072,1078 ----
  		code = RXAFSCB_WhoAreYou(host-&gt;callback_rxcon, &amp;interf);
  		H_LOCK
  		if ( code == RXGEN_OPCODE ) {
! 		  identP = (struct Identity *)malloc(sizeof(struct Identity));
  		    identP-&gt;valid = 0;
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
  		    ViceLog(25,
Index: openafs/src/vlserver/vldbint.xg
diff -c openafs/src/vlserver/vldbint.xg:1.2.8.2 openafs/src/vlserver/vldbint.xg:1.2.8.3
*** openafs/src/vlserver/vldbint.xg:1.2.8.2	Sun Apr 21 00:01:55 2002
--- openafs/src/vlserver/vldbint.xg	Sat Jun  8 07:01:12 2002
***************
*** 15,21 ****
  %#include	"vl_opcodes.h"	/* directly to other places */
  
  %#ifdef KERNEL
! %#define	xdr_array(a,b,c,d,e,f)	xdr_arrayN(a,b,c,d,e,f)
  %#include "../afs/longc_procs.h"
  %#endif
  
--- 15,21 ----
  %#include	"vl_opcodes.h"	/* directly to other places */
  
  %#ifdef KERNEL
! %#define	afs_xdr_array(a,b,c,d,e,f)	afs_xdr_arrayN(a,b,c,d,e,f)
  %#include "../afs/longc_procs.h"
  %#endif
  
Index: openafs/src/vol/ihandle.c
diff -c openafs/src/vol/ihandle.c:1.4.4.2 openafs/src/vol/ihandle.c:1.4.4.3
*** openafs/src/vol/ihandle.c:1.4.4.2	Sun Apr 21 16:27:47 2002
--- openafs/src/vol/ihandle.c	Fri Jun  7 20:15:35 2002
***************
*** 14,20 ****
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/vol/ihandle.c,v 1.4.4.2 2002/04/21 20:27:47 zacheiss Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
--- 14,20 ----
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /data/cvs/openafs/src/vol/ihandle.c,v 1.4.4.3 2002/06/08 00:15:35 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
***************
*** 259,268 ****
  
      IH_LOCK
  
-     if (!ih_Inited) {
- 	ih_Initialize();
-     }
- 
      /* Do we already have an open file handle for this Inode? */
      for (fdP = ihP-&gt;ih_fdtail ; fdP != NULL ; fdP = fdP-&gt;fd_ihprev) {
  	if (fdP-&gt;fd_status != FD_HANDLE_INUSE) {
--- 259,264 ----
***************
*** 298,304 ****
  	assert(fdP-&gt;fd_status == FD_HANDLE_OPEN);
  	DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
  	DLL_DELETE(fdP, fdP-&gt;fd_ih-&gt;ih_fdhead, fdP-&gt;fd_ih-&gt;ih_fdtail,
! 		   fd_ihnext, fd_ihprev);
  	closeFd = fdP-&gt;fd_fd;
      } else {
  	if (fdAvailHead == NULL) {
--- 294,300 ----
  	assert(fdP-&gt;fd_status == FD_HANDLE_OPEN);
  	DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
  	DLL_DELETE(fdP, fdP-&gt;fd_ih-&gt;ih_fdhead, fdP-&gt;fd_ih-&gt;ih_fdtail,
!             fd_ihnext, fd_ihprev);
  	closeFd = fdP-&gt;fd_fd;
      } else {
  	if (fdAvailHead == NULL) {
***************
*** 313,318 ****
--- 309,317 ----
      fdP-&gt;fd_status = FD_HANDLE_INUSE;
      fdP-&gt;fd_fd = fd;
      fdP-&gt;fd_ih = ihP;
+ 
+     ihP-&gt;ih_refcnt++;
+ 
      /* Add this handle to the Inode's list of open descriptors */
      DLL_INSERT_TAIL(fdP, ihP-&gt;ih_fdhead, ihP-&gt;ih_fdtail, fd_ihnext, fd_ihprev);
  
***************
*** 323,329 ****
  	fdInUseCount -= 1;
      }
  
-     ihP-&gt;ih_refcnt++;
      IH_UNLOCK
      return fdP;
  }
--- 322,327 ----
***************
*** 340,380 ****
  	return 0;
  
      IH_LOCK
      assert(ih_Inited);
      assert(fdInUseCount &gt; 0);
      assert(fdP-&gt;fd_status == FD_HANDLE_INUSE);
  
      ihP = fdP-&gt;fd_ih;
  
!     /* If a previous attempt to close  ( ih_reallyclose() )
!      * all fd handles failed, then the IH_REALLY_CLOSED flag is set in
!      * the Inode handle so we call fd_reallyclose
       */
! 
!     if ( ihP-&gt;ih_flags &amp; IH_REALLY_CLOSED ) {
! 	IH_UNLOCK
! 	return (fd_reallyclose(fdP));
!     }
! 
!     /* If we have too many open files then close the descriptor. If we
!      * hold the last reference to the Inode handle then wait and let
!      * ih_release do the work.  */
!     if (fdInUseCount &gt; fdCacheSize &amp;&amp; ihP-&gt;ih_refcnt &gt; 1) {
! 	assert(fdInUseCount &gt; 0);
! 	closeFd = fdP-&gt;fd_fd;
! 	DLL_DELETE(fdP, fdP-&gt;fd_ih-&gt;ih_fdhead, fdP-&gt;fd_ih-&gt;ih_fdtail,
! 		   fd_ihnext, fd_ihprev);
! 	DLL_INSERT_TAIL(fdP, fdAvailHead, fdAvailTail, fd_next, fd_prev);
! 	fdP-&gt;fd_status = FD_HANDLE_AVAIL;
! 	fdP-&gt;fd_ih = NULL;
! 	fdP-&gt;fd_fd = INVALID_FD;
! 	ihP-&gt;ih_refcnt--;
  	IH_UNLOCK
! 	OS_CLOSE(closeFd);
! 	IH_LOCK
! 	fdInUseCount -= 1;
! 	IH_UNLOCK
! 	return 0;
      }
  
      /* Put this descriptor back into the cache */
--- 338,358 ----
  	return 0;
  
      IH_LOCK
+ 
      assert(ih_Inited);
      assert(fdInUseCount &gt; 0);
      assert(fdP-&gt;fd_status == FD_HANDLE_INUSE);
  
      ihP = fdP-&gt;fd_ih;
  
!     /* Call fd_reallyclose to really close the unused file handles if
!      * the previous attempt to close (ih_reallyclose()) all file handles
!      * failed (this is determined by checking the ihandle for the flag
!      * IH_REALLY_CLOSED) or we have too many open files.
       */
!     if (ihP-&gt;ih_flags &amp; IH_REALLY_CLOSED || fdInUseCount &gt; fdCacheSize) {
  	IH_UNLOCK
! 	return fd_reallyclose(fdP);
      }
  
      /* Put this descriptor back into the cache */
***************
*** 382,388 ****
      DLL_INSERT_TAIL(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
  
      /* If this is not the only reference to the Inode then we can decrement
!      * the reference count, otherwise we need to call ih_release. */
      if (ihP-&gt;ih_refcnt &gt; 1) {
  	ihP-&gt;ih_refcnt--;
  	IH_UNLOCK
--- 360,367 ----
      DLL_INSERT_TAIL(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
  
      /* If this is not the only reference to the Inode then we can decrement
!      * the reference count, otherwise we need to call ih_release.
!      */
      if (ihP-&gt;ih_refcnt &gt; 1) {
  	ihP-&gt;ih_refcnt--;
  	IH_UNLOCK
***************
*** 395,401 ****
  }
  
  /*
!  * Return a file descriptor handle to the cache
   */
  int fd_reallyclose(FdHandle_t *fdP)
  {
--- 374,381 ----
  }
  
  /*
!  * Actually close the file descriptor handle and return it to
!  * the free list.
   */
  int fd_reallyclose(FdHandle_t *fdP)
  {
***************
*** 406,411 ****
--- 386,392 ----
  	return 0;
  
      IH_LOCK
+ 
      assert(ih_Inited);
      assert(fdInUseCount &gt; 0);
      assert(fdP-&gt;fd_status == FD_HANDLE_INUSE);
***************
*** 413,427 ****
      ihP = fdP-&gt;fd_ih;
      closeFd = fdP-&gt;fd_fd;
  
!     DLL_DELETE(fdP, fdP-&gt;fd_ih-&gt;ih_fdhead, fdP-&gt;fd_ih-&gt;ih_fdtail,
! 	       fd_ihnext, fd_ihprev);
      DLL_INSERT_TAIL(fdP, fdAvailHead, fdAvailTail, fd_next, fd_prev);
      fdP-&gt;fd_status = FD_HANDLE_AVAIL;
      fdP-&gt;fd_ih = NULL;
      fdP-&gt;fd_fd = INVALID_FD;
      IH_UNLOCK
      OS_CLOSE(closeFd);
      IH_LOCK
      fdInUseCount -= 1;
  
      /* If this is not the only reference to the Inode then we can decrement
--- 394,418 ----
      ihP = fdP-&gt;fd_ih;
      closeFd = fdP-&gt;fd_fd;
  
!     DLL_DELETE(fdP, ihP-&gt;ih_fdhead, ihP-&gt;ih_fdtail, fd_ihnext, fd_ihprev);
      DLL_INSERT_TAIL(fdP, fdAvailHead, fdAvailTail, fd_next, fd_prev);
+ 
      fdP-&gt;fd_status = FD_HANDLE_AVAIL;
      fdP-&gt;fd_ih = NULL;
      fdP-&gt;fd_fd = INVALID_FD;
+ 
+     /* All the file descriptor handles have been closed; reset
+      * the IH_REALLY_CLOSED flag indicating that ih_reallyclose
+      * has completed its job.
+      */
+     if (!ihP-&gt;ih_fdhead) {
+         ihP-&gt;ih_flags &amp;= ~IH_REALLY_CLOSED;
+     }
+ 
      IH_UNLOCK
      OS_CLOSE(closeFd);
      IH_LOCK
+ 
      fdInUseCount -= 1;
  
      /* If this is not the only reference to the Inode then we can decrement
***************
*** 433,438 ****
--- 424,430 ----
  	IH_UNLOCK
  	ih_release(ihP);
      }
+ 
      return 0;
  }
  
***************
*** 658,820 ****
      return retval;
  }
  
! /* Close all cached file descriptors for this inode. */
! int ih_reallyclose(IHandle_t *ihP)
  {
!     int closeCount;
!     FdHandle_t *fdP;
!     FdHandle_t *head, *tail;
! 
!     if (!ihP)
! 	return 0;
  
-     IH_LOCK
- 
      assert(ihP-&gt;ih_refcnt &gt; 0);
  
      /*
       * Remove the file descriptors for this Inode from the LRU queue
!      * and put them on a temporary queue so we drop the lock before
!      * we close the files.
       */
!     DLL_INIT_LIST(head, tail);
!     for (fdP = ihP-&gt;ih_fdhead ; fdP != NULL ; fdP = fdP-&gt;fd_ihnext) {
! 	if (fdP-&gt;fd_status == FD_HANDLE_OPEN) {
! 	    assert(fdP-&gt;fd_ih == ihP);
! 	    DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
! 	    DLL_INSERT_TAIL(fdP, head, tail, fd_next, fd_prev);
! 	} else {
! 	    ihP-&gt;ih_flags |= IH_REALLY_CLOSED;
! 	}
      }
-     
-     /*
-      * If we found any file descriptors in use, then we dont zero out
-      * fdhead and fdtail, since ih_reallyclose() will be called again on this
-      * Inode handle
-      */
  
!     if ( ! (ihP-&gt;ih_flags &amp; IH_REALLY_CLOSED) )
! 	DLL_INIT_LIST(ihP-&gt;ih_fdhead, ihP-&gt;ih_fdtail);
  
      if (head == NULL) {
! 	IH_UNLOCK
! 	return 0;
      }
  
      /*
       * Close the file descriptors
       */
      closeCount = 0;
!     for (fdP = head ; fdP != NULL ; fdP = fdP-&gt;fd_ihnext) {
! 	IH_UNLOCK
! 	OS_CLOSE(fdP-&gt;fd_fd);
! 	IH_LOCK
! 	assert(fdInUseCount &gt; 0);
! 	fdInUseCount -= 1;
! 	fdP-&gt;fd_status = FD_HANDLE_AVAIL;
! 	fdP-&gt;fd_fd = INVALID_FD;
! 	fdP-&gt;fd_ih = NULL;
! 	closeCount++;
      }
  
      /*
       * Append the temporary queue to the list of available descriptors
       */
      if (fdAvailHead == NULL) {
! 	fdAvailHead = head;
! 	fdAvailTail = tail;
      } else {
! 	fdAvailTail-&gt;fd_next = head;
! 	head-&gt;fd_prev = fdAvailTail;
! 	fdAvailTail = tail;
      }
      IH_UNLOCK
  
      return 0;
  }
  
  /* Release an Inode handle. All cached file descriptors for this
!  * inode are closed when the last reference to this handle is released */
  int ih_release(IHandle_t *ihP)
  {
-     int closeCount;
-     FdHandle_t *fdP;
-     FdHandle_t *head, *tail;
      int ihash;
  
      if (!ihP)
! 	return 0;
  
      IH_LOCK
  
!     /**
!       * If the IH_REALLY_CLOSED flag is set then clear it here before adding
!       * the Inode handle to the available queue
!       */
!     if ( ihP-&gt;ih_flags &amp; IH_REALLY_CLOSED )
! 	ihP-&gt;ih_flags &amp;= ~IH_REALLY_CLOSED;
  
!     ihP-&gt;ih_refcnt--;
!     if (ihP-&gt;ih_refcnt &gt; 0) {
! 	IH_UNLOCK
! 	return 0;
      }
  
-     assert(ihP-&gt;ih_refcnt == 0);
- 
      ihash = IH_HASH(ihP-&gt;ih_dev, ihP-&gt;ih_vid, ihP-&gt;ih_ino);
      DLL_DELETE(ihP, ihashTable[ihash].ihash_head,
! 	       ihashTable[ihash].ihash_tail, ih_next, ih_prev);
! 
!     /*
!      * Remove the file descriptors for this Inode from the LRU queue
!      * and put them on a temporary queue so we drop the lock before
!      * we close the files.
!      */
!     DLL_INIT_LIST(head, tail);
!     for (fdP = ihP-&gt;ih_fdhead ; fdP != NULL ; fdP = fdP-&gt;fd_ihnext) {
! 	assert(fdP-&gt;fd_status == FD_HANDLE_OPEN);
! 	assert(fdP-&gt;fd_ih == ihP);
! 	DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
! 	DLL_INSERT_TAIL(fdP, head, tail, fd_next, fd_prev);
!     }
!     DLL_INIT_LIST(ihP-&gt;ih_fdhead, ihP-&gt;ih_fdtail);
  
!     if (head == NULL) {
! 	DLL_INSERT_TAIL(ihP, ihAvailHead, ihAvailTail, ih_next, ih_prev);
! 	IH_UNLOCK
! 	return 0;
!     }
  
!     /*
!      * Close the file descriptors
!      */
!     closeCount = 0;
!     for (fdP = head ; fdP != NULL ; fdP = fdP-&gt;fd_ihnext) {
! 	IH_UNLOCK
! 	OS_CLOSE(fdP-&gt;fd_fd);
! 	IH_LOCK
! 	assert(fdInUseCount &gt; 0);
! 	fdInUseCount -= 1;
! 	fdP-&gt;fd_status = FD_HANDLE_AVAIL;
! 	fdP-&gt;fd_fd = INVALID_FD;
! 	fdP-&gt;fd_ih = NULL;
! 	closeCount++;
!     }
  
-     /*
-      * Append the temporary queue to the list of available descriptors
-      */
-     if (fdAvailHead == NULL) {
- 	fdAvailHead = head;
- 	fdAvailTail = tail;
-     } else {
- 	fdAvailTail-&gt;fd_next = head;
- 	head-&gt;fd_prev = fdAvailTail;
- 	fdAvailTail = tail;
-     }
      DLL_INSERT_TAIL(ihP, ihAvailHead, ihAvailTail, ih_next, ih_prev);
      IH_UNLOCK
  
      return 0;
--- 650,785 ----
      return retval;
  }
  
! /* Close all unused file descriptors associated with the inode
!  * handle. Called with IH_LOCK held. May drop and reacquire
!  * IH_LOCK. Sets the IH_REALLY_CLOSED flag in the inode handle
!  * if it fails to close all file handles.
!  */
! static int ih_fdclose(IHandle_t *ihP)
  {
!     int closeCount, closedAll;
!     FdHandle_t *fdP, *head, *tail, *next;
  
      assert(ihP-&gt;ih_refcnt &gt; 0);
  
+     closedAll = 1;
+     DLL_INIT_LIST(head, tail);
+     ihP-&gt;ih_flags &amp;= ~IH_REALLY_CLOSED;
+ 
      /*
       * Remove the file descriptors for this Inode from the LRU queue
!      * and the IHandle queue and put them on a temporary queue so we
!      * can drop the lock before we close the files.
       */
!     for (fdP = ihP-&gt;ih_fdhead; fdP != NULL; fdP = next) {
!         next = fdP-&gt;fd_ihnext;
!         assert(fdP-&gt;fd_ih == ihP);
!         assert(fdP-&gt;fd_status == FD_HANDLE_OPEN ||
!                fdP-&gt;fd_status == FD_HANDLE_INUSE);
!         if (fdP-&gt;fd_status == FD_HANDLE_OPEN) {
!             DLL_DELETE(fdP, ihP-&gt;ih_fdhead, ihP-&gt;ih_fdtail,
!                 fd_ihnext, fd_ihprev);
!             DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
!             DLL_INSERT_TAIL(fdP, head, tail, fd_next, fd_prev);
!         } else {
!             closedAll = 0;
!             ihP-&gt;ih_flags |= IH_REALLY_CLOSED;
!         }
      }
  
!     /* If the ihandle reference count is 1, we should have
!      * closed all file descriptors.
!      */
!     if (ihP-&gt;ih_refcnt == 1 || closedAll) {
!         assert(closedAll);
!         assert(!ihP-&gt;ih_fdhead);
!         assert(!ihP-&gt;ih_fdtail);
!     }
  
      if (head == NULL) {
!         return 0;       /* No file descriptors closed */
      }
  
+     IH_UNLOCK
+ 
      /*
       * Close the file descriptors
       */
      closeCount = 0;
!     for (fdP = head; fdP != NULL; fdP = fdP-&gt;fd_next) {
!         OS_CLOSE(fdP-&gt;fd_fd);
!         fdP-&gt;fd_status = FD_HANDLE_AVAIL;
!         fdP-&gt;fd_fd = INVALID_FD;
!         fdP-&gt;fd_ih = NULL;
!         closeCount++;
      }
  
+     IH_LOCK
+ 
+     assert(fdInUseCount &gt;= closeCount);
+     fdInUseCount -= closeCount;
+ 
      /*
       * Append the temporary queue to the list of available descriptors
       */
      if (fdAvailHead == NULL) {
!         fdAvailHead = head;
!         fdAvailTail = tail;
      } else {
!         fdAvailTail-&gt;fd_next = head;
!         head-&gt;fd_prev = fdAvailTail;
!         fdAvailTail = tail;
      }
+ 
+     return 0;
+ }
+ 
+ /* Close all cached file descriptors for this inode. */
+ int ih_reallyclose(IHandle_t *ihP)
+ {
+     if (!ihP)
+         return 0;
+ 
+     IH_LOCK
+ 
+     assert(ihP-&gt;ih_refcnt &gt; 0);
+     ih_fdclose(ihP);
+ 
      IH_UNLOCK
  
      return 0;
  }
  
  /* Release an Inode handle. All cached file descriptors for this
!  * inode are closed when the last reference to this handle is released
!  */
  int ih_release(IHandle_t *ihP)
  {
      int ihash;
  
      if (!ihP)
!         return 0;
  
      IH_LOCK
  
!     assert(ihP-&gt;ih_refcnt &gt; 0);
  
!     if (ihP-&gt;ih_refcnt &gt; 1) {
!         ihP-&gt;ih_refcnt--;
!         IH_UNLOCK
!         return 0;
      }
  
      ihash = IH_HASH(ihP-&gt;ih_dev, ihP-&gt;ih_vid, ihP-&gt;ih_ino);
      DLL_DELETE(ihP, ihashTable[ihash].ihash_head,
!         ihashTable[ihash].ihash_tail, ih_next, ih_prev);
  
!     ih_fdclose(ihP);
  
!     ihP-&gt;ih_refcnt--;
  
      DLL_INSERT_TAIL(ihP, ihAvailHead, ihAvailTail, ih_next, ih_prev);
+ 
      IH_UNLOCK
  
      return 0;
</pre></body></html>