Print this page
curzone reality check and teardown changes to use the RIGHT zone

@@ -144,12 +144,12 @@
  * struct (real or pseudo) can have a visible list as long as
  * a) its export root is VROOT, or is the zone's root for in-zone NFS service
  * b) a descendant of the export root is shared
  */
 struct exportinfo *
-pseudo_exportfs(nfs_export_t *ne, vnode_t *vp, fid_t *fid, struct exp_visible *vis_head,
-    struct exportdata *exdata)
+pseudo_exportfs(nfs_export_t *ne, vnode_t *vp, fid_t *fid,
+    struct exp_visible *vis_head, struct exportdata *exdata)
 {
         struct exportinfo *exi;
         struct exportdata *kex;
         fsid_t fsid;
         int vpathlen;

@@ -163,10 +163,11 @@
         exi->exi_fid = *fid;
         exi->exi_vp = vp;
         VN_HOLD(exi->exi_vp);
         exi->exi_visible = vis_head;
         exi->exi_count = 1;
+        /* Caller will set exi_zone... */
         exi->exi_volatile_dev = (vfssw[vp->v_vfsp->vfs_fstype].vsw_flag &
             VSW_VOLATILEDEV) ? 1 : 0;
         mutex_init(&exi->exi_lock, NULL, MUTEX_DEFAULT, NULL);
 
         /*

@@ -640,10 +641,11 @@
         treenode_t *tree_head = NULL;
         timespec_t now;
         nfs_export_t *ne = nfs_get_export();
 
         ASSERT(RW_WRITE_HELD(&ne->exported_lock));
+        ASSERT3P(curzone, ==, exip->exi_zone);
 
         gethrestime(&now);
 
         vp = exip->exi_vp;
         VN_HOLD(vp);

@@ -691,10 +693,11 @@
                                  * this as a pseudo export so that an NFS v4
                                  * client can do lookups in it.
                                  */
                                 new_exi = pseudo_exportfs(ne, vp, &fid,
                                     vis_head, NULL);
+                                new_exi->exi_zone = exip->exi_zone;
                                 vis_head = NULL;
                         }
 
                         if (VN_IS_CURZONEROOT(vp)) {
                                 /* at system root */

@@ -833,10 +836,11 @@
 {
         treenode_t *tnode, *old_nd;
         treenode_t *connect_point = NULL;
 
         ASSERT(RW_WRITE_HELD(&ne->exported_lock));
+        ASSERT(curzone == exip->exi_zone || curzone == global_zone);
 
         tnode = exip->exi_tree;
         /*
          * The unshared exportinfo was unlinked in unexport().
          * Zeroing tree_exi ensures that we will skip it.

@@ -981,10 +985,11 @@
         /*
          * An exported root vnode has a sub-dir shared if it has a visible
          * list.  i.e. if it does not have a visible list, then there is no
          * node in this filesystem leads to any other shared node.
          */
+        ASSERT3P(curzone, ==, exi->exi_zone);
         if (vp_is_exported &&
             ((vp->v_flag & VROOT) || VN_IS_CURZONEROOT(vp))) {
                 return (exi->exi_visible ? 1 : 0);
         }