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.
Reviewed-on: http://gerrit.openafs.org/3656
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit
3c91f1d88165dca085a26b87f2c0148e84e179d2)
Change-Id: I7709c886da933023a48ae368373e31f131539d42
Reviewed-on: http://gerrit.openafs.org/3679
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
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)
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);
+#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)
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);
* 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
lockparent = flags & LOCKPARENT;
wantparent = flags & (LOCKPARENT | WANTPARENT);
-#ifdef AFS_FBSD80_ENV
cnp->cn_flags |= MPSAFE; /* steel */
-#endif
#ifndef AFS_FBSD70_ENV
if (flags & ISDOTDOT)
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);
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 */
}
}
}
} /* big while loop */
-#if defined(AFS_FBSD80_ENV) && !defined(UKERNEL)
- VFS_UNLOCK_GIANT(vfslocked);
-#endif
-
return;
} /*afs_GetDownD */
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
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);