Print this page
Revert exi_zone to exi_zoneid, and install exi_ne backpointer
curzone reality check and teardown changes to use the RIGHT zone
Try to remove assumption that zone's root vnode is marked VROOT
        
@@ -36,10 +36,11 @@
 #include <nfs/auth.h>
 #include <sys/vnode.h>
 #include <nfs/nfs4.h>
 #include <sys/kiconv.h>
 #include <sys/avl.h>
+#include <sys/zone.h>
 
 #ifdef _KERNEL
 #include <sys/pkp_hash.h> /* for PKP_HASH_SIZE */
 #endif /* _KERNEL */
 
@@ -470,16 +471,25 @@
         struct exportinfo  *tree_exi;
         struct exp_visible *tree_vis;
 } treenode_t;
 
 /*
- * TREE_ROOT checks if the node corresponds to a filesystem root
+ * Now that we have links to chase, we can get the zone rootvp just from
+ * an export.  No current-zone-context needed.
+ */
+#define EXI_TO_ZONEROOTVP(exi) ((exi)->exi_ne->exi_root->exi_vp)
+
+/*
+ * TREE_ROOT checks if the node corresponds to a filesystem root or
+ * the zone's root directory.
  * TREE_EXPORTED checks if the node is explicitly shared
  */
 
 #define TREE_ROOT(t) \
-        ((t)->tree_exi && (t)->tree_exi->exi_vp->v_flag & VROOT)
+        ((t)->tree_exi != NULL && \
+        (((t)->tree_exi->exi_vp->v_flag & VROOT) || \
+        VN_CMP(EXI_TO_ZONEROOTVP((t)->tree_exi), (t)->tree_exi->exi_vp)))
 
 #define TREE_EXPORTED(t) \
         ((t)->tree_exi && !PSEUDO((t)->tree_exi))
 
 #define EXPTABLESIZE   256
@@ -517,10 +527,11 @@
         struct treenode         *exi_tree;
         fhandle_t               exi_fh;
         krwlock_t               exi_cache_lock;
         kmutex_t                exi_lock;
         uint_t                  exi_count;
+        zoneid_t                exi_zoneid;
         vnode_t                 *exi_vp;
         vnode_t                 *exi_dvp;
         avl_tree_t              *exi_cache[AUTH_TABLESIZE];
         struct log_buffer       *exi_logbuffer;
         struct exp_visible      *exi_visible;
@@ -527,11 +538,17 @@
         struct charset_cache    *exi_charset;
         unsigned                exi_volatile_dev:1;
         unsigned                exi_moved:1;
         int                     exi_id;
         avl_node_t              exi_id_link;
-        zoneid_t                exi_zoneid;
+        /*
+         * Soft-reference/backpointer to zone's nfs_export_t.
+         * This allows us access to the zone's rootvp (stored in
+         * exi_ne->exi_root->exi_vp) even if the current thread isn't in
+         * same-zone context.
+         */
+        struct nfs_export       *exi_ne;
 #ifdef VOLATILE_FH_TEST
         uint32_t                exi_volatile_id;
         struct ex_vol_rename    *exi_vol_rename;
         kmutex_t                exi_vol_rename_lock;
 #endif /* VOLATILE_FH_TEST -- keep last! */
@@ -655,11 +672,12 @@
          * must be held when searching or modifiying the exportinfo list.
          */
         krwlock_t exported_lock;
 
         /* "public" and default (root) location for public filehandle */
-        struct exportinfo *exi_public, *exi_root;
+        struct exportinfo *exi_public;
+        struct exportinfo *exi_root;
         /* For checking default public file handle */
         fid_t exi_rootfid;
         /* For comparing V2 filehandles */
         fhandle_t nullfh2;