which included commits to RCS files with non-trunk default branches.
OpenAFS News -- history of user-visible changes. October 19, 2001
+* Changes incorporated in OpenAFS 1.2.5
+
+** A remote denial of service attack in the AIX and IRIX clients has
+ been fixed. Users of those platforms are strongly encouraged to
+ upgrade.
+
+** Fixed race conditions in fileserver that could result in crash.
+
* Changes incorporated in OpenAFS 1.2.4
** Server logfiles now more consistant about format in which hosts are
powerpc-apple-darwin5.4*)
AFS_SYSNAME="ppc_darwin_14"
;;
+ powerpc-apple-darwin5.5*)
+ AFS_SYSNAME="ppc_darwin_14"
+ ;;
sparc-sun-solaris2.5*)
AFS_SYSNAME="sun4x_55"
;;
AC_INIT(Makefile.common)
-AM_INIT_AUTOMAKE(openafs-libafs,1.2.4)
+AM_INIT_AUTOMAKE(openafs-libafs,1.2.5)
AC_CONFIG_HEADER(config/afsconfig.h)
define(OPENAFS_CONFIGURE_LIBAFS)
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.1.1.8 2002/05/10 23:44:19 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.1.1.9 2002/06/10 11:40:12 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
attrs->va_nlink = avc->m.LinkCount;
attrs->va_size = avc->m.Length;
attrs->va_atime.tv_sec = attrs->va_mtime.tv_sec = attrs->va_ctime.tv_sec =
- avc->m.Date;
+ (int)avc->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
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.1.1.7 2002/05/10 23:44:24 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.1.1.8 2002/06/10 11:40:14 hartmans Exp $");
#include "../afs/sysincludes.h" /* Standard vendor system headers */
#include "../afs/afsincludes.h" /* Afs-based standard headers */
char *unlname = newname();
ReleaseWriteLock(&adp->lock);
- code = afsrename(adp, aname, adp, unlname, acred);
+ code = afsrename(adp, aname, adp, unlname, acred, &treq);
Tnam1 = unlname;
if (!code) {
tvc->mvid = (struct VenusFid *)unlname;
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.8 2002/05/10 23:43:09 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.9 2002/06/10 11:39:52 hartmans Exp $");
#include "../afs/sysincludes.h" /*Standard vendor system headers*/
#include "../afs/afsincludes.h" /*AFS-based standard headers*/
struct rx_call *a_call,
afs_int32 a_index,
char **a_name,
- afs_int32 *a_hosts)
+ serverList *a_hosts)
{
afs_int32 i, j;
struct cell *tcell;
#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(&afs_xcell);
-
tcell = afs_GetCellByIndex(a_index, READ_LOCK, 0);
if (!tcell) {
i = 0;
+ a_hosts->serverList_val = 0;
+ a_hosts->serverList_len = 0;
} else {
p_name = tcell->cellName;
- for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++) {
- a_hosts[j] = ntohl(tcell->cellHosts[j]->addr->sa_ip);
- }
+ for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++)
+ ;
i = strlen(p_name);
+ a_hosts->serverList_val = (afs_int32 *)afs_osi_Alloc(j*sizeof(afs_int32));
+ a_hosts->serverList_len = j;
+ for (j = 0 ; j < AFSMAXCELLHOSTS && tcell->cellHosts[j] ; j++)
+ a_hosts->serverList_val[j] = ntohl(tcell->cellHosts[j]->addr->sa_ip);
afs_PutCell(tcell, READ_LOCK);
}
- t_name = (char *)rxi_Alloc(i+1);
+ t_name = (char *)afs_osi_Alloc(i+1);
if (t_name == NULL) {
- ReleaseReadLock(&afs_xcell);
+ afs_osi_Free(a_hosts->serverList_val, (j*sizeof(afs_int32)));
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
if (p_name)
memcpy(t_name, p_name, i);
- ReleaseReadLock(&afs_xcell);
-
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
plen = strlen(p_name);
else
plen = 0;
- t_name = (char *)rxi_Alloc(plen+1);
+ t_name = (char *)afs_osi_Alloc(plen+1);
if (t_name == NULL) {
ReleaseReadLock(&afs_xcell);
#ifdef RX_ENABLE_LOCKS
* Currently only support version 1
*/
allocsize = sizeof(cm_initparams_v1);
- t_config = (afs_uint32 *)rxi_Alloc(allocsize);
+ t_config = (afs_uint32 *)afs_osi_Alloc(allocsize);
if (t_config == NULL) {
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_segments.c,v 1.1.1.6 2002/01/22 19:48:00 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_segments.c,v 1.1.1.7 2002/06/10 11:39:56 hartmans Exp $");
#include "../afs/sysincludes.h" /*Standard vendor system headers*/
#include "../afs/afsincludes.h" /*AFS-based standard headers*/
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;
* one which has the writing bit turned on. */
}
if (!code) {
- struct AFSFetchStatus OutStatus;
struct AFSVolSync tsync;
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
hadd32(newDV, 1);
XSTATS_END_TIME;
-
- /* Now copy out return params */
- UpgradeSToWLock(&avc->lock,28); /* keep out others for a while */
- if (!code) { /* must wait til RPC completes to be sure of this info */
- afs_ProcessFS(avc, &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(&avc->lock);
+ if (!code) doProcessFS = 1; /* Flag to run afs_ProcessFS() later on */
}
if (tcall) {
#ifdef RX_ENABLE_LOCKS
lockedPutDCache(tdc);
}
+ if (doProcessFS) {
+ /* Now copy out return params */
+ UpgradeSToWLock(&avc->lock,28); /* keep out others for a while */
+ afs_ProcessFS(avc, &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(&avc->lock);
+ doProcessFS = 0;
+ }
+
if (code) {
for (j++; j<=high; j++)
if ( dcList[j] )
#endif /* AFS_SUN5_ENV */
#include "../rpc/types.h"
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
#ifdef AFS_AIX32_ENV
# include "net/spl.h"
#undef register
#endif /* AFS_ALPHA_ENV */
-#include <rpc/xdr.h>
+#include <rx/xdr.h>
#include <sys/proc.h>
#include <sys/ioctl.h>
#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header: /tmp/cvstemp/openafs/src/afsd/afsd.c,v 1.1.1.12 2002/01/22 19:52:07 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afsd/afsd.c,v 1.1.1.13 2002/06/10 11:44:53 hartmans Exp $");
#define VFS 1
* Cold shutdown is the default
*/
printf("afsd: Shutting down all afs processes and afs state\n");
- call_syscall(AFSOP_SHUTDOWN, 1);
+ code = call_syscall(AFSOP_SHUTDOWN, 1);
+ if (code) {
+ printf("afsd: AFS still mounted; Not shutting down\n");
+ exit(1);
+ }
exit(0);
}
if (as->parms[21].items) {
#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header: /tmp/cvstemp/openafs/src/des/crypt.c,v 1.1.1.5 2001/09/11 14:32:29 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/des/crypt.c,v 1.1.1.6 2002/06/10 11:45:53 hartmans Exp $");
#ifdef AFS_NT40_ENV
#include <windows.h>
* 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)
+#if !defined(cray) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
#define LONG_IS_32_BITS
#endif
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;
#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header: /tmp/cvstemp/openafs/src/dir/buffer.c,v 1.1.1.8 2002/05/10 23:58:41 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/dir/buffer.c,v 1.1.1.9 2002/06/10 11:45:57 hartmans Exp $");
#include <stdlib.h>
#include <lock.h>
if ( tb = phTable[pHash(fid)] ) { /* ASSMT HERE */
if (bufmatch(tb)) {
ObtainWriteLock(&tb->lock);
- ReleaseWriteLock(&afs_bufferLock);
tb->lockers++;
+ ReleaseWriteLock(&afs_bufferLock);
tb->accesstime = ++timecounter;
ReleaseWriteLock(&tb->lock);
return tb->data;
if (bufmatch(tb2)) {
buf_Front(bufhead,tb,tb2);
ObtainWriteLock(&tb2->lock);
- ReleaseWriteLock(&afs_bufferLock);
tb2->lockers++;
+ ReleaseWriteLock(&afs_bufferLock);
tb2->accesstime = ++timecounter;
ReleaseWriteLock(&tb2->lock);
return tb2->data;
if (bufmatch(tb)) {
buf_Front(bufhead,tb2,tb);
ObtainWriteLock(&tb->lock);
- ReleaseWriteLock(&afs_bufferLock);
tb->lockers++;
+ ReleaseWriteLock(&afs_bufferLock);
tb->accesstime = ++timecounter;
ReleaseWriteLock(&tb->lock);
return tb->data;
tb = newslot(fid, page, (tb ? tb : tb2));
ios++;
ObtainWriteLock(&tb->lock);
- ReleaseWriteLock(&afs_bufferLock);
tb->lockers++;
+ ReleaseWriteLock(&afs_bufferLock);
if (ReallyRead(tb->fid,tb->page,tb->data)) {
tb->lockers--;
FidZap(tb->fid); /* disaster */
ObtainWriteLock(&afs_bufferLock);
tb = newslot(fid,page,0);
ObtainWriteLock(&tb->lock);
- ReleaseWriteLock(&afs_bufferLock);
tb->lockers++;
+ ReleaseWriteLock(&afs_bufferLock);
ReleaseWriteLock(&tb->lock);
return tb->data;
}
#include <afs/param.h>
#endif
-RCSID("$Header: /tmp/cvstemp/openafs/src/fsint/afsaux.c,v 1.1.1.5 2001/07/14 22:21:55 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/fsint/afsaux.c,v 1.1.1.6 2002/06/10 11:45:59 hartmans Exp $");
#ifdef KERNEL
#if defined(UKERNEL)
#else
#include "../h/types.h"
#include "../rpc/types.h"
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
#endif
#if !defined(AFS_ALPHA_ENV)
#ifndef XDR_GETINT32
#define XDR_PUTINT32 XDR_PUTLONG
#endif
#endif
-#ifndef AFS_LINUX22_ENV
-#include "../rpc/auth.h"
-#endif
#endif /* defined(UKERNEL) */
#include "../afsint/afsint.h"
#else /* KERNEL */
%#define SymbolicLink 3
%#ifdef KERNEL
-%#define xdr_array(a,b,c,d,e,f) xdr_arrayN(a,b,c,d,e,f)
+%#define afs_xdr_array(a,b,c,d,e,f) afs_xdr_arrayN(a,b,c,d,e,f)
%#endif
struct BD {
};
const AFSMAXCELLHOSTS = 8; /*Max VLDB servers per cell*/
-typedef afs_int32 serverList[AFSMAXCELLHOSTS];
+typedef afs_int32 serverList<AFSMAXCELLHOSTS>;
typedef afs_uint32 cacheConfig<>;
osi_misc.o \
osi_sleep.o \
osi_timeout.o \
- osi_vm.o \
- xdr.o \
- xdr_array.o \
- xdr_int64.o
+ osi_vm.o
AFSNOIAUTHOBJS = \
afs_call.o \
# 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
#/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */
-# $Header: /tmp/cvstemp/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.1.1.4 2001/10/14 18:05:40 hartmans Exp $
+# $Header: /tmp/cvstemp/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.1.1.5 2002/06/10 11:46:33 hartmans Exp $
#
# MakefileProto for Digital Unix systems
#
osi_sleep.o \
osi_vm.o \
osi_vnodeops.o \
- osi_module.o \
- xdr.o \
- xdr_array.o \
- xdr_int64.o
+ osi_module.o
#AFS_OS_NFSOBJS = osi_vfsops_nfs.o
$(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)
osi_misc.o \
osi_sleep.o \
osi_vm.o \
- osi_vnodeops.o \
- xdr_int64.o
+ osi_vnodeops.o
AFS_OS_NFSOBJS = \
osi_vfsops_nfs.o
$(CRULE1)
osi_vnodeops.o: $(AFS)/osi_vnodeops.c
$(CRULE1)
-xdr_int64.o: $(RX)/xdr_int64.c
- $(CRULE1)
osi_misc.o \
osi_sleep.o \
osi_vnodeops.o \
- osi_vm.o \
- xdr_int64.o
+ osi_vm.o
AFS_OS_NFSOBJS = \
osi_vfsops_nfs.o
$(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
# examination of AFS structures in a dump.
osi_misc.o \
osi_sleep.o \
osi_vm.o \
- osi_vnodeops.o \
- xdr_int64.o
+ osi_vnodeops.o
AFS_OS_NFSOBJS = \
osi_vfsops_nfs.o
$(CRULE1)
osi_vnodeops.o: $(AFS)/osi_vnodeops.c
$(CRULE1)
-xdr_int64.o: $(RX)/xdr_int64.c
- $(CRULE1)
osi_misc.o \
osi_sleep.o \
osi_vm.o \
- osi_vnodeops.o \
- xdr_int64.o
+ osi_vnodeops.o
AFS_OS_NFSOBJS = \
osi_vfsops_nfs.o
$(CRULE1)
osi_vnodeops.o: $(AFS)/osi_vnodeops.c
$(CRULE1)
-xdr_int64.o: $(RX)/xdr_int64.c
- $(CRULE1)
osi_file.o \
osi_sleep.o \
osi_vm.o \
- osi_vnodeops.o \
- xdr_int64.o
+ osi_vnodeops.o
AFS_OS_NFSOBJS = \
osi_vfsops_nfs.o
$(CRULE1)
osi_vnodeops.o: $(AFS)/osi_vnodeops.c
$(CRULE1)
-xdr_int64.o: $(RX)/xdr_int64.c
- $(CRULE1)
#include <afsconfig.h>
#include "../afs/param.h"
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_kcommon.c,v 1.1.1.11 2002/05/11 00:01:27 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_kcommon.c,v 1.1.1.12 2002/06/10 11:47:11 hartmans Exp $");
#include "../rx/rx_kcommon.h"
*/
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;
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
rxk_ListenerPid = current_proc()->p_pid;
#endif
-#if defined(RX_ENABLE_LOCKS)
+#if defined(RX_ENABLE_LOCKS) && !defined(AFS_SUN5_ENV)
AFS_GUNLOCK();
-#endif /* RX_ENABLE_LOCKS */
+#endif /* RX_ENABLE_LOCKS && !AFS_SUN5_ENV */
while (afs_termState != AFSOP_STOP_RXK_LISTENER) {
if (rxp) {
#if defined(AFS_LINUX22_ENV) || defined(AFS_SUN5_ENV)
afs_osi_Wakeup(&rxk_ListenerPid);
#endif
+#ifdef AFS_SUN5_ENV
+ AFS_GUNLOCK();
+#ifdef HAVE_P_COREFILE
+ if (!curproc->p_corefile) /* newproc doesn't set it, but exit frees it */
+ curproc->p_corefile = refstr_alloc("core");
+#endif
+ exit(CLD_EXITED, 0);
+#endif /* AFS_SUN5_ENV */
}
#if !defined(AFS_LINUX20_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
#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/xdr.h"
#include "../rx/rx.h"
#include "../rx/rx_globals.h"
#include "../afs/longc_procs.h"
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 <sys/types.h>
#endif
#include <afsconfig.h>
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_rx.c,v 1.1.1.4 2001/07/11 03:10:58 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_rx.c,v 1.1.1.5 2002/06/10 11:47:16 hartmans Exp $");
#ifdef KERNEL
#ifndef UKERNEL
#define u_quad_t __u_quad_t
#endif
#endif
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
#include "../netinet/in.h"
#else /* !UKERNEL */
#include "../afs/sysincludes.h"
#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_main.c,v 1.1.1.9 2001/10/14 18:06:33 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxgen/rpc_main.c,v 1.1.1.10 2002/06/10 11:47:26 hartmans Exp $");
#include <limits.h>
#include <stdio.h>
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 <rx/xdr.h>\n");
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");
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");
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");
#include <afs/param.h>
#endif
-RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_client.c,v 1.1.1.7 2001/10/14 18:06:35 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_client.c,v 1.1.1.8 2002/06/10 11:47:28 hartmans Exp $");
#ifdef KERNEL
#include "../afs/stds.h"
#endif /* !UKERNEL */
#ifndef AFS_LINUX22_ENV
#include "../rpc/types.h"
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
#endif
#include "../rx/rx.h"
#else /* ! KERNEL */
#include <afs/param.h>
#endif
-RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_common.c,v 1.1.1.8 2002/05/11 00:01:51 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_common.c,v 1.1.1.9 2002/06/10 11:47:28 hartmans Exp $");
#ifdef KERNEL
#ifndef UKERNEL
#include "../h/time.h"
#ifndef AFS_LINUX22_ENV
#include "../rpc/types.h"
-#include "../rpc/xdr.h"
+#include "../rx/xdr.h"
#endif /* AFS_LINUX22_ENV */
#else /* !UKERNEL */
#include "../afs/sysincludes.h"
$(DESTDIR)\include\afs\dirent.h: dirent_nt.h
$(COPY) $** $@
-$(DESTDIR)\include\afs\dirpath.h: dirpath.hin
+$(DESTDIR)\include\afs\dirpath.h: dirpath_nt.h
$(COPY) $** $@
LIBFILE = $(DESTDIR)\lib\afs\afsutil.lib
#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header: /tmp/cvstemp/openafs/src/viced/host.c,v 1.1.1.9 2002/05/11 00:03:28 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/viced/host.c,v 1.1.1.10 2002/06/10 11:48:32 hartmans Exp $");
#include <stdio.h>
#include <errno.h>
register afs_uint32 hostaddr, hport; /* net byte order */
{
register struct host *host;
+ int held;
H_LOCK
- host = h_Lookup_r(hostaddr, hport);
+ host = h_Lookup_r(hostaddr, hport, &held);
if (host) {
host->hcpsfailed = 1;
}
+ if (!held)
+ h_Release_r(host);
H_UNLOCK
return;
/* Lookup a host given an IP address and UDP port number. */
-struct host *h_Lookup(hostaddr, hport)
+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);
+ retVal = h_Lookup_r(hostaddr, hport, heldp);
H_UNLOCK
return retVal;
}
-struct host *h_Lookup_r(hostaddr, hport)
+/* 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;
register index = h_HashIndex(hostaddr);
extern int hostaclRefresh;
+restart:
for (chain=hostHashTable[index]; chain; chain=chain->next) {
host = chain->hostPtr;
assert(host);
if (!(host->hostFlags & HOSTDELETED) && chain->addr == hostaddr
&& host->port == hport) {
+ *heldp = h_Held_r(host);
+ if (!*heldp)
+ h_Hold_r(host);
+ h_Lock_r(host);
+ if (host->hostFlags & 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->hcpsfailed || (host->cpsCall+hostaclRefresh < 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
+ * 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);
}
retry:
code = 0;
identP = (struct Identity *)rx_GetSpecific(tcon, rxcon_ident_key);
- host = h_Lookup_r(haddr, hport);
+ host = h_Lookup_r(haddr, hport, &held);
if (host && !identP && !(host->Console&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->hostFlags & ALTADDR) )
{
code = RXAFSCB_WhoAreYou(host->callback_rxcon, &interf);
H_LOCK
if ( code == RXGEN_OPCODE ) {
- identP = (struct Identity *)malloc(1);
+ identP = (struct Identity *)malloc(sizeof(struct Identity));
identP->valid = 0;
rx_SetSpecific(tcon, rxcon_ident_key, identP);
/* The host on this connection was unable to respond to
host->hostFlags |= ALTADDR;
h_Unlock_r(host);
} else if (host) {
- if (!(held = h_Held_r(host)))
- h_Hold_r(host);
if ( ! (host->hostFlags & ALTADDR) )
{
/* another thread is doing the initialisation */
code = RXAFSCB_WhoAreYou(host->callback_rxcon, &interf);
H_LOCK
if ( code == RXGEN_OPCODE ) {
- identP = (struct Identity *)malloc(1);
+ identP = (struct Identity *)malloc(sizeof(struct Identity));
identP->valid = 0;
rx_SetSpecific(tcon, rxcon_ident_key, identP);
ViceLog(25,
%#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)
+%#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
#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header: /tmp/cvstemp/openafs/src/vol/ihandle.c,v 1.1.1.6 2002/05/11 00:03:40 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/vol/ihandle.c,v 1.1.1.7 2002/06/10 11:48:24 hartmans Exp $");
#include <stdio.h>
#include <sys/types.h>
IH_LOCK
- if (!ih_Inited) {
- ih_Initialize();
- }
-
/* Do we already have an open file handle for this Inode? */
for (fdP = ihP->ih_fdtail ; fdP != NULL ; fdP = fdP->fd_ihprev) {
if (fdP->fd_status != FD_HANDLE_INUSE) {
assert(fdP->fd_status == FD_HANDLE_OPEN);
DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
DLL_DELETE(fdP, fdP->fd_ih->ih_fdhead, fdP->fd_ih->ih_fdtail,
- fd_ihnext, fd_ihprev);
+ fd_ihnext, fd_ihprev);
closeFd = fdP->fd_fd;
} else {
if (fdAvailHead == NULL) {
fdP->fd_status = FD_HANDLE_INUSE;
fdP->fd_fd = fd;
fdP->fd_ih = ihP;
+
+ ihP->ih_refcnt++;
+
/* Add this handle to the Inode's list of open descriptors */
DLL_INSERT_TAIL(fdP, ihP->ih_fdhead, ihP->ih_fdtail, fd_ihnext, fd_ihprev);
fdInUseCount -= 1;
}
- ihP->ih_refcnt++;
IH_UNLOCK
return fdP;
}
return 0;
IH_LOCK
+
assert(ih_Inited);
assert(fdInUseCount > 0);
assert(fdP->fd_status == FD_HANDLE_INUSE);
ihP = fdP->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
+ /* 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->ih_flags & 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 > fdCacheSize && ihP->ih_refcnt > 1) {
- assert(fdInUseCount > 0);
- closeFd = fdP->fd_fd;
- DLL_DELETE(fdP, fdP->fd_ih->ih_fdhead, fdP->fd_ih->ih_fdtail,
- fd_ihnext, fd_ihprev);
- DLL_INSERT_TAIL(fdP, fdAvailHead, fdAvailTail, fd_next, fd_prev);
- fdP->fd_status = FD_HANDLE_AVAIL;
- fdP->fd_ih = NULL;
- fdP->fd_fd = INVALID_FD;
- ihP->ih_refcnt--;
+ if (ihP->ih_flags & IH_REALLY_CLOSED || fdInUseCount > fdCacheSize) {
IH_UNLOCK
- OS_CLOSE(closeFd);
- IH_LOCK
- fdInUseCount -= 1;
- IH_UNLOCK
- return 0;
+ return fd_reallyclose(fdP);
}
/* Put this descriptor back into the cache */
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. */
+ * the reference count, otherwise we need to call ih_release.
+ */
if (ihP->ih_refcnt > 1) {
ihP->ih_refcnt--;
IH_UNLOCK
}
/*
- * Return a file descriptor handle to the cache
+ * Actually close the file descriptor handle and return it to
+ * the free list.
*/
int fd_reallyclose(FdHandle_t *fdP)
{
return 0;
IH_LOCK
+
assert(ih_Inited);
assert(fdInUseCount > 0);
assert(fdP->fd_status == FD_HANDLE_INUSE);
ihP = fdP->fd_ih;
closeFd = fdP->fd_fd;
- DLL_DELETE(fdP, fdP->fd_ih->ih_fdhead, fdP->fd_ih->ih_fdtail,
- fd_ihnext, fd_ihprev);
+ DLL_DELETE(fdP, ihP->ih_fdhead, ihP->ih_fdtail, fd_ihnext, fd_ihprev);
DLL_INSERT_TAIL(fdP, fdAvailHead, fdAvailTail, fd_next, fd_prev);
+
fdP->fd_status = FD_HANDLE_AVAIL;
fdP->fd_ih = NULL;
fdP->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->ih_fdhead) {
+ ihP->ih_flags &= ~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
IH_UNLOCK
ih_release(ihP);
}
+
return 0;
}
return retval;
}
-/* Close all cached file descriptors for this inode. */
-int ih_reallyclose(IHandle_t *ihP)
+/* 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;
- FdHandle_t *fdP;
- FdHandle_t *head, *tail;
-
- if (!ihP)
- return 0;
-
- IH_LOCK
+ int closeCount, closedAll;
+ FdHandle_t *fdP, *head, *tail, *next;
assert(ihP->ih_refcnt > 0);
+ closedAll = 1;
+ DLL_INIT_LIST(head, tail);
+ ihP->ih_flags &= ~IH_REALLY_CLOSED;
+
/*
* 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.
+ * and the IHandle queue and put them on a temporary queue so we
+ * can drop the lock before we close the files.
*/
- DLL_INIT_LIST(head, tail);
- for (fdP = ihP->ih_fdhead ; fdP != NULL ; fdP = fdP->fd_ihnext) {
- if (fdP->fd_status == FD_HANDLE_OPEN) {
- assert(fdP->fd_ih == ihP);
- DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
- DLL_INSERT_TAIL(fdP, head, tail, fd_next, fd_prev);
- } else {
- ihP->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
+ for (fdP = ihP->ih_fdhead; fdP != NULL; fdP = next) {
+ next = fdP->fd_ihnext;
+ assert(fdP->fd_ih == ihP);
+ assert(fdP->fd_status == FD_HANDLE_OPEN ||
+ fdP->fd_status == FD_HANDLE_INUSE);
+ if (fdP->fd_status == FD_HANDLE_OPEN) {
+ DLL_DELETE(fdP, ihP->ih_fdhead, ihP->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->ih_flags |= IH_REALLY_CLOSED;
+ }
+ }
+
+ /* If the ihandle reference count is 1, we should have
+ * closed all file descriptors.
*/
-
- if ( ! (ihP->ih_flags & IH_REALLY_CLOSED) )
- DLL_INIT_LIST(ihP->ih_fdhead, ihP->ih_fdtail);
+ if (ihP->ih_refcnt == 1 || closedAll) {
+ assert(closedAll);
+ assert(!ihP->ih_fdhead);
+ assert(!ihP->ih_fdtail);
+ }
if (head == NULL) {
- IH_UNLOCK
- return 0;
+ return 0; /* No file descriptors closed */
}
+ IH_UNLOCK
+
/*
* Close the file descriptors
*/
closeCount = 0;
- for (fdP = head ; fdP != NULL ; fdP = fdP->fd_ihnext) {
- IH_UNLOCK
- OS_CLOSE(fdP->fd_fd);
- IH_LOCK
- assert(fdInUseCount > 0);
- fdInUseCount -= 1;
- fdP->fd_status = FD_HANDLE_AVAIL;
- fdP->fd_fd = INVALID_FD;
- fdP->fd_ih = NULL;
- closeCount++;
+ for (fdP = head; fdP != NULL; fdP = fdP->fd_next) {
+ OS_CLOSE(fdP->fd_fd);
+ fdP->fd_status = FD_HANDLE_AVAIL;
+ fdP->fd_fd = INVALID_FD;
+ fdP->fd_ih = NULL;
+ closeCount++;
}
+ IH_LOCK
+
+ assert(fdInUseCount >= closeCount);
+ fdInUseCount -= closeCount;
+
/*
* Append the temporary queue to the list of available descriptors
*/
if (fdAvailHead == NULL) {
- fdAvailHead = head;
- fdAvailTail = tail;
+ fdAvailHead = head;
+ fdAvailTail = tail;
} else {
- fdAvailTail->fd_next = head;
- head->fd_prev = fdAvailTail;
- fdAvailTail = tail;
+ fdAvailTail->fd_next = head;
+ head->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->ih_refcnt > 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 */
+ * 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;
+ 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->ih_flags & IH_REALLY_CLOSED )
- ihP->ih_flags &= ~IH_REALLY_CLOSED;
+ assert(ihP->ih_refcnt > 0);
- ihP->ih_refcnt--;
- if (ihP->ih_refcnt > 0) {
- IH_UNLOCK
- return 0;
+ if (ihP->ih_refcnt > 1) {
+ ihP->ih_refcnt--;
+ IH_UNLOCK
+ return 0;
}
- assert(ihP->ih_refcnt == 0);
-
ihash = IH_HASH(ihP->ih_dev, ihP->ih_vid, ihP->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->ih_fdhead ; fdP != NULL ; fdP = fdP->fd_ihnext) {
- assert(fdP->fd_status == FD_HANDLE_OPEN);
- assert(fdP->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->ih_fdhead, ihP->ih_fdtail);
+ ihashTable[ihash].ihash_tail, ih_next, ih_prev);
- if (head == NULL) {
- DLL_INSERT_TAIL(ihP, ihAvailHead, ihAvailTail, ih_next, ih_prev);
- IH_UNLOCK
- return 0;
- }
+ ih_fdclose(ihP);
- /*
- * Close the file descriptors
- */
- closeCount = 0;
- for (fdP = head ; fdP != NULL ; fdP = fdP->fd_ihnext) {
- IH_UNLOCK
- OS_CLOSE(fdP->fd_fd);
- IH_LOCK
- assert(fdInUseCount > 0);
- fdInUseCount -= 1;
- fdP->fd_status = FD_HANDLE_AVAIL;
- fdP->fd_fd = INVALID_FD;
- fdP->fd_ih = NULL;
- closeCount++;
- }
+ ihP->ih_refcnt--;
- /*
- * Append the temporary queue to the list of available descriptors
- */
- if (fdAvailHead == NULL) {
- fdAvailHead = head;
- fdAvailTail = tail;
- } else {
- fdAvailTail->fd_next = head;
- head->fd_prev = fdAvailTail;
- fdAvailTail = tail;
- }
DLL_INSERT_TAIL(ihP, ihAvailHead, ihAvailTail, ih_next, ih_prev);
+
IH_UNLOCK
return 0;