Print this page
curzone reality check and teardown changes to use the RIGHT zone


 464 /* Access to treenode_t is under protection of exported_lock RW_LOCK */
 465 typedef struct treenode {
 466         /* support for generic n-ary trees */
 467         struct treenode *tree_parent;
 468         struct treenode *tree_child_first;
 469         struct treenode *tree_sibling; /* next sibling */
 470         /* private, nfs specific part */
 471         struct exportinfo  *tree_exi;
 472         struct exp_visible *tree_vis;
 473 } treenode_t;
 474 
 475 /*
 476  * TREE_ROOT checks if the node corresponds to a filesystem root or
 477  * the zone's root directory.
 478  * TREE_EXPORTED checks if the node is explicitly shared
 479  */
 480 
 481 #define TREE_ROOT(t) \
 482         ((t)->tree_exi != NULL && \
 483         (((t)->tree_exi->exi_vp->v_flag & VROOT) || \
 484         VN_IS_CURZONEROOT((t)->tree_exi->exi_vp)))
 485 
 486 #define TREE_EXPORTED(t) \
 487         ((t)->tree_exi && !PSEUDO((t)->tree_exi))
 488 
 489 #define EXPTABLESIZE   256
 490 
 491 struct exp_hash {
 492         struct exportinfo       *prev;  /* ptr to the previous exportinfo */
 493         struct exportinfo       *next;  /* ptr to the next exportinfo */
 494         struct exportinfo       **bckt; /* backpointer to the hash bucket */
 495 };
 496 
 497 /*
 498  * A node associated with an export entry on the
 499  * list of exported filesystems.
 500  *
 501  * exi_count+exi_lock protects an individual exportinfo from being freed
 502  * when in use.
 503  *
 504  * You must have the writer lock on exported_lock to add/delete an exportinfo


 516         struct exportdata       exi_export;
 517         fsid_t                  exi_fsid;
 518         struct fid              exi_fid;
 519         struct exp_hash         fid_hash;
 520         struct exp_hash         path_hash;
 521         struct treenode         *exi_tree;
 522         fhandle_t               exi_fh;
 523         krwlock_t               exi_cache_lock;
 524         kmutex_t                exi_lock;
 525         uint_t                  exi_count;
 526         vnode_t                 *exi_vp;
 527         vnode_t                 *exi_dvp;
 528         avl_tree_t              *exi_cache[AUTH_TABLESIZE];
 529         struct log_buffer       *exi_logbuffer;
 530         struct exp_visible      *exi_visible;
 531         struct charset_cache    *exi_charset;
 532         unsigned                exi_volatile_dev:1;
 533         unsigned                exi_moved:1;
 534         int                     exi_id;
 535         avl_node_t              exi_id_link;
 536         zoneid_t                exi_zoneid;













 537 #ifdef VOLATILE_FH_TEST
 538         uint32_t                exi_volatile_id;
 539         struct ex_vol_rename    *exi_vol_rename;
 540         kmutex_t                exi_vol_rename_lock;
 541 #endif /* VOLATILE_FH_TEST */
 542 };

 543 
 544 typedef struct exportinfo exportinfo_t;
 545 typedef struct exportdata exportdata_t;
 546 typedef struct secinfo secinfo_t;
 547 
 548 /*
 549  * exp_visible is a visible list per filesystem. It is for filesystems
 550  * that may need a limited view of its contents. A pseudo export and
 551  * a real export at the mount point (VROOT) which has a subtree shared
 552  * has a visible list.
 553  *
 554  * The exi_visible field is NULL for normal, non-pseudo filesystems
 555  * which do not have any subtree exported. If the field is non-null,
 556  * it points to a list of visible entries, identified by vis_fid and/or
 557  * vis_ino. The presence of a "visible" list means that if this export
 558  * can only have a limited view, it can only view the entries in the
 559  * exp_visible list. The directories in the fid list comprise paths that
 560  * lead to exported directories.
 561  *
 562  * The vis_count field records the number of paths in this filesystem




 464 /* Access to treenode_t is under protection of exported_lock RW_LOCK */
 465 typedef struct treenode {
 466         /* support for generic n-ary trees */
 467         struct treenode *tree_parent;
 468         struct treenode *tree_child_first;
 469         struct treenode *tree_sibling; /* next sibling */
 470         /* private, nfs specific part */
 471         struct exportinfo  *tree_exi;
 472         struct exp_visible *tree_vis;
 473 } treenode_t;
 474 
 475 /*
 476  * TREE_ROOT checks if the node corresponds to a filesystem root or
 477  * the zone's root directory.
 478  * TREE_EXPORTED checks if the node is explicitly shared
 479  */
 480 
 481 #define TREE_ROOT(t) \
 482         ((t)->tree_exi != NULL && \
 483         (((t)->tree_exi->exi_vp->v_flag & VROOT) || \
 484         VN_CMP((t)->tree_exi->exi_zone->zone_rootvp, (t)->tree_exi->exi_vp)))
 485 
 486 #define TREE_EXPORTED(t) \
 487         ((t)->tree_exi && !PSEUDO((t)->tree_exi))
 488 
 489 #define EXPTABLESIZE   256
 490 
 491 struct exp_hash {
 492         struct exportinfo       *prev;  /* ptr to the previous exportinfo */
 493         struct exportinfo       *next;  /* ptr to the next exportinfo */
 494         struct exportinfo       **bckt; /* backpointer to the hash bucket */
 495 };
 496 
 497 /*
 498  * A node associated with an export entry on the
 499  * list of exported filesystems.
 500  *
 501  * exi_count+exi_lock protects an individual exportinfo from being freed
 502  * when in use.
 503  *
 504  * You must have the writer lock on exported_lock to add/delete an exportinfo


 516         struct exportdata       exi_export;
 517         fsid_t                  exi_fsid;
 518         struct fid              exi_fid;
 519         struct exp_hash         fid_hash;
 520         struct exp_hash         path_hash;
 521         struct treenode         *exi_tree;
 522         fhandle_t               exi_fh;
 523         krwlock_t               exi_cache_lock;
 524         kmutex_t                exi_lock;
 525         uint_t                  exi_count;
 526         vnode_t                 *exi_vp;
 527         vnode_t                 *exi_dvp;
 528         avl_tree_t              *exi_cache[AUTH_TABLESIZE];
 529         struct log_buffer       *exi_logbuffer;
 530         struct exp_visible      *exi_visible;
 531         struct charset_cache    *exi_charset;
 532         unsigned                exi_volatile_dev:1;
 533         unsigned                exi_moved:1;
 534         int                     exi_id;
 535         avl_node_t              exi_id_link;
 536         /*
 537          * Soft-reference/backpointer to the zone.  The ZSD callbacks we have
 538          * invoke cleanup code that crosses into OTHER cleanup functions that
 539          * may assume same-zone context and attempt to find their own ZSD,
 540          * using "curzone" when in fact "curzone" is global when called from
 541          * NFS's ZSD cleanup (see lm_unexport->nlm_unexport for an example).
 542          *
 543          * During ZSD shutdown or destroy callbacks, the zone structure
 544          * does not have its mutex held, and it has just-enough references
 545          * to not free from underneath us.  This field is not a proper
 546          * referenced-held zone pointer, and only ZSD callbacks should use
 547          * it.
 548          */
 549         struct zone             *exi_zone;
 550 #ifdef VOLATILE_FH_TEST
 551         uint32_t                exi_volatile_id;
 552         struct ex_vol_rename    *exi_vol_rename;
 553         kmutex_t                exi_vol_rename_lock;
 554 #endif /* VOLATILE_FH_TEST */
 555 };
 556 #define exi_zoneid exi_zone->zone_id
 557 
 558 typedef struct exportinfo exportinfo_t;
 559 typedef struct exportdata exportdata_t;
 560 typedef struct secinfo secinfo_t;
 561 
 562 /*
 563  * exp_visible is a visible list per filesystem. It is for filesystems
 564  * that may need a limited view of its contents. A pseudo export and
 565  * a real export at the mount point (VROOT) which has a subtree shared
 566  * has a visible list.
 567  *
 568  * The exi_visible field is NULL for normal, non-pseudo filesystems
 569  * which do not have any subtree exported. If the field is non-null,
 570  * it points to a list of visible entries, identified by vis_fid and/or
 571  * vis_ino. The presence of a "visible" list means that if this export
 572  * can only have a limited view, it can only view the entries in the
 573  * exp_visible list. The directories in the fid list comprise paths that
 574  * lead to exported directories.
 575  *
 576  * The vis_count field records the number of paths in this filesystem