From 66d83d54701eeaa3772aadacd11bb891eb73019e Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Wed, 22 Jan 2003 21:25:14 +0000 Subject: [PATCH] openbsd-20030122 Fix vcache/vnode confusion. --- src/afs/OBSD/osi_file.c | 2 +- src/afs/OBSD/osi_vnodeops.c | 4 ++-- src/afs/afs.h | 5 ++--- src/afs/afs_daemons.c | 22 +++++++++++----------- src/afs/afs_dcache.c | 6 +++--- src/afs/afs_init.c | 2 +- src/afs/afs_vcache.c | 4 ++-- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/afs/OBSD/osi_file.c b/src/afs/OBSD/osi_file.c index a60a31080..39a889462 100644 --- a/src/afs/OBSD/osi_file.c +++ b/src/afs/OBSD/osi_file.c @@ -120,7 +120,7 @@ int osi_UFSTruncate(struct osi_file *afile, afs_int32 asize) void osi_DisableAtimes(struct vnode *avp) { #if 0 - VTOI(avp)->i_flag &= ~IACC; + VTOI(avp)->i_flag &= ~IN_ACCESS; #endif } diff --git a/src/afs/OBSD/osi_vnodeops.c b/src/afs/OBSD/osi_vnodeops.c index 436ef9f5a..43756f461 100644 --- a/src/afs/OBSD/osi_vnodeops.c +++ b/src/afs/OBSD/osi_vnodeops.c @@ -460,7 +460,7 @@ afs_nbsd_read(ap) int code; AFS_GLOCK(); - code = afs_read(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred, 0, 0, 0); + code = afs_read(VTOAFS(ap->a_vp), ap->a_uio, ap->a_cred, (daddr_t)0, NULL, 0); AFS_GUNLOCK(); return code; } @@ -1009,7 +1009,7 @@ afs_nbsd_print(ap) struct vnode *vp = ap->a_vp; struct vcache *vc = VTOAFS(ap->a_vp); - printf("tag %d, fid: %ld.%x.%x.%x, ", vp->v_tag, vc->fid.Cell, + printf("tag %d, fid: %d.%x.%x.%x, ", vp->v_tag, vc->fid.Cell, (int) vc->fid.Fid.Volume, (int) vc->fid.Fid.Vnode, (int) vc->fid.Fid.Unique); lockmgr_printinfo(&vc->rwlock); printf("\n"); diff --git a/src/afs/afs.h b/src/afs/afs.h index 7ee962e22..a61914757 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -128,7 +128,7 @@ struct sysname_info { #define BUVALID 2 /* code is valid (store) */ #define BUWAIT 4 /* someone is waiting for BUVALID */ struct brequest { - struct vcache *vnode; /* vnode to use, with vrefcount bumped */ + struct vcache *vc; /* vnode to use, with vrefcount bumped */ struct AFS_UCRED *cred; /* credentials to use for operation */ afs_size_t size_parm[BPARMS]; /* random parameters */ void *ptr_parm[BPARMS]; /* pointer parameters */ @@ -628,7 +628,6 @@ extern afs_uint32 afs_stampValue; /* stamp for pair's usage */ struct vcache { #if defined(AFS_OBSD_ENV) struct vnode *v; - struct lock rwlock; /* vnode lock */ #else struct vnode v; /* Has reference count in v.v_count */ #endif @@ -675,7 +674,7 @@ struct vcache { #ifdef AFS_DARWIN_ENV struct lock__bsd__ rwlock; #endif -#ifdef AFS_FBSD_ENV +#ifdef AFS_XBSD_ENV struct lock rwlock; #endif afs_int32 parentVnode; /* Parent dir, if a file. */ diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index afa8e479d..31f5decb0 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -373,13 +373,13 @@ static void BPath(register struct brequest *ab) if (dp) tvn = (struct vnode*)dp->d_inode; #else - code = gop_lookupname((char *)ab->ptr_parm[0], AFS_UIOSYS, 1, NULL, (struct vnode **)&tvn); + code = gop_lookupname((char *)ab->ptr_parm[0], AFS_UIOSYS, 1, NULL, &tvn); #endif AFS_GLOCK(); osi_FreeLargeSpace((char *)ab->ptr_parm[0]); /* free path name buffer here */ if (code) return; /* now path may not have been in afs, so check that before calling our cache manager */ - if (!tvn || !IsAfsVnode((struct vnode *) tvn)) { + if (!tvn || !IsAfsVnode(tvn)) { /* release it and give up */ if (tvn) { #ifdef AFS_DEC_ENV @@ -388,7 +388,7 @@ static void BPath(register struct brequest *ab) #ifdef AFS_LINUX22_ENV dput(dp); #else - AFS_RELE((struct vnode *) tvn); + AFS_RELE(tvn); #endif #endif } @@ -410,7 +410,7 @@ static void BPath(register struct brequest *ab) #ifdef AFS_LINUX22_ENV dput(dp); #else - AFS_RELE((struct vnode *) tvn); + AFS_RELE(tvn); #endif #endif } @@ -428,7 +428,7 @@ static void BPrefetch(register struct brequest *ab) AFS_STATCNT(BPrefetch); if ((len = afs_InitReq(&treq, ab->cred))) return; - tvc = ab->vnode; + tvc = ab->vc; tdc = afs_GetDCache(tvc, ab->size_parm[0], &treq, &offset, &len, 1); if (tdc) { afs_PutDCache(tdc); @@ -465,7 +465,7 @@ static void BStore(register struct brequest *ab) AFS_STATCNT(BStore); if ((code = afs_InitReq(&treq, ab->cred))) return; code = 0; - tvc = ab->vnode; + tvc = ab->vc; #if defined(AFS_SGI_ENV) /* * Since StoreOnLastReference can end up calling osi_SyncVM which @@ -538,7 +538,7 @@ struct brequest *afs_BQueue(register short aopcode, register struct vcache *avc, if (i < NBRS) { /* found a buffer */ tb->opcode = aopcode; - tb->vnode = avc; + tb->vc = avc; tb->cred = acred; crhold(tb->cred); if (avc) { @@ -1268,13 +1268,13 @@ void afs_BackgroundDaemon(void) else if (tb->opcode == BOP_PATH) BPath(tb); else panic("background bop"); - if (tb->vnode) { + if (tb->vc) { #ifdef AFS_DEC_ENV - tb->vnode->vrefCount--; /* fix up reference count */ + tb->vc->vrefCount--; /* fix up reference count */ #else - AFS_RELE((struct vnode *)(tb->vnode)); /* MUST call vnode layer or could lose vnodes */ + AFS_RELE(AFSTOV(tb->vc)); /* MUST call vnode layer or could lose vnodes */ #endif - tb->vnode = NULL; + tb->vc = NULL; } if (tb->cred) { crfree(tb->cred); diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 12757964b..2769a4524 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -484,7 +484,7 @@ static void afs_GetDownD(int anumber, int *aneedSpace) */ if (tdc && tdc->refCount == 1) { unsigned char chunkFlags; - afs_size_t tchunkoffset; + afs_size_t tchunkoffset = 0; afid = &tdc->f.fid; /* xdcache is lower than the xvcache lock */ MReleaseWriteLock(&afs_xdcache); @@ -2843,7 +2843,7 @@ int afs_wakeup(register struct vcache *avc) AFS_STATCNT(afs_wakeup); for (i = 0; i < NBRS; i++, tb++) { /* if request is valid and for this file, we've found it */ - if (tb->refCount > 0 && avc == tb->vnode) { + if (tb->refCount > 0 && avc == tb->vc) { /* * If CSafeStore is on, then we don't awaken the guy @@ -2935,7 +2935,7 @@ int afs_InitCacheFile(char *afile, ino_t ainode) #ifdef AFS_DEC_ENV grele(filevp); #else - AFS_RELE((struct vnode *)filevp); + AFS_RELE(filevp); #endif #endif /* AFS_LINUX22_ENV */ } diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index 316253724..a325994a6 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -439,7 +439,7 @@ int afs_InitCacheInfo(register char *afile) afs_cacheVfsp = filevp->v_vfsp; #endif /* AFS_OBSD_ENV */ #endif /* AFS_LINUX20_ENV */ - AFS_RELE((struct vnode *)filevp); + AFS_RELE(filevp); #endif /* AFS_LINUX22_ENV */ tfile = osi_UFSOpen(cacheInode); afs_osi_Stat(tfile, &tstat); diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index f3b5fd770..03b2c7fef 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -2019,9 +2019,9 @@ struct vcache *afs_GetRootVCache(struct VenusFid *afid, /* Mount point no longer stat'd or unknown. FID may have changed. */ #ifdef AFS_OSF_ENV if (tvc) - AFS_RELE(tvc); + AFS_RELE(AFSTOV(tvc)); #endif - tvc = (struct vcache*)0; + tvc = NULL; getNewFid = 1; ReleaseSharedLock(&afs_xvcache); goto newmtpt; -- 2.39.5