Print this page
Revert exi_zone to exi_zoneid, and install exi_ne backpointer
curzone reality check and teardown changes to use the RIGHT zone
Try to remove assumption that zone's root vnode is marked VROOT

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/nfs/export.h
          +++ new/usr/src/uts/common/nfs/export.h
↓ open down ↓ 30 lines elided ↑ open up ↑
  31   31  
  32   32  #ifndef _NFS_EXPORT_H
  33   33  #define _NFS_EXPORT_H
  34   34  
  35   35  #include <nfs/nfs_sec.h>
  36   36  #include <nfs/auth.h>
  37   37  #include <sys/vnode.h>
  38   38  #include <nfs/nfs4.h>
  39   39  #include <sys/kiconv.h>
  40   40  #include <sys/avl.h>
       41 +#include <sys/zone.h>
  41   42  
  42   43  #ifdef _KERNEL
  43   44  #include <sys/pkp_hash.h> /* for PKP_HASH_SIZE */
  44   45  #endif /* _KERNEL */
  45   46  
  46   47  #ifdef  __cplusplus
  47   48  extern "C" {
  48   49  #endif
  49   50  
  50   51  /*
↓ open down ↓ 414 lines elided ↑ open up ↑
 465  466          /* support for generic n-ary trees */
 466  467          struct treenode *tree_parent;
 467  468          struct treenode *tree_child_first;
 468  469          struct treenode *tree_sibling; /* next sibling */
 469  470          /* private, nfs specific part */
 470  471          struct exportinfo  *tree_exi;
 471  472          struct exp_visible *tree_vis;
 472  473  } treenode_t;
 473  474  
 474  475  /*
 475      - * TREE_ROOT checks if the node corresponds to a filesystem root
      476 + * Now that we have links to chase, we can get the zone rootvp just from
      477 + * an export.  No current-zone-context needed.
      478 + */
      479 +#define EXI_TO_ZONEROOTVP(exi) ((exi)->exi_ne->exi_root->exi_vp)
      480 +
      481 +/*
      482 + * TREE_ROOT checks if the node corresponds to a filesystem root or
      483 + * the zone's root directory.
 476  484   * TREE_EXPORTED checks if the node is explicitly shared
 477  485   */
 478  486  
 479  487  #define TREE_ROOT(t) \
 480      -        ((t)->tree_exi && (t)->tree_exi->exi_vp->v_flag & VROOT)
      488 +        ((t)->tree_exi != NULL && \
      489 +        (((t)->tree_exi->exi_vp->v_flag & VROOT) || \
      490 +        VN_CMP(EXI_TO_ZONEROOTVP((t)->tree_exi), (t)->tree_exi->exi_vp)))
 481  491  
 482  492  #define TREE_EXPORTED(t) \
 483  493          ((t)->tree_exi && !PSEUDO((t)->tree_exi))
 484  494  
 485  495  #define EXPTABLESIZE   256
 486  496  
 487  497  struct exp_hash {
 488  498          struct exportinfo       *prev;  /* ptr to the previous exportinfo */
 489  499          struct exportinfo       *next;  /* ptr to the next exportinfo */
 490  500          struct exportinfo       **bckt; /* backpointer to the hash bucket */
↓ open down ↓ 21 lines elided ↑ open up ↑
 512  522          struct exportdata       exi_export;
 513  523          fsid_t                  exi_fsid;
 514  524          struct fid              exi_fid;
 515  525          struct exp_hash         fid_hash;
 516  526          struct exp_hash         path_hash;
 517  527          struct treenode         *exi_tree;
 518  528          fhandle_t               exi_fh;
 519  529          krwlock_t               exi_cache_lock;
 520  530          kmutex_t                exi_lock;
 521  531          uint_t                  exi_count;
      532 +        zoneid_t                exi_zoneid;
 522  533          vnode_t                 *exi_vp;
 523  534          vnode_t                 *exi_dvp;
 524  535          avl_tree_t              *exi_cache[AUTH_TABLESIZE];
 525  536          struct log_buffer       *exi_logbuffer;
 526  537          struct exp_visible      *exi_visible;
 527  538          struct charset_cache    *exi_charset;
 528  539          unsigned                exi_volatile_dev:1;
 529  540          unsigned                exi_moved:1;
 530  541          int                     exi_id;
 531  542          avl_node_t              exi_id_link;
 532      -        zoneid_t                exi_zoneid;
      543 +        /*
      544 +         * Soft-reference/backpointer to zone's nfs_export_t.
      545 +         * This allows us access to the zone's rootvp (stored in
      546 +         * exi_ne->exi_root->exi_vp) even if the current thread isn't in
      547 +         * same-zone context.
      548 +         */
      549 +        struct nfs_export       *exi_ne;
 533  550  #ifdef VOLATILE_FH_TEST
 534  551          uint32_t                exi_volatile_id;
 535  552          struct ex_vol_rename    *exi_vol_rename;
 536  553          kmutex_t                exi_vol_rename_lock;
 537  554  #endif /* VOLATILE_FH_TEST -- keep last! */
 538  555  };
 539  556  
 540  557  typedef struct exportinfo exportinfo_t;
 541  558  typedef struct exportdata exportdata_t;
 542  559  typedef struct secinfo secinfo_t;
↓ open down ↓ 107 lines elided ↑ open up ↑
 650  667          struct exportinfo *exptable_path_hash[PKP_HASH_SIZE];
 651  668          struct exportinfo *exptable[EXPTABLESIZE];
 652  669  
 653  670          /*
 654  671           * Read/Write lock that protects the exportinfo list.  This lock
 655  672           * must be held when searching or modifiying the exportinfo list.
 656  673           */
 657  674          krwlock_t exported_lock;
 658  675  
 659  676          /* "public" and default (root) location for public filehandle */
 660      -        struct exportinfo *exi_public, *exi_root;
      677 +        struct exportinfo *exi_public;
      678 +        struct exportinfo *exi_root;
 661  679          /* For checking default public file handle */
 662  680          fid_t exi_rootfid;
 663  681          /* For comparing V2 filehandles */
 664  682          fhandle_t nullfh2;
 665  683  
 666  684          /* The change attribute value of the root of nfs pseudo namespace */
 667  685          timespec_t ns_root_change;
 668  686  } nfs_export_t;
 669  687  
 670  688  /*
↓ open down ↓ 60 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX