]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
FBSD: remove vestiges of Giant
authorBen Kaduk <kaduk@mit.edu>
Fri, 14 Jan 2011 01:16:44 +0000 (20:16 -0500)
committerDerrick Brashear <shadow@dementia.org>
Sat, 15 Jan 2011 00:07:05 +0000 (16:07 -0800)
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>
src/afs/FBSD/osi_misc.c
src/afs/FBSD/osi_vfsops.c
src/afs/FBSD/osi_vm.c
src/afs/FBSD/osi_vnodeops.c
src/afs/afs_dcache.c
src/afs/afs_osi_vm.c

index 6c2876d62c394182611bb7a913d4429f4232c667..2ece43d5a77bf836de883fa8004f2a66414644ea 100644 (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)
index b956b8090c313a4ef415071a0f0ebd0b693447a3..b300ff4d6045047b23732e7d8b2bc547fb06ee73 100644 (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);
+#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);
index fbff37fbd63ce791453829c5317d3cd115f8445b..cbbe5c02f21a06a28b9e46c175c1f8151e2b3514 100644 (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
index 99a3d71bbeefcb08b7c150c7707aa5e4cad64462..5352b6446d3ca0d4687d4c6f49d04af3085899ad 100644 (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)
index fa569c960e8b4c42fee95af6234102c1e7432d66..91c4ae0159435a900007e828d61edd872c27ac26 100644 (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 */
index 434d06295326ff654b2ccfb7551ef51bb46390ba..c26df6d6b5f43fca6d833e90d51046457e24d376 100644 (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);