Print this page
Untrip aggressive assert AND use EXI_TO_ZONEROOTVP
Revert exi_zone to exi_zoneid, and install exi_ne backpointer
@@ -691,28 +691,21 @@
*/
exportinfo_t *
vis2exi(treenode_t *tnode)
{
exportinfo_t *exi_ret = NULL;
-#ifdef DEBUG
- zone_t *zone = NULL;
-#endif
for (;;) {
tnode = tnode->tree_parent;
-#ifdef DEBUG
- if (zone == NULL && tnode->tree_exi != NULL)
- zone = tnode->tree_exi->exi_zone;
-#endif
if (TREE_ROOT(tnode)) {
- ASSERT3P(zone, ==, tnode->tree_exi->exi_zone);
exi_ret = tnode->tree_exi;
break;
}
}
- ASSERT(exi_ret); /* Every visible should have its home exportinfo */
+ /* Every visible should have its home exportinfo */
+ ASSERT(exi_ret != NULL);
return (exi_ret);
}
/*
* For NFS V4.
@@ -724,11 +717,10 @@
int seccnt, bool_t isadd)
{
treenode_t *tnode;
ASSERT(RW_WRITE_HELD(&ne->exported_lock));
- ASSERT3U(exip->exi_zoneid, ==, curzone->zone_id);
/*
* exi_tree can be null for the zone root
* which means we're already at the "top"
* and there's nothing more to "climb".
@@ -749,11 +741,11 @@
* its pseudonode.
* Note - for VROOT exports the implicitly allowed flavors were
* transferred from the PSEUDO export in exportfs()
*/
if (isadd && !(exip->exi_vp->v_flag & VROOT) &&
- !VN_IS_CURZONEROOT(exip->exi_vp) &&
+ !VN_CMP(exip->exi_vp, EXI_TO_ZONEROOTVP(exip)) &&
tnode->tree_vis->vis_seccnt > 0) {
srv_secinfo_add(&exip->exi_export.ex_secinfo,
&exip->exi_export.ex_seccnt, tnode->tree_vis->vis_secinfo,
tnode->tree_vis->vis_seccnt, FALSE);
}
@@ -822,10 +814,11 @@
exp_hash_link(exi, fid_hash, bckt);
bckt = &ne->exptable_path_hash[pkp_tab_hash(exi->exi_export.ex_path,
strlen(exi->exi_export.ex_path))];
exp_hash_link(exi, path_hash, bckt);
+ exi->exi_ne = ne;
}
/*
* Helper functions for exi_id handling
*/
@@ -928,15 +921,18 @@
/*
* Because we cannot:
* ASSERT(curzone->zone_id == ng->nfs_zoneid);
* We grab the zone pointer explicitly (like netstacks do) and
* set the rootvp here.
+ *
+ * Subsequent exportinfo_t's that get export_link()ed to "ne" also
+ * will backpoint to "ne" such that exi->exi_ne->exi_root->exi_vp
+ * will get the zone's rootvp for a given exportinfo_t.
*/
zone = zone_find_by_id_nolock(ng->nfs_zoneid);
ne->exi_root->exi_vp = zone->zone_rootvp;
- ne->exi_root->exi_zone = zone; /* XXX KEBE SAYS lose me, and... */
- /* ne->exi_root->exi_zoneid = ng->nfs_zoneid; */ /* use me instead! */
+ ne->exi_root->exi_zoneid = ng->nfs_zoneid;
/*
* Fill in ne->exi_rootfid later, in nfs_export_get_rootfid
* because we can't correctly return errors here.
*/
@@ -1410,13 +1406,12 @@
exi = kmem_zalloc(sizeof (*exi), KM_SLEEP);
exi->exi_fsid = fsid;
exi->exi_fid = fid;
exi->exi_vp = vp;
exi->exi_count = 1;
- exi->exi_zone = crgetzone(cr);
- ASSERT(exi->exi_zone != NULL); /* XXX KEBE ASKS... */
- ASSERT3P(exi->exi_zone, ==, curzone); /* ... are these legit? */
+ exi->exi_zoneid = crgetzoneid(cr);
+ ASSERT3U(exi->exi_zoneid, ==, curzone->zone_id);
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);
exi->exi_dvp = dvp;
@@ -1882,10 +1877,12 @@
{
ASSERT(RW_WRITE_HELD(&ne->exported_lock));
exp_hash_unlink(exi, fid_hash);
exp_hash_unlink(exi, path_hash);
+ ASSERT3P(exi->exi_ne, ==, ne);
+ exi->exi_ne = NULL;
}
/*
* Unexport an exported filesystem
*/
@@ -1926,11 +1923,10 @@
newexi = pseudo_exportfs(ne, exi->exi_vp, &exi->exi_fid,
exi->exi_visible, &exi->exi_export);
exi->exi_visible = NULL;
/* interconnect the existing treenode with the new exportinfo */
- newexi->exi_zone = exi->exi_zone; /* XXX KEBE SAYS LOSE ME */
newexi->exi_tree = exi->exi_tree;
newexi->exi_tree->tree_exi = newexi;
/* Update the change timestamp */
tree_update_change(ne, exi->exi_tree, NULL);