diff --git a/src/afs/FBSD/osi_misc.c b/src/afs/FBSD/osi_misc.c index 6c2876d62c..2ece43d5a7 100644 --- a/src/afs/FBSD/osi_misc.c +++ b/src/afs/FBSD/osi_misc.c @@ -37,9 +37,7 @@ osi_lookupname(char *aname, enum uio_seg seg, int followlink, flags |= FOLLOW; else flags |= NOFOLLOW; -#ifdef AFS_FBSD80_ENV - flags |= MPSAFE; /* namei must take GIANT if needed */ -#endif + flags |= MPSAFE; /* namei must take Giant if needed */ NDINIT(&n, LOOKUP, flags, seg, aname, curthread); if ((error = namei(&n)) != 0) { if (glocked) diff --git a/src/afs/FBSD/osi_vfsops.c b/src/afs/FBSD/osi_vfsops.c index b956b8090c..b300ff4d60 100644 --- a/src/afs/FBSD/osi_vfsops.c +++ b/src/afs/FBSD/osi_vfsops.c @@ -123,11 +123,26 @@ afs_omount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, afs_globalVFS = mp; mp->vfs_bsize = 8192; vfs_getnewfsid(mp); -#ifdef AFS_FBSD70_ENV /* XXX 70? */ + /* + * This is kind of ugly, as the interlock has grown to encompass + * more fields over time and there's not a good way to group the + * code without duplication. + */ +#ifdef AFS_FBSD62_ENV MNT_ILOCK(mp); - mp->mnt_flag &= ~MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_MPSAFE; /* solid steel */ #endif + mp->mnt_flag &= ~MNT_LOCAL; +#if defined(AFS_FBSD61_ENV) && !defined(AFS_FBSD62_ENV) + MNT_ILOCK(mp); +#endif + mp->mnt_kern_flag |= MNTK_MPSAFE; /* solid steel */ +#ifndef AFS_FBSD61_ENV + MNT_ILOCK(mp); +#endif + /* + * XXX mnt_stat "is considered stable as long as a ref is held". + * We should check that we hold the only ref. + */ mp->mnt_stat.f_iosize = 8192; if (path != NULL) @@ -139,9 +154,7 @@ afs_omount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, strcpy(mp->mnt_stat.f_mntfromname, "AFS"); /* null terminated string "AFS" will fit, just leave it be. */ strcpy(mp->mnt_stat.f_fstypename, "afs"); -#ifdef AFS_FBSD70_ENV MNT_IUNLOCK(mp); -#endif AFS_GUNLOCK(); #ifdef AFS_FBSD80_ENV afs_statfs(mp, &mp->mnt_stat); diff --git a/src/afs/FBSD/osi_vm.c b/src/afs/FBSD/osi_vm.c index fbff37fbd6..cbbe5c02f2 100644 --- a/src/afs/FBSD/osi_vm.c +++ b/src/afs/FBSD/osi_vm.c @@ -43,9 +43,9 @@ * way. * * The locking protocol for vnodes is defined in - * kern/vnode_if.src and sys/vnode.h; the locking is still a work in - * progress, so some fields are (as of 5.1) still protected by Giant - * rather than an explicit lock. + * kern/vnode_if.src and sys/vnode.h; unfortunately, it is not *quite* + * constant from version to version so to be properly correct we must + * check the VCS history of those files. */ #ifdef AFS_FBSD60_ENV diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c index 99a3d71bbe..5352b6446d 100644 --- a/src/afs/FBSD/osi_vnodeops.c +++ b/src/afs/FBSD/osi_vnodeops.c @@ -501,9 +501,7 @@ afs_vop_lookup(ap) lockparent = flags & LOCKPARENT; wantparent = flags & (LOCKPARENT | WANTPARENT); -#ifdef AFS_FBSD80_ENV cnp->cn_flags |= MPSAFE; /* steel */ -#endif #ifndef AFS_FBSD70_ENV if (flags & ISDOTDOT) diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index fa569c960e..91c4ae0159 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -564,13 +564,6 @@ afs_GetDownD(int anumber, int *aneedSpace, afs_int32 buckethint) afs_uint32 maxVictimPtr; /* where it is */ int discard; int curbucket; -#if defined(AFS_FBSD80_ENV) && !defined(UKERNEL) - int vfslocked; -#endif - -#if defined(AFS_FBSD80_ENV) && !defined(UKERNEL) - vfslocked = VFS_LOCK_GIANT(afs_globalVFS); -#endif AFS_STATCNT(afs_GetDownD); @@ -582,9 +575,6 @@ afs_GetDownD(int anumber, int *aneedSpace, afs_int32 buckethint) if (!aneedSpace || *aneedSpace <= 0) { anumber -= afs_freeDCCount; if (anumber <= 0) { -#if defined(AFS_FBSD80_ENV) && !defined(UKERNEL) - VFS_UNLOCK_GIANT(vfslocked); -#endif return; /* enough already free */ } } @@ -862,10 +852,6 @@ afs_GetDownD(int anumber, int *aneedSpace, afs_int32 buckethint) } } /* big while loop */ -#if defined(AFS_FBSD80_ENV) && !defined(UKERNEL) - VFS_UNLOCK_GIANT(vfslocked); -#endif - return; } /*afs_GetDownD */ diff --git a/src/afs/afs_osi_vm.c b/src/afs/afs_osi_vm.c index 434d062953..c26df6d6b5 100644 --- a/src/afs/afs_osi_vm.c +++ b/src/afs/afs_osi_vm.c @@ -47,9 +47,6 @@ osi_Active(struct vcache *avc) void osi_FlushPages(struct vcache *avc, afs_ucred_t *credp) { -#ifdef AFS_FBSD70_ENV - int vfslocked; -#endif afs_hyper_t origDV; #if defined(AFS_CACHE_BYPASS) /* The optimization to check DV under read lock below is identical a @@ -90,18 +87,12 @@ osi_FlushPages(struct vcache *avc, afs_ucred_t *credp) ICL_TYPE_INT32, origDV.low, ICL_TYPE_INT32, avc->f.m.Length); ReleaseWriteLock(&avc->lock); -#ifdef AFS_FBSD70_ENV - vfslocked = VFS_LOCK_GIANT(AFSTOV(avc)->v_mount); -#endif #ifndef AFS_FBSD70_ENV AFS_GUNLOCK(); #endif osi_VM_FlushPages(avc, credp); #ifndef AFS_FBSD70_ENV AFS_GLOCK(); -#endif -#ifdef AFS_FBSD70_ENV - VFS_UNLOCK_GIANT(vfslocked); #endif ObtainWriteLock(&avc->lock, 88);