FBSD: remove vestiges of Giant

We do not support versions of FreeBSD that used Giant to
serialize access to vnode fields, and we always use the same locking
(which really ought to be MPSAFE).  Always set the MPSAFE flags
as needed, and do not bother to call VFS_[UN]LOCK_GIANT which
will never do anything for us.

Change-Id: I973a24d43563f289d4a2baa6e067fbba72d17ed9
Reviewed-on: http://gerrit.openafs.org/3656
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Ben Kaduk 2011-01-13 20:16:44 -05:00 committed by Derrick Brashear
parent a61a719d35
commit 3c91f1d881
6 changed files with 22 additions and 36 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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 */

View File

@ -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);