Print this page
Be far more judicious in the use of curzone-using macros.

@@ -133,11 +133,16 @@
         struct nfs4_svgetit_arg sarg;
         struct compound_state cs;
         struct statvfs64 sb;
 
         rfs4_init_compound_state(&cs);
-        cs.vp = ZONE_ROOTVP();
+        /*
+         * This is global state checking, called once. We might be in
+         * non-global-zone context here (say a modload happens from a zone
+         * process) so in this case, we want the global-zone root vnode.
+         */
+        cs.vp = rootvp;
         cs.fh.nfs_fh4_val = NULL;
         cs.cr = kcred;
 
         /*
          * Get all the supported attributes

@@ -1301,11 +1306,18 @@
         vnode_t *stubvp = NULL, *vp;
 
         vp = sarg->cs->vp;
         sarg->mntdfid_set = FALSE;
 
-        /* VROOT object or zone's root, must untraverse */
+        /*
+         * VROOT object or zone's root, must untraverse.
+         *
+         * NOTE: Not doing reality checks on curzone vs. compound
+         * state vnode because it will mismatch once at initialization
+         * if a non-global-zone triggers the module load, BUT in that case
+         * the vp is literally "/" which has VROOT set.
+         */
         if ((vp->v_flag & VROOT) || VN_IS_CURZONEROOT(vp)) {
 
                 /* extra hold for vp since untraverse might rele */
                 VN_HOLD(vp);
                 stubvp = untraverse(vp);

@@ -1316,11 +1328,11 @@
                  * for a VROOT object.  sarg->vap was setup
                  * before we got here, so there's no need to do
                  * another getattr -- just use the one in sarg.
                  */
                 if (VN_CMP(vp, stubvp)) {
-                        ASSERT(VN_CMP(vp, ZONE_ROOTVP()));
+                        ASSERT(VN_IS_CURZONEROOT(vp));
                         vap = sarg->vap;
                 } else {
                         va.va_mask = AT_NODEID;
                         vap = &va;
                         error = rfs4_vop_getattr(stubvp, vap, 0, sarg->cs->cr);