SOLARIS: Switch non-embedded vnodes for Solaris 11 96/12696/3
authorAndrew Deason <adeason@sinenomine.net>
Thu, 10 Aug 2017 01:06:05 +0000 (20:06 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 15 Feb 2019 14:15:03 +0000 (09:15 -0500)
Newer updates to Solaris 11 have been including several changes to the
vnode struct. Since we embed a vnode in our struct vcache, our kernel
module must be recompiled for any such change in order for the openafs
client to work at all.

To avoid the need for this, switch Solaris to using a non-embedded
vnode in our struct vcache. Follow a similar technique as is used in
DARWIN and XBSD, where we allocate a vnode in osi_AttachVnode, and
free it in afs_FlushVCache.

Change-Id: I85fd5d084a13bdea4353b5ad9840fddbc45ce8c0
Reviewed-on: https://gerrit.openafs.org/12696
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/afs/SOLARIS/osi_vcache.c
src/afs/VNOPS/afs_vnop_attrs.c
src/afs/afs.h
src/afs/afs_osi.h
src/afs/afs_osi_vm.c
src/afs/afs_vcache.c

index 4c40a74..78a1e20 100644 (file)
@@ -45,6 +45,7 @@ osi_PrePopulateVCache(struct vcache *avc) {
 
     rw_init(&avc->rwlock, "vcache rwlock", RW_DEFAULT, NULL);
 
+#ifndef AFS_SUN511_ENV
     /* This is required if the kaio (kernel aynchronous io)
      ** module is installed. Inside the kernel, the function
      ** check_vp( common/os/aio.c) checks to see if the kernel has
@@ -57,10 +58,24 @@ osi_PrePopulateVCache(struct vcache *avc) {
      ** for the time being, we fill up the v_data field with the
      ** vnode pointer itself. */
     avc->v.v_data = (char *)avc;
+#endif /* !AFS_SUN511_ENV */
 }
 
 void
-osi_AttachVnode(struct vcache *avc, int seq) { }
+osi_AttachVnode(struct vcache *avc, int seq)
+{
+#ifdef AFS_SUN511_ENV
+    struct vnode *vp;
+
+    osi_Assert(AFSTOV(avc) == NULL);
+
+    vp = vn_alloc(KM_SLEEP);
+    osi_Assert(vp != NULL);
+
+    vp->v_data = avc;
+    AFSTOV(avc) = vp;
+#endif
+}
 
 void
 osi_PostPopulateVCache(struct vcache *avc) {
index 26062d1..05a38ce 100644 (file)
@@ -93,7 +93,7 @@ afs_CopyOutAttrs(struct vcache *avc, struct vattr *attrs)
     attrs->va_uid = fakedir ? 0 : avc->f.m.Owner;
     attrs->va_gid = fakedir ? 0 : avc->f.m.Group;      /* yeah! */
 #if defined(AFS_SUN5_ENV)
-    attrs->va_fsid = avc->v.v_vfsp->vfs_fsid.val[0];
+    attrs->va_fsid = AFSTOV(avc)->v_vfsp->vfs_fsid.val[0];
 #elif defined(AFS_DARWIN80_ENV)
     VATTR_RETURN(attrs, va_fsid, vfs_statfs(vnode_mount(AFSTOV(avc)))->f_fsid.val[0]);
 #elif defined(AFS_DARWIN_ENV)
index bf2273d..e242e89 100644 (file)
@@ -716,6 +716,8 @@ struct SimpleLocks {
 #define        CPSIZE      2
 #if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV)
 #define vrefCount   v->v_usecount
+#elif defined(AFS_SUN511_ENV)
+# define vrefCount v->v_count
 #else
 #define vrefCount   v.v_count
 #endif /* AFS_XBSD_ENV */
@@ -763,7 +765,7 @@ struct nbvdata {
 };
 #define VTOAFS(v) ((((struct nbvdata *)((v)->v_data)))->afsvc)
 #define AFSTOV(vc) ((vc)->v)
-#elif defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) || (defined(AFS_LINUX22_ENV) && !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE))
+#elif defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_SUN511_ENV) || (defined(AFS_LINUX22_ENV) && !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE))
 #define VTOAFS(v) ((struct vcache *)(v)->v_data)
 #define AFSTOV(vc) ((vc)->v)
 #else
@@ -837,7 +839,7 @@ struct multiPage_range {
  * !(avc->nextfree) && !avc->vlruq.next => (FreeVCList == avc->nextfree)
  */
 struct vcache {
-#if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) || (defined(AFS_LINUX22_ENV) && !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE))
+#if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_SUN511_ENV) || (defined(AFS_LINUX22_ENV) && !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE))
     struct vnode *v;
 #else
     struct vnode v;            /* Has reference count in v.v_count */
index af1c426..5e21cfd 100644 (file)
@@ -134,9 +134,9 @@ struct afs_osi_WaitHandle {
  * Darwin, all of the BSDs, and Linux have their own
  */
 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_LINUX20_ENV)
-# define       vType(vc)           (vc)->v.v_type
-# define       vSetType(vc,type)   (vc)->v.v_type = (type)
-# define       vSetVfsp(vc,vfsp)   (vc)->v.v_vfsp = (vfsp)
+# define       vType(vc)           AFSTOV(vc)->v_type
+# define       vSetType(vc,type)   AFSTOV(vc)->v_type = (type)
+# define       vSetVfsp(vc,vfsp)   AFSTOV(vc)->v_vfsp = (vfsp)
 extern struct vnodeops *afs_ops;
 # define       IsAfsVnode(v)       ((v)->v_op == afs_ops)
 # define       SetAfsVnode(v)      (v)->v_op = afs_ops
index fa278cb..1688c58 100644 (file)
@@ -231,7 +231,7 @@ osi_VMDirty_p(struct vcache *avc)
 #if defined (AFS_SUN5_ENV)
     if (avc->f.states & CMAPPED) {
        struct page *pg;
-       for (pg = avc->v.v_s.v_Pages; pg; pg = pg->p_vpnext) {
+       for (pg = AFSTOV(avc)->v_s.v_Pages; pg; pg = pg->p_vpnext) {
            if (pg->p_mod) {
                return 1;
            }
index c34f2e1..a89c330 100644 (file)
@@ -243,7 +243,13 @@ afs_FlushVCache(struct vcache *avc, int *slept)
        AFSTOV(avc) = NULL;             /* also drop the ptr to vnode */
     }
 #endif
-#ifdef AFS_SUN510_ENV
+
+#ifdef AFS_SUN511_ENV
+    if (avc->v) {
+        vn_free(avc->v);
+        avc->v = NULL;
+    }
+#elif defined(AFS_SUN510_ENV)
     /* As we use private vnodes, cleanup is up to us */
     vn_reinit(AFSTOV(avc));
 #endif