Print this page
Be far more judicious in the use of curzone-using macros.
(Merge and extra asserts by danmcd.)
Try to remove assumption that zone's root vnode is marked VROOT

*** 133,143 **** struct nfs4_svgetit_arg sarg; struct compound_state cs; struct statvfs64 sb; rfs4_init_compound_state(&cs); ! cs.vp = ZONE_ROOTVP(); cs.fh.nfs_fh4_val = NULL; cs.cr = kcred; /* * Get all the supported attributes --- 133,148 ---- struct nfs4_svgetit_arg sarg; struct compound_state cs; struct statvfs64 sb; rfs4_init_compound_state(&cs); ! /* ! * 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,1326 **** vnode_t *stubvp = NULL, *vp; vp = sarg->cs->vp; sarg->mntdfid_set = FALSE; ! /* VROOT object, must untraverse */ ! if (vp->v_flag & VROOT) { /* extra hold for vp since untraverse might rele */ VN_HOLD(vp); stubvp = untraverse(vp); /* ! * If vp/stubvp are same, we must be at system * root because untraverse returned same vp * 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())); vap = sarg->vap; } else { va.va_mask = AT_NODEID; vap = &va; error = rfs4_vop_getattr(stubvp, vap, 0, sarg->cs->cr); --- 1306,1338 ---- vnode_t *stubvp = NULL, *vp; vp = sarg->cs->vp; sarg->mntdfid_set = FALSE; ! /* ! * 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); /* ! * If vp/stubvp are same, we must be at system-or-zone * root because untraverse returned same vp * 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_IS_CURZONEROOT(vp)); vap = sarg->vap; } else { va.va_mask = AT_NODEID; vap = &va; error = rfs4_vop_getattr(stubvp, vap, 0, sarg->cs->cr);
*** 1375,1388 **** if (sarg->op == NFS4ATTR_SETIT) error = EINVAL; break; /* this attr is supported */ case NFS4ATTR_GETIT: case NFS4ATTR_VERIT: ! if (! sarg->mntdfid_set) error = rfs4_get_mntdfileid(cmd, sarg); ! if (! error && sarg->mntdfid_set) { if (cmd == NFS4ATTR_GETIT) na->mounted_on_fileid = sarg->mounted_on_fileid; else if (na->mounted_on_fileid != sarg->mounted_on_fileid) --- 1387,1400 ---- if (sarg->op == NFS4ATTR_SETIT) error = EINVAL; break; /* this attr is supported */ case NFS4ATTR_GETIT: case NFS4ATTR_VERIT: ! if (!sarg->mntdfid_set) error = rfs4_get_mntdfileid(cmd, sarg); ! if (!error && sarg->mntdfid_set) { if (cmd == NFS4ATTR_GETIT) na->mounted_on_fileid = sarg->mounted_on_fileid; else if (na->mounted_on_fileid != sarg->mounted_on_fileid)