Print this page
Be far more judicious in the use of curzone-using macros.
(Merge and extra asserts by danmcd.)
Try to remove assumption that zone's root vnode is marked VROOT

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/zone.h
          +++ new/usr/src/uts/common/sys/zone.h
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright 2014 Igor Kozhukhov <ikozhukhov@gmail.com>.
  25      - * Copyright 2018 Joyent, Inc.
       25 + * Copyright 2019 Joyent, Inc.
  26   26   * Copyright 2019 Nexenta Systems, Inc. All rights reserved.
  27   27   */
  28   28  
  29   29  #ifndef _SYS_ZONE_H
  30   30  #define _SYS_ZONE_H
  31   31  
  32   32  #include <sys/types.h>
  33   33  #include <sys/param.h>
  34   34  #include <sys/tsol/label.h>
  35   35  #include <sys/uadmin.h>
↓ open down ↓ 739 lines elided ↑ open up ↑
 775  775          (ASSERT(ZONE_PATH_VISIBLE(path, zone)), \
 776  776          (path) + (zone)->zone_rootpathlen - 2)
 777  777  
 778  778  /*
 779  779   * Special processes visible in all zones.
 780  780   */
 781  781  #define ZONE_SPECIALPID(x)       ((x) == 0 || (x) == 1)
 782  782  
 783  783  /*
 784  784   * A root vnode of the current zone.
      785 + *
      786 + * NOTE: It may be necessary (initialization time for file sharing where an
      787 + * NGZ loads a file-sharing kernel module that does zsd initialization) to NOT
      788 + * use this macro. One should ASSERT() that curzone == active ZSD (an
      789 + * ASSERTion that's not always true at ZSD initialization time) during regular
      790 + * use of this macro.
 785  791   */
 786      -#define ZONE_ROOTVP()   (curproc->p_zone->zone_rootvp)
      792 +#define ZONE_ROOTVP()   (curzone->zone_rootvp)
 787  793  
 788  794  /*
      795 + * Since a zone's root isn't necessarily an actual filesystem boundary
      796 + * (i.e. VROOT may not be set on zone->zone_rootvp) we need to not assume it.
      797 + * This macro helps in checking if a vnode is the current zone's rootvp.
      798 + * NOTE:  Using the VN_ prefix, even though it's defined here in zone.h.
      799 + * NOTE2: See above warning about ZONE_ROOTVP().
      800 + */
      801 +#define VN_IS_CURZONEROOT(vp)   (VN_CMP(vp, ZONE_ROOTVP()))
      802 +
      803 +/*
 789  804   * Zone-safe version of thread_create() to be used when the caller wants to
 790  805   * create a kernel thread to run within the current zone's context.
 791  806   */
 792  807  extern kthread_t *zthread_create(caddr_t, size_t, void (*)(), void *, size_t,
 793  808      pri_t);
 794  809  extern void zthread_exit(void);
 795  810  
 796  811  /*
 797  812   * Functions for an external observer to register interest in a zone's status
 798  813   * change.  Observers will be woken up when the zone status equals the status
↓ open down ↓ 76 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX