Print this page
Revert exi_zone to exi_zoneid, and install exi_ne backpointer

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs4_srv_ns.c
          +++ new/usr/src/uts/common/fs/nfs/nfs4_srv_ns.c
↓ open down ↓ 157 lines elided ↑ open up ↑
 158  158          ASSERT(RW_WRITE_HELD(&ne->exported_lock));
 159  159  
 160  160          fsid = vp->v_vfsp->vfs_fsid;
 161  161          exi = kmem_zalloc(sizeof (*exi), KM_SLEEP);
 162  162          exi->exi_fsid = fsid;
 163  163          exi->exi_fid = *fid;
 164  164          exi->exi_vp = vp;
 165  165          VN_HOLD(exi->exi_vp);
 166  166          exi->exi_visible = vis_head;
 167  167          exi->exi_count = 1;
 168      -        /* Caller will set exi_zone... */
 169      -        /* XXX KEBE SAYS Uncomment me or fix in the caller */
 170      -        /* exi->exi_zoneid = ne->ne_globals->nfs_zoneid; */
      168 +        exi->exi_zoneid = ne->ne_globals->nfs_zoneid;
 171  169          exi->exi_volatile_dev = (vfssw[vp->v_vfsp->vfs_fstype].vsw_flag &
 172  170              VSW_VOLATILEDEV) ? 1 : 0;
 173  171          mutex_init(&exi->exi_lock, NULL, MUTEX_DEFAULT, NULL);
 174  172  
 175  173          /*
 176  174           * Build up the template fhandle
 177  175           */
 178  176          exi->exi_fh.fh_fsid = fsid;
 179  177          ASSERT(exi->exi_fid.fid_len <= sizeof (exi->exi_fh.fh_xdata));
 180  178          exi->exi_fh.fh_xlen = exi->exi_fid.fid_len;
↓ open down ↓ 454 lines elided ↑ open up ↑
 635  633          vnode_t *dvp, *vp;
 636  634          fid_t fid;
 637  635          int error;
 638  636          int exportdir;
 639  637          struct exportinfo *new_exi = exip;
 640  638          struct exp_visible *visp;
 641  639          struct exp_visible *vis_head = NULL;
 642  640          struct vattr va;
 643  641          treenode_t *tree_head = NULL;
 644  642          timespec_t now;
 645      -        nfs_export_t *ne = nfs_get_export();
      643 +        nfs_export_t *ne;
 646  644  
      645 +        ne = exip->exi_ne;
      646 +        ASSERT3P(ne, ==, nfs_get_export());     /* curzone reality check */
 647  647          ASSERT(RW_WRITE_HELD(&ne->exported_lock));
 648      -        ASSERT3P(curzone, ==, exip->exi_zone);
 649  648  
 650  649          gethrestime(&now);
 651  650  
 652  651          vp = exip->exi_vp;
 653  652          VN_HOLD(vp);
 654  653          exportdir = 1;
 655  654  
 656  655          for (;;) {
 657  656  
 658  657                  bzero(&fid, sizeof (fid));
 659  658                  fid.fid_len = MAXFIDSZ;
 660  659                  error = vop_fid_pseudo(vp, &fid);
 661  660                  if (error)
 662  661                          break;
 663  662  
      663 +                /* XXX KEBE ASKS DO WE NEED THIS?!? */
 664  664                  ASSERT3U(exip->exi_zoneid, ==, curzone->zone_id);
 665  665                  /*
 666  666                   * The root of the file system, or the zone's root for
 667  667                   * in-zone NFS service needs special handling
 668  668                   */
 669      -                if (vp->v_flag & VROOT || VN_IS_CURZONEROOT(vp)) {
      669 +                if (vp->v_flag & VROOT || vp == EXI_TO_ZONEROOTVP(exip)) {
 670  670                          if (!exportdir) {
 671  671                                  struct exportinfo *exi;
 672  672  
 673  673                                  /*
 674  674                                   * Check if this VROOT dir is already exported.
 675  675                                   * If so, then attach the pseudonodes.  If not,
 676  676                                   * then continue .. traversal until we hit a
 677  677                                   * VROOT export (pseudo or real).
 678  678                                   */
 679  679                                  exi = checkexport4(&vp->v_vfsp->vfs_fsid, &fid,
↓ open down ↓ 11 lines elided ↑ open up ↑
 691  691                                  }
 692  692  
 693  693                                  /*
 694  694                                   * Found the root directory of a filesystem
 695  695                                   * that isn't exported.  Need to export
 696  696                                   * this as a pseudo export so that an NFS v4
 697  697                                   * client can do lookups in it.
 698  698                                   */
 699  699                                  new_exi = pseudo_exportfs(ne, vp, &fid,
 700  700                                      vis_head, NULL);
 701      -                                /* XXX KEBE SAYS NUKE ME */
 702      -                                new_exi->exi_zone = exip->exi_zone;
 703  701                                  vis_head = NULL;
 704  702                          }
 705  703  
 706  704                          if (VN_IS_CURZONEROOT(vp)) {
 707  705                                  /* at system root */
 708  706                                  /*
 709  707                                   * If sharing "/", new_exi is shared exportinfo
 710  708                                   * (exip). Otherwise, new_exi is exportinfo
 711  709                                   * created by pseudo_exportfs() above.
 712  710                                   */
↓ open down ↓ 122 lines elided ↑ open up ↑
 835  833   * has children or is a real export, then we might still need
 836  834   * to continue releasing visibles, until we reach VROOT or zone's root node.
 837  835   */
 838  836  void
 839  837  treeclimb_unexport(nfs_export_t *ne, struct exportinfo *exip)
 840  838  {
 841  839          treenode_t *tnode, *old_nd;
 842  840          treenode_t *connect_point = NULL;
 843  841  
 844  842          ASSERT(RW_WRITE_HELD(&ne->exported_lock));
 845      -        ASSERT(curzone == exip->exi_zone || curzone == global_zone);
      843 +        ASSERT(curzone->zone_id == exip->exi_zoneid ||
      844 +            curzone->zone_id == global_zone->zone_id);
 846  845  
 847  846          /*
 848  847           * exi_tree can be null for the zone root
 849  848           * which means we're already at the "top"
 850  849           * and there's nothing more to "climb".
 851  850           */
 852  851          tnode = exip->exi_tree;
 853  852          if (tnode == NULL) {
 854  853                  /* Should only happen for... */
 855  854                  ASSERT(exip == ne->exi_root);
↓ open down ↓ 142 lines elided ↑ open up ↑
 998  997          fid_t fid;
 999  998          bool_t vp_is_exported;
1000  999  
1001 1000          vp_is_exported = VN_CMP(vp, exi->exi_vp);
1002 1001  
1003 1002          /*
1004 1003           * An exported root vnode has a sub-dir shared if it has a visible
1005 1004           * list.  i.e. if it does not have a visible list, then there is no
1006 1005           * node in this filesystem leads to any other shared node.
1007 1006           */
1008      -        ASSERT3P(curzone, ==, exi->exi_zone);
     1007 +        ASSERT3P(curzone->zone_id, ==, exi->exi_zoneid);
1009 1008          if (vp_is_exported &&
1010 1009              ((vp->v_flag & VROOT) || VN_IS_CURZONEROOT(vp))) {
1011 1010                  return (exi->exi_visible ? 1 : 0);
1012 1011          }
1013 1012  
1014 1013          /*
1015 1014           * Only the exportinfo of a fs root node may have a visible list.
1016 1015           * Either it is a pseudo root node, or a real exported root node.
1017 1016           */
1018 1017          exi = get_root_export(exi);
↓ open down ↓ 274 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX