Print this page
Bad assertions
nfs_export_zone_init() can't assume called in zone-context.
curzone reality check and teardown changes to use the RIGHT zone

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs_export.c
          +++ new/usr/src/uts/common/fs/nfs/nfs_export.c
↓ open down ↓ 684 lines elided ↑ open up ↑
 685  685   * exp_visible linked on its exi_visible list.
 686  686   *
 687  687   * Note: We could add new pointer either to treenode or
 688  688   * to exp_visible, which will point there directly.
 689  689   * This would buy some speed for some memory.
 690  690   */
 691  691  exportinfo_t *
 692  692  vis2exi(treenode_t *tnode)
 693  693  {
 694  694          exportinfo_t *exi_ret = NULL;
      695 +#ifdef DEBUG
      696 +        zone_t *zone = NULL;
      697 +#endif
 695  698  
 696  699          for (;;) {
 697  700                  tnode = tnode->tree_parent;
      701 +#ifdef DEBUG
      702 +                if (zone == NULL && tnode->tree_exi != NULL)
      703 +                        zone = tnode->tree_exi->exi_zone;
      704 +#endif
 698  705                  if (TREE_ROOT(tnode)) {
      706 +                        ASSERT3P(zone, ==, tnode->tree_exi->exi_zone);
 699  707                          exi_ret = tnode->tree_exi;
 700  708                          break;
 701  709                  }
 702  710          }
 703  711  
 704  712          ASSERT(exi_ret); /* Every visible should have its home exportinfo */
 705  713          return (exi_ret);
 706  714  }
 707  715  
 708  716  /*
↓ open down ↓ 159 lines elided ↑ open up ↑
 868  876          ne->exi_root->exi_export.ex_flags = EX_PUBLIC;
 869  877          ne->exi_root->exi_export.ex_pathlen = 1;        /* length of "/" */
 870  878          ne->exi_root->exi_export.ex_path =
 871  879              kmem_alloc(ne->exi_root->exi_export.ex_pathlen + 1, KM_SLEEP);
 872  880          ne->exi_root->exi_export.ex_path[0] = '/';
 873  881          ne->exi_root->exi_export.ex_path[1] = '\0';
 874  882  
 875  883          ne->exi_root->exi_count = 1;
 876  884          mutex_init(&ne->exi_root->exi_lock, NULL, MUTEX_DEFAULT, NULL);
 877  885  
 878      -        ne->exi_root->exi_vp = ZONE_ROOTVP();
      886 +        ne->exi_root->exi_zone = zone_find_by_id_nolock(zoneid);
      887 +        ne->exi_root->exi_vp = ne->exi_root->exi_zone->zone_rootvp;
 879  888          ne->exi_rootfid.fid_len = MAXFIDSZ;
 880  889          if (vop_fid_pseudo(ne->exi_root->exi_vp, &ne->exi_rootfid) != 0) {
 881  890                  mutex_destroy(&ne->exi_root->exi_lock);
 882  891                  kmem_free(ne->exi_root->exi_export.ex_path,
 883  892                      ne->exi_root->exi_export.ex_pathlen + 1);
 884  893                  kmem_free(ne->exi_root, sizeof (*ne->exi_root));
 885  894                  return (NULL);
 886  895          }
 887  896  
 888  897          /* Initialize auth cache and auth cache lock */
↓ open down ↓ 404 lines elided ↑ open up ↑
1293 1302          }
1294 1303          DTRACE_PROBE(nfss__i__exported_lock2_stop);
1295 1304          rw_exit(&ne->exported_lock);
1296 1305          pn_free(&lookpn);
1297 1306  
1298 1307          exi = kmem_zalloc(sizeof (*exi), KM_SLEEP);
1299 1308          exi->exi_fsid = fsid;
1300 1309          exi->exi_fid = fid;
1301 1310          exi->exi_vp = vp;
1302 1311          exi->exi_count = 1;
1303      -        exi->exi_zoneid = crgetzoneid(cr);
     1312 +        exi->exi_zone = crgetzone(cr);
     1313 +        ASSERT(exi->exi_zone != NULL);          /* XXX KEBE ASKS... */
     1314 +        ASSERT3P(exi->exi_zone, ==, curzone);   /* ... are these legit? */
1304 1315          exi->exi_volatile_dev = (vfssw[vp->v_vfsp->vfs_fstype].vsw_flag &
1305 1316              VSW_VOLATILEDEV) ? 1 : 0;
1306 1317          mutex_init(&exi->exi_lock, NULL, MUTEX_DEFAULT, NULL);
1307 1318          exi->exi_dvp = dvp;
1308 1319  
1309 1320          /*
1310 1321           * Initialize auth cache and auth cache lock
1311 1322           */
1312 1323          for (i = 0; i < AUTH_TABLESIZE; i++) {
1313 1324                  exi->exi_cache[i] = kmem_alloc(sizeof (avl_tree_t), KM_SLEEP);
↓ open down ↓ 493 lines elided ↑ open up ↑
1807 1818           * for paths to exports below.
1808 1819           */
1809 1820          if (exi->exi_visible != NULL) {
1810 1821                  struct exportinfo *newexi;
1811 1822  
1812 1823                  newexi = pseudo_exportfs(ne, exi->exi_vp, &exi->exi_fid,
1813 1824                      exi->exi_visible, &exi->exi_export);
1814 1825                  exi->exi_visible = NULL;
1815 1826  
1816 1827                  /* interconnect the existing treenode with the new exportinfo */
     1828 +                newexi->exi_zone = exi->exi_zone;
1817 1829                  newexi->exi_tree = exi->exi_tree;
1818 1830                  newexi->exi_tree->tree_exi = newexi;
1819 1831  
1820 1832                  /* Update the change timestamp */
1821 1833                  tree_update_change(ne, exi->exi_tree, NULL);
1822 1834          } else {
1823 1835                  treeclimb_unexport(ne, exi);
1824 1836          }
1825 1837  
1826 1838          rw_exit(&ne->exported_lock);
↓ open down ↓ 9 lines elided ↑ open up ↑
1836 1848          /*
1837 1849           * Notify the lock manager that the filesystem is being
1838 1850           * unexported.
1839 1851           */
1840 1852          lm_unexport(exi);
1841 1853  
1842 1854          /*
1843 1855           * If this was a public export, restore
1844 1856           * the public filehandle to the root.
1845 1857           */
     1858 +
     1859 +        /*
     1860 +         * XXX KEBE ASKS --> Should CRED() instead be
     1861 +         * exi->exi_zone->zone_kcred?
     1862 +         */
1846 1863          if (exi == ne->exi_public) {
1847 1864                  ne->exi_public = ne->exi_root;
1848 1865  
1849 1866                  nfslog_share_record(ne->exi_public, CRED());
1850 1867          }
1851 1868  
1852 1869          if (exi->exi_export.ex_flags & EX_LOG)
1853 1870                  nfslog_unshare_record(exi, CRED());
1854 1871  
1855 1872          exi_rele(exi);
↓ open down ↓ 1019 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX