From 3ec1103d2737f7a19e87798e591df598884cf180 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Tue, 22 Jan 2002 20:29:45 +0000 Subject: [PATCH] Merge conflicts --- src/WINNT/afs_setup_utils/_isuser/_IsUser.dep | 5 - src/afs/LINUX/osi_machdep.h | 8 +- src/afs/LINUX/osi_vnodeops.c | 109 ++++++++--- src/afs/Makefile.in | 6 - src/afs/afs.h | 14 +- src/afs/afs_call.c | 29 ++- src/afs/afs_pioctl.c | 182 ++++++++++++++---- src/bozo/bosoprocs.c | 45 +++-- src/libafs/redhat.sh | 24 --- src/rx/rx.c | 75 +++++++- src/util/dirpath.c | 7 +- src/viced/afsfileprocs.c | 14 +- 12 files changed, 386 insertions(+), 132 deletions(-) delete mode 100644 src/WINNT/afs_setup_utils/_isuser/_IsUser.dep delete mode 100755 src/libafs/redhat.sh diff --git a/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep b/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep deleted file mode 100644 index c27f74d09..000000000 --- a/src/WINNT/afs_setup_utils/_isuser/_IsUser.dep +++ /dev/null @@ -1,5 +0,0 @@ -# Microsoft Developer Studio Generated Dependency File, included by _IsUser.mak - -.\_Isuser.RC : \ - ".\sdrc.h"\ - diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 96422d9ad..993424b37 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -100,10 +100,10 @@ typedef struct cred { /* maps to task field: */ #else int cr_ref; #endif - unsigned short cr_uid; /* euid */ - unsigned short cr_ruid; /* uid */ - unsigned short cr_gid; /* egid */ - unsigned short cr_rgid; /* gid */ + uid_t cr_uid; /* euid */ + uid_t cr_ruid; /* uid */ + gid_t cr_gid; /* egid */ + gid_t cr_rgid; /* gid */ gid_t cr_groups[NGROUPS]; /* 32 groups - empty set to NOGROUP */ int cr_ngroups; } cred_t; diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 20c3a2800..af787ca46 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -23,7 +23,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.10 2001/09/20 06:47:38 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.11 2002/01/22 20:29:44 hartmans Exp $"); #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" @@ -685,6 +685,82 @@ static int afs_linux_revalidate(struct dentry *dp) return -code ; } + +/* Validate a dentry. Return 1 if unchanged, 0 if VFS layer should re-evaluate. + * In kernels 2.2.10 and above, we are passed an additional flags var which + * may have either the LOOKUP_FOLLOW OR LOOKUP_DIRECTORY set in which case + * we are advised to follow the entry if it is a link or to make sure that + * it is a directory. But since the kernel itself checks these possibilities + * later on, we shouldn't have to do it until later. Perhaps in the future.. + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10) +static int afs_linux_dentry_revalidate(struct dentry *dp, int flags) +#else +static int afs_linux_dentry_revalidate(struct dentry *dp) +#endif +{ + char *name; + cred_t *credp = crref(); + struct vrequest treq; + struct vcache *lookupvcp = NULL; + int code, bad_dentry = 1; + struct sysname_info sysState; + struct vcache *vcp = (struct vcache*) dp->d_inode; + struct vcache *parentvcp = (struct vcache*) dp->d_parent->d_inode; + + AFS_GLOCK(); + + /* If it's a negative dentry, then there's nothing to do. */ + if (!vcp || !parentvcp) + goto done; + + if (code = afs_InitReq(&treq, credp)) + goto done; + + Check_AtSys(parentvcp, dp->d_name.name, &sysState, &treq); + name = sysState.name; + + /* First try looking up the DNLC */ + if (lookupvcp = osi_dnlc_lookup(parentvcp, name, WRITE_LOCK)) { + /* Verify that the dentry does not point to an old inode */ + if (vcp != lookupvcp) + goto done; + /* Check and correct mvid */ + if (*name != '/' && vcp->mvstat == 2) + check_bad_parent(dp); + vcache2inode(vcp); + bad_dentry = 0; + goto done; + } + + /* A DNLC lookup failure cannot be trusted. Try a real lookup */ + code = afs_lookup(parentvcp, name, &lookupvcp, credp); + + /* Verify that the dentry does not point to an old inode */ + if (vcp != lookupvcp) + goto done; + + bad_dentry = 0; + +done: + /* Clean up */ + if (lookupvcp) + afs_PutVCache(lookupvcp, WRITE_LOCK); + if (sysState.allocked) + osi_FreeLargeSpace(name); + + AFS_GUNLOCK(); + crfree(credp); + + if (bad_dentry) { + shrink_dcache_parent(dp); + d_drop(dp); + } + + return !bad_dentry; +} + +#ifdef notdef #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10) static int afs_linux_dentry_revalidate(struct dentry *dp, int flags) #else @@ -698,6 +774,9 @@ static int afs_linux_dentry_revalidate(struct dentry *dp) unsigned long timeout = 3*HZ; /* 3 seconds */ + if (!ip) + printk("negative dentry: %s\n", dp->d_name.name); + if (!(flags & LOOKUP_CONTINUE)) { long diff = CURRENT_TIME - dp->d_parent->d_inode->i_mtime; @@ -714,6 +793,7 @@ static int afs_linux_dentry_revalidate(struct dentry *dp) out_bad: return 0; } +#endif /* afs_dentry_iput */ static void afs_dentry_iput(struct dentry *dp, struct inode *ip) @@ -831,17 +911,17 @@ int afs_linux_lookup(struct inode *dip, struct dentry *dp) ip->i_data.a_ops = &afs_symlink_aops; ip->i_mapping = &ip->i_data; } else - printk("afs_linux_lookup: FIXME\n"); + printk("afs_linux_lookup: ip->i_mode 0x%x dp->d_name.name %s code %d\n", ip->i_mode, dp->d_name.name, code); #else if (S_ISDIR(ip->i_mode)) ip->i_op = &afs_dir_iops; else if (S_ISLNK(ip->i_mode)) ip->i_op = &afs_symlink_iops; #endif - } dp->d_time = jiffies; dp->d_op = afs_dops; d_add(dp, (struct inode*)vcp); + } AFS_GUNLOCK(); crfree(credp); @@ -889,27 +969,11 @@ int afs_linux_unlink(struct inode *dip, struct dentry *dp) const char *name = dp->d_name.name; int putback = 0; - if (!list_empty(&dp->d_hash)) { - d_drop(dp); - /* Install a definite non-existence if we're the only user. */ -#if defined(AFS_LINUX24_ENV) - if (atomic_read(&dp->d_count) == 1) -#else - if (dp->d_count == 1) -#endif - putback = 1; - } - AFS_GLOCK(); code = afs_remove((struct vcache*)dip, name, credp); AFS_GUNLOCK(); - if (!code) { - d_delete(dp); - if (putback) { - dp->d_time = jiffies; - d_add(dp, NULL); /* means definitely does _not_ exist */ - } - } + if (!code) + d_drop(dp); crfree(credp); return -code; } @@ -959,6 +1023,7 @@ int afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) dp->d_time = jiffies; d_instantiate(dp, (struct inode*)tvcp); } + AFS_GUNLOCK(); crfree(credp); return -code; @@ -982,7 +1047,7 @@ int afs_linux_rmdir(struct inode *dip, struct dentry *dp) } if (!code) { - d_delete(dp); + d_drop(dp); } AFS_GUNLOCK(); diff --git a/src/afs/Makefile.in b/src/afs/Makefile.in index 1f1fbfd92..2126df289 100644 --- a/src/afs/Makefile.in +++ b/src/afs/Makefile.in @@ -35,12 +35,6 @@ all: kinstall ukinstall ${TOP_INCDIR}/afs/afs.h ${TOP_INCDIR}/afs/osi_inode.h ${ pmax_ul43 | pmax_ul43a) \ ${INSTALL} longc_procs.h ${TOP_INCDIR}/afs ;; \ esac - -case ${SYS_NAME} in \ - *linux* ) \ - ${INSTALL} ${AFS_OSTYPE}/osi_vfs.h ${TOP_INCDIR}/afs ;;\ - * ) \ - echo No vfs headers to install for ${SYS_NAME};; \ - esac # NOTE: linux case uses --new as well to work around bug in some versions of # gencat. diff --git a/src/afs/afs.h b/src/afs/afs.h index d1918d536..9dc152fad 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -202,7 +202,7 @@ struct cell { short states; /* state flags */ short cellIndex; /* relative index number per cell */ time_t timeout; /* data expire time, if non-zero */ - struct cell *alias; /* what this cell is an alias for */ + char *realName; /* who this cell is an alias for */ }; #define afs_PutCell(cellp, locktype) @@ -529,11 +529,19 @@ struct SimpleLocks { #define VREFCOUNT_SET(v, c) atomic_set(&((vnode_t *) v)->v_count, c) #define VREFCOUNT_DEC(v) atomic_dec(&((vnode_t *) v)->v_count) #define VREFCOUNT_INC(v) atomic_inc(&((vnode_t *) v)->v_count) +#define DLOCK() spin_lock(&dcache_lock) +#define DUNLOCK() spin_unlock(&dcache_lock) +#define DGET(d) dget_locked(d) +#define DCOUNT(d) atomic_read(&(d)->d_count) #else #define VREFCOUNT(v) ((v)->vrefCount) #define VREFCOUNT_SET(v, c) (v)->vrefCount = c; #define VREFCOUNT_DEC(v) (v)->vrefCount--; #define VREFCOUNT_INC(v) (v)->vrefCount++; +#define DLOCK() +#define DUNLOCK() +#define DGET(d) dget(d) +#define DCOUNT(d) ((d)->d_count) #endif #define AFS_MAXDV 0x7fffffff /* largest dataversion number */ @@ -959,7 +967,9 @@ extern struct brequest afs_brs[NBRS]; /* request structures */ #define FVHash(acell,avol) (((avol)+(acell)) & (NFENTRIES-1)) extern struct cell *afs_GetCell(); +extern struct cell *afs_GetCellNoLock(); extern struct cell *afs_GetCellByName(); +extern struct cell *afs_GetCellByName2(); extern struct cell *afs_GetCellByIndex(); extern struct unixuser *afs_GetUser(); extern struct volume *afs_GetVolume(); @@ -1003,6 +1013,8 @@ extern void afs_PutDynroot(); extern int afs_DynrootNewVnode(); extern int afs_SetDynrootEnable(); extern int afs_GetDynrootEnable(); +extern int afs_DynrootVOPSymlink(); +extern int afs_DynrootVOPRemove(); /* Performance hack - we could replace VerifyVCache2 with the appropriate diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 13d04f8ca..cda14dcb0 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_call.c,v 1.8 2001/10/14 18:43:24 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_call.c,v 1.9 2002/01/22 20:29:43 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -326,6 +326,33 @@ long parm, parm2, parm3, parm4, parm5, parm6; osi_FreeSmallSpace(tbuffer); osi_FreeSmallSpace(tbuffer1); } + else if (parm == AFSOP_ADDCELLALIAS) { + /* + * Call arguments: + * parm2 is the alias name + * parm3 is the real cell name + */ +#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) + size_t bufferSize; +#else /* AFS_SGI61_ENV */ + u_int bufferSize; +#endif /* AFS_SGI61_ENV */ + char *aliasName = osi_AllocSmallSpace(AFS_SMALLOCSIZ); + char *cellName = osi_AllocSmallSpace(AFS_SMALLOCSIZ); + + AFS_COPYINSTR((char *)parm2, aliasName, AFS_SMALLOCSIZ, &bufferSize, code); + if (!code) AFS_COPYINSTR((char *)parm3, cellName, AFS_SMALLOCSIZ, &bufferSize, code); + if (!code) afs_NewCell(aliasName, /* new entry name */ + 0, /* host list */ + CAlias, /* flags */ + (char *) 0, /* linked cell */ + 0, 0, /* fs & vl ports */ + 0, /* timeout */ + cellName); /* real cell name */ + + osi_FreeSmallSpace(aliasName); + osi_FreeSmallSpace(cellName); + } else if (parm == AFSOP_CACHEINIT) { struct afs_cacheParams cparms; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 45b44f45c..769b4a911 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -10,7 +10,7 @@ #include #include "../afs/param.h" -RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_pioctl.c,v 1.10 2001/10/14 18:43:25 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_pioctl.c,v 1.11 2002/01/22 20:29:43 hartmans Exp $"); #include "../afs/sysincludes.h" /* Standard vendor system headers */ #include "../afs/afsincludes.h" /* Afs-based standard headers */ @@ -66,13 +66,14 @@ static int PGetCPrefs(), PSetCPrefs(); /* client network addresses */ static int PGetInitParams(), PFlushMount(), PRxStatProc(), PRxStatPeer(); static int PGetRxkcrypt(), PSetRxkcrypt(); static int PPrefetchFromTape(), PResidencyCmd(); +static int PNewAlias(), PListAliases(); int PExportAfs(); static int HandleClientContext(struct afs_ioctl *ablob, int *com, struct AFS_UCRED **acred, struct AFS_UCRED *credp); extern struct cm_initparams cm_initParams; -static int (*(pioctlSw[]))() = { +static int (*(VpioctlSw[]))() = { PBogus, /* 0 */ PSetAcl, /* 1 */ PGetAcl, /* 2 */ @@ -141,6 +142,13 @@ static int (*(pioctlSw[]))() = { PNoop, /* 65 -- arla: break callback */ PPrefetchFromTape, /* 66 -- MR-AFS: prefetch file from tape */ PResidencyCmd, /* 67 -- MR-AFS: generic commnd interface */ + PNoop, /* 68 -- arla: fetch stats */ +}; + +static int (*(CpioctlSw[]))() = { + PBogus, /* 0 */ + PNewAlias, /* 1 -- create new cell alias */ + PListAliases, /* 2 -- list cell aliases */ }; #define PSetClientContext 99 /* Special pioctl to setup caller's creds */ @@ -741,21 +749,6 @@ afs_syscall_pioctl(path, com, cmarg, follow) #endif AFS_STATCNT(afs_syscall_pioctl); if (follow) follow = 1; /* compat. with old venus */ -#ifndef AFS_SUN5_ENV - if (! _VALIDVICEIOCTL(com)) { - PIOCTL_FREE_CRED(); -#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) - return EINVAL; -#else /* AFS_OSF_ENV */ -#if defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) - return EINVAL; -#else - setuerror(EINVAL); - return EINVAL; -#endif -#endif - } -#endif code = copyin_afs_ioctl(cmarg, &data); if (code) { PIOCTL_FREE_CRED(); @@ -1036,16 +1029,31 @@ afs_HandlePioctl(avc, acom, ablob, afollow, acred) { struct vrequest treq; register afs_int32 code; - register afs_int32 function; + register afs_int32 function, device; afs_int32 inSize, outSize; char *inData, *outData; + int (*(*pioctlSw))(); + int pioctlSwSize; afs_Trace3(afs_iclSetp, CM_TRACE_PIOCTL, ICL_TYPE_INT32, acom & 0xff, ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, afollow); AFS_STATCNT(HandlePioctl); if (code = afs_InitReq(&treq, *acred)) return code; + device = (acom & 0xff00) >> 8; + switch (device) { + case 'V': /* Original pioctl's */ + pioctlSw = VpioctlSw; + pioctlSwSize = sizeof(VpioctlSw); + break; + case 'C': /* Coordinated/common pioctl's */ + pioctlSw = CpioctlSw; + pioctlSwSize = sizeof(CpioctlSw); + break; + default: + return EINVAL; + } function = acom & 0xff; - if (function >= (sizeof(pioctlSw) / sizeof(char *))) { + if (function >= (pioctlSwSize / sizeof(char *))) { return EINVAL; /* out of range */ } inSize = ablob->in_size; @@ -1061,7 +1069,7 @@ afs_HandlePioctl(avc, acom, ablob, afollow, acred) } outData = osi_AllocLargeSpace(AFS_LRALLOCSIZ); outSize = 0; - if (function == 3) /* PSetTokens */ + if (function == 3 && device == 'V') /* PSetTokens */ code = (*pioctlSw[function])(avc, function, &treq, inData, outData, inSize, &outSize, acred); else code = (*pioctlSw[function])(avc, function, &treq, inData, outData, inSize, &outSize, *acred); @@ -2299,6 +2307,53 @@ static PNewCell(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) return code; } +static PNewAlias(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) + struct vcache *avc; + int afun; + struct vrequest *areq; + register char *ain; + char *aout; + afs_int32 ainSize; + struct AFS_UCRED *acred; + afs_int32 *aoutSize; /* set this */ +{ + /* create a new cell alias */ + register struct cell *tcell; + char *tp = ain; + register afs_int32 code; + char *realName, *aliasName; + register struct afs_q *cq, *tq; + + if ( !afs_resourceinit_flag ) /* afs deamons havn't started yet */ + return EIO; /* Inappropriate ioctl for device */ + + if (!afs_osi_suser(acred)) + return EACCES; + + aliasName = tp; + tp += strlen(aliasName) + 1; + realName = tp; + + /* + * Prevent user from shooting themselves in the foot -- don't allow + * creation of aliases when a real cell already exists with that name. + */ + ObtainReadLock(&afs_xcell); + for (cq = CellLRU.next; cq != &CellLRU; cq = tq) { + tcell = QTOC(cq); tq = QNext(cq); + if ((afs_strcasecmp(tcell->cellName, aliasName) == 0) && + !(tcell->states & CAlias)) { + ReleaseReadLock(&afs_xcell); + return EEXIST; + } + } + ReleaseReadLock(&afs_xcell); + + code = afs_NewCell(aliasName, 0, CAlias, 0, 0, 0, 0, realName); + *aoutSize = 0; + return code; +} + static PListCells(avc, afun, areq, ain, aout, ainSize, aoutSize) struct vcache *avc; int afun; @@ -2321,8 +2376,12 @@ static PListCells(avc, afun, areq, ain, aout, ainSize, aoutSize) ObtainReadLock(&afs_xcell); for (cq = CellLRU.next; cq != &CellLRU; cq = tq) { tcell = QTOC(cq); tq = QNext(cq); + if (tcell->states & CAlias) { + tcell = 0; + continue; + } if (whichCell == 0) break; - if (tq == &CellLRU) tcell = 0; + tcell = 0; whichCell--; } if (tcell) { @@ -2343,6 +2402,51 @@ static PListCells(avc, afun, areq, ain, aout, ainSize, aoutSize) else return EDOM; } +static PListAliases(avc, afun, areq, ain, aout, ainSize, aoutSize) + struct vcache *avc; + int afun; + struct vrequest *areq; + char *ain, *aout; + afs_int32 ainSize; + afs_int32 *aoutSize; /* set this */ +{ + afs_int32 whichAlias; + register struct cell *tcell=0; + register char *cp, *tp = ain; + register struct afs_q *cq, *tq; + + if ( !afs_resourceinit_flag ) /* afs deamons havn't started yet */ + return EIO; /* Inappropriate ioctl for device */ + if (ainSize < sizeof(afs_int32)) + return EINVAL; + + memcpy((char *)&whichAlias, tp, sizeof(afs_int32)); + tp += sizeof(afs_int32); + + ObtainReadLock(&afs_xcell); + for (cq = CellLRU.next; cq != &CellLRU; cq = tq) { + tcell = QTOC(cq); tq = QNext(cq); + if (!(tcell->states & CAlias)) { + tcell = 0; + continue; + } + if (whichAlias == 0) break; + tcell = 0; + whichAlias--; + } + if (tcell) { + cp = aout; + strcpy(cp, tcell->cellName); + cp += strlen(tcell->cellName)+1; + strcpy(cp, tcell->realName); + cp += strlen(tcell->realName)+1; + *aoutSize = cp - aout; + } + ReleaseReadLock(&afs_xcell); + if (tcell) return 0; + else return EDOM; +} + static PRemoveMount(avc, afun, areq, ain, aout, ainSize, aoutSize) struct vcache *avc; int afun; @@ -2836,27 +2940,29 @@ static void ReSortCells(s,l, vlonly) register int k; if (vlonly) { - struct cell *tcell; - for(k=0;kcellHosts, MAXCELLHOSTS); - afs_PutCell(tcell, WRITE_LOCK); - } - return; + struct cell *tcell; + ObtainWriteLock(&afs_xcell,300); + for(k=0;kcellHosts, MAXCELLHOSTS); + afs_PutCell(tcell, WRITE_LOCK); + } + ReleaseWriteLock(&afs_xcell); + return; } ObtainReadLock(&afs_xvolume); for (i= 0; i< NVOLS; i++) { - for (j=afs_volumes[i];j;j=j->next) { - for (k=0;kcell == l[k]) { - ObtainWriteLock(&j->lock,233); - afs_SortServers(j->serverHost, MAXHOSTS); - ReleaseWriteLock(&j->lock); - break; - } - } + for (j=afs_volumes[i];j;j=j->next) { + for (k=0;kcell == l[k]) { + ObtainWriteLock(&j->lock,233); + afs_SortServers(j->serverHost, MAXHOSTS); + ReleaseWriteLock(&j->lock); + break; + } + } } ReleaseReadLock(&afs_xvolume); } diff --git a/src/bozo/bosoprocs.c b/src/bozo/bosoprocs.c index 6e7e74c2d..6fb4e7dfc 100644 --- a/src/bozo/bosoprocs.c +++ b/src/bozo/bosoprocs.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bosoprocs.c,v 1.3 2001/11/26 00:27:25 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/bozo/bosoprocs.c,v 1.4 2002/01/22 20:29:44 hartmans Exp $"); #include #include @@ -362,6 +362,7 @@ char *aname; { struct afsconf_cell tcell; register afs_int32 code; char caller[MAXKTCNAMELEN]; + char clones[MAXHOSTSPERCELL]; if (!afsconf_SuperUser(bozo_confdir, acall, caller)) { code = BZACCESS; @@ -369,7 +370,7 @@ char *aname; { } if (DoLogging) bozo_Log("%s is executing SetCellName '%s'\n", caller, aname); - code = afsconf_GetCellInfo(bozo_confdir, (char *) 0, (char *) 0, &tcell); + code = afsconf_GetExtendedCellInfo(bozo_confdir, (char *) 0, (char *) 0, &tcell, &clones); if (code) goto fail; @@ -382,7 +383,7 @@ char *aname; { } strcpy(tcell.name, aname); - code = afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell); + code = afsconf_SetExtendedCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell, &clones); fail: osi_auditU (acall, BOS_SetCellEvent, code, AUD_STR, aname, AUD_END); @@ -411,13 +412,14 @@ char **aname; { BOZO_GetCellHost(acall, awhich, aname) struct rx_call *acall; -afs_int32 awhich; +afs_uint32 awhich; char **aname; { register afs_int32 code; struct afsconf_cell tcell; register char *tp; + char clones[MAXHOSTSPERCELL]; - code = afsconf_GetCellInfo(bozo_confdir, (char *) 0, (char *) 0, &tcell); + code = afsconf_GetExtendedCellInfo(bozo_confdir, (char *) 0, (char *) 0, &tcell, &clones); if (code) goto fail; if (awhich >= tcell.numServers) { @@ -426,8 +428,13 @@ char **aname; { } tp = tcell.hostName[awhich]; - *aname = (char *) malloc(strlen(tp)+1); - strcpy(*aname, tp); + *aname = (char *) malloc(strlen(tp)+3); + if (clones[awhich]) { + strcpy(*aname, "["); + strcat(*aname, tp); + strcat(*aname, "]"); + } else + strcpy(*aname, tp); goto done; fail: @@ -446,6 +453,7 @@ char *aname; { afs_int32 which; register int i; char caller[MAXKTCNAMELEN]; + char clones[MAXHOSTSPERCELL]; if (!afsconf_SuperUser(bozo_confdir, acall, caller)) { code = BZACCESS; @@ -454,7 +462,7 @@ char *aname; { if (DoLogging) bozo_Log("%s is executing DeleteCellHost '%s'\n", caller, aname); - code = afsconf_GetCellInfo(bozo_confdir, (char *) 0, (char *) 0, &tcell); + code = afsconf_GetExtendedCellInfo(bozo_confdir, (char *) 0, (char *) 0, &tcell, &clones); if (code) goto fail; @@ -473,7 +481,7 @@ char *aname; { memset(&tcell.hostAddr[which], 0, sizeof(struct sockaddr_in)); memset(tcell.hostName[which], 0, MAXHOSTCHARS); - code = afsconf_SetCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell); + code = afsconf_SetExtendedCellInfo(bozo_confdir, AFSDIR_SERVER_ETC_DIRPATH, &tcell, &clones); fail: osi_auditU( acall, BOS_DeleteHostEvent, code, AUD_STR, aname, AUD_END); @@ -488,6 +496,9 @@ char *aname; { afs_int32 which; register int i; char caller[MAXKTCNAMELEN]; + char clones[MAXHOSTSPERCELL]; + char *n; + char isClone = 0; if (!afsconf_SuperUser(bozo_confdir, acall, caller)) { code = BZACCESS; @@ -496,13 +507,20 @@ char *aname; { if (DoLogging) bozo_Log("%s is executing AddCellHost '%s'\n", caller, aname); - code = afsconf_GetCellInfo(bozo_confdir, (char *) 0, (char *) 0, &tcell); + code = afsconf_GetExtendedCellInfo(bozo_confdir, (char *) 0, (char *) 0, &tcell, &clones); if (code) goto fail; + n = aname; + if (*n == '[') { + *(n + strlen(n) -1) = 0; + ++n; + isClone = 1; + } + which = -1; for(i=0;i /dev/null -if [ $? = 0 ]; then -IBYTES="-DSTRUCT_INODE_HAS_I_BYTES=1" -fi - -grep "extern int inode_setattr" $1/include/linux/fs.h > /dev/null -if [ $? = 0 ]; then -SETATTR="-DINODE_SETATTR_NOT_VOID=1" -fi - -if [ -e $2 ] ; then -/bin/rm $2 -fi -echo "KDEFINES = ${IBYTES} ${SETATTR}" > $2 -fi -exit 0 diff --git a/src/rx/rx.c b/src/rx/rx.c index fb0769849..32bddd196 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -16,7 +16,7 @@ #include #endif -RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx.c,v 1.9 2001/10/14 18:43:29 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx.c,v 1.10 2002/01/22 20:29:44 hartmans Exp $"); #ifdef KERNEL #include "../afs/sysincludes.h" @@ -897,7 +897,12 @@ static void rxi_DestroyConnectionNoLock(conn) * last reply packets */ rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY); - rxi_AckAll((struct rxevent *)0, call, 0); + if (call->state == RX_STATE_PRECALL || + call->state == RX_STATE_ACTIVE) { + rxi_SendDelayedAck(call->delayedAckEvent, call, 0); + } else { + rxi_AckAll((struct rxevent *)0, call, 0); + } } MUTEX_EXIT(&call->lock); } @@ -1001,6 +1006,21 @@ struct rx_call *rx_NewCall(conn) clock_GetTime(&queueTime); AFS_RXGLOCK(); MUTEX_ENTER(&conn->conn_call_lock); + + /* + * Check if there are others waiting for a new call. + * If so, let them go first to avoid starving them. + * This is a fairly simple scheme, and might not be + * a complete solution for large numbers of waiters. + */ + if (conn->makeCallWaiters) { +#ifdef RX_ENABLE_LOCKS + CV_WAIT(&conn->conn_call_cv, &conn->conn_call_lock); +#else + osi_rxSleep(conn); +#endif + } + for (;;) { for (i=0; icall[i]; @@ -1015,7 +1035,6 @@ struct rx_call *rx_NewCall(conn) } else { call = rxi_NewCall(conn, i); - MUTEX_ENTER(&call->lock); break; } } @@ -1025,12 +1044,24 @@ struct rx_call *rx_NewCall(conn) MUTEX_ENTER(&conn->conn_data_lock); conn->flags |= RX_CONN_MAKECALL_WAITING; MUTEX_EXIT(&conn->conn_data_lock); + + conn->makeCallWaiters++; #ifdef RX_ENABLE_LOCKS CV_WAIT(&conn->conn_call_cv, &conn->conn_call_lock); #else osi_rxSleep(conn); #endif + conn->makeCallWaiters--; } + /* + * Wake up anyone else who might be giving us a chance to + * run (see code above that avoids resource starvation). + */ +#ifdef RX_ENABLE_LOCKS + CV_BROADCAST(&conn->conn_call_cv); +#else + osi_rxWakeup(conn); +#endif CALL_HOLD(call, RX_CALL_REFCOUNT_BEGIN); @@ -1918,7 +1949,7 @@ struct rx_service *rxi_FindService(socket, serviceId) /* Allocate a call structure, for the indicated channel of the * supplied connection. The mode and state of the call must be set by - * the caller. */ + * the caller. Returns the call with mutex locked. */ struct rx_call *rxi_NewCall(conn, channel) register struct rx_connection *conn; register int channel; @@ -2000,7 +2031,6 @@ struct rx_call *rxi_NewCall(conn, channel) the call number is valid from the last time this channel was used */ if (*call->callNumber == 0) *call->callNumber = 1; - MUTEX_EXIT(&call->lock); return call; } @@ -2526,7 +2556,6 @@ struct rx_packet *rxi_ReceivePacket(np, socket, host, port, tnop, newcallp) } if (!call) { call = rxi_NewCall(conn, channel); - MUTEX_ENTER(&call->lock); *call->callNumber = np->header.callNumber; call->state = RX_STATE_PRECALL; clock_GetTime(&call->queueTime); @@ -5263,15 +5292,40 @@ void rxi_SendDelayedCallAbort(event, call, dummy) * seconds) to ask the client to authenticate itself. The routine * issues a challenge to the client, which is obtained from the * security object associated with the connection */ -void rxi_ChallengeEvent(event, conn, dummy) +void rxi_ChallengeEvent(event, conn, atries) struct rxevent *event; register struct rx_connection *conn; - char *dummy; + void *atries; { + int tries = (int) atries; conn->challengeEvent = (struct rxevent *) 0; if (RXS_CheckAuthentication(conn->securityObject, conn) != 0) { register struct rx_packet *packet; struct clock when; + + if (tries <= 0) { + /* We've failed to authenticate for too long. + * Reset any calls waiting for authentication; + * they are all in RX_STATE_PRECALL. + */ + int i; + + MUTEX_ENTER(&conn->conn_call_lock); + for (i=0; icall[i]; + if (call) { + MUTEX_ENTER(&call->lock); + if (call->state == RX_STATE_PRECALL) { + rxi_CallError(call, RX_CALL_DEAD); + rxi_SendCallAbort(call, NULL, 0, 0); + } + MUTEX_EXIT(&call->lock); + } + } + MUTEX_EXIT(&conn->conn_call_lock); + return; + } + packet = rxi_AllocPacket(RX_PACKET_CLASS_SPECIAL); if (packet) { /* If there's no packet available, do this later. */ @@ -5282,7 +5336,8 @@ void rxi_ChallengeEvent(event, conn, dummy) } clock_GetTime(&when); when.sec += RX_CHALLENGE_TIMEOUT; - conn->challengeEvent = rxevent_Post(&when, rxi_ChallengeEvent, conn, 0); + conn->challengeEvent = + rxevent_Post(&when, rxi_ChallengeEvent, conn, (void *) (tries-1)); } } @@ -5297,7 +5352,7 @@ void rxi_ChallengeOn(conn) { if (!conn->challengeEvent) { RXS_CreateChallenge(conn->securityObject, conn); - rxi_ChallengeEvent((struct rxevent *)0, conn, NULL); + rxi_ChallengeEvent(NULL, conn, (void *) RX_CHALLENGE_MAXTRIES); }; } diff --git a/src/util/dirpath.c b/src/util/dirpath.c index 0ff988283..3310c610c 100644 --- a/src/util/dirpath.c +++ b/src/util/dirpath.c @@ -10,7 +10,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/util/dirpath.c,v 1.11 2001/10/14 18:43:30 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/util/dirpath.c,v 1.12 2002/01/22 20:29:45 hartmans Exp $"); #include #include @@ -357,12 +357,17 @@ static void initDirPathArray(void) "/NoUsrViceEtcThisCellFileOnWindows"); sprintf(dirPathArray[AFSDIR_CLIENT_CELLSERVDB_FILEPATH_ID], "%s/%s", ntClientConfigDirShort, AFSDIR_CELLSERVDB_FILE_NTCLIENT); + strcpy(dirPathArray[AFSDIR_CLIENT_CELLALIAS_FILEPATH_ID], + "/NoCellAliasOnWindows"); #else pathp = dirPathArray[AFSDIR_CLIENT_THISCELL_FILEPATH_ID]; AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_CLIENT_ETC_DIR, AFSDIR_THISCELL_FILE); pathp = dirPathArray[AFSDIR_CLIENT_CELLSERVDB_FILEPATH_ID]; AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_CLIENT_ETC_DIR, AFSDIR_CELLSERVDB_FILE); + + pathp = dirPathArray[AFSDIR_CLIENT_CELLALIAS_FILEPATH_ID]; + AFSDIR_CLIENT_FILEPATH(pathp, AFSDIR_CLIENT_ETC_DIR, AFSDIR_CELLALIAS_FILE); #endif /* AFS_NT40_ENV */ pathp = dirPathArray[AFSDIR_CLIENT_NETINFO_FILEPATH_ID]; diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 168876861..dba0e6375 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -28,7 +28,7 @@ #include #include -RCSID("$Header: /tmp/cvstemp/openafs/src/viced/afsfileprocs.c,v 1.6 2001/10/14 18:43:31 hartmans Exp $"); +RCSID("$Header: /tmp/cvstemp/openafs/src/viced/afsfileprocs.c,v 1.7 2002/01/22 20:29:45 hartmans Exp $"); #include #include @@ -1205,9 +1205,9 @@ SRXAFS_StoreData (tcon, Fid, InStatus, Pos, Length, FileLength, OutStatus, Sync) struct rx_connection *tcon; /* Rx connection Handle */ struct AFSFid *Fid; /* Fid of taret file */ struct AFSStoreStatus *InStatus; /* Input Status for Fid */ - afs_int32 Pos; /* Not implemented yet */ - afs_int32 Length; /* Length of data to store */ - afs_int32 FileLength; /* Length of file after store */ + afs_uint32 Pos; /* Not implemented yet */ + afs_uint32 Length; /* Length of data to store */ + afs_uint32 FileLength; /* Length of file after store */ struct AFSFetchStatus *OutStatus; /* Returned status for target fid */ { @@ -5160,9 +5160,9 @@ StoreData_RXStyle(volptr, targetptr, Fid, client, Call, Pos, Length, struct AFSFid *Fid; struct client *client; register struct rx_call *Call; - afs_int32 Pos; - afs_int32 Length; - afs_int32 FileLength; + afs_uint32 Pos; + afs_uint32 Length; + afs_uint32 FileLength; int sync; #if FS_STATS_DETAILED afs_int32 *a_bytesToStoreP; -- 2.39.5