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
*** 20,30 ****
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2014 Igor Kozhukhov <ikozhukhov@gmail.com>.
! * Copyright 2018 Joyent, Inc.
* Copyright 2019 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SYS_ZONE_H
#define _SYS_ZONE_H
--- 20,30 ----
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2014 Igor Kozhukhov <ikozhukhov@gmail.com>.
! * Copyright 2019 Joyent, Inc.
* Copyright 2019 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SYS_ZONE_H
#define _SYS_ZONE_H
*** 780,793 ****
*/
#define ZONE_SPECIALPID(x) ((x) == 0 || (x) == 1)
/*
* A root vnode of the current zone.
*/
! #define ZONE_ROOTVP() (curproc->p_zone->zone_rootvp)
/*
* Zone-safe version of thread_create() to be used when the caller wants to
* create a kernel thread to run within the current zone's context.
*/
extern kthread_t *zthread_create(caddr_t, size_t, void (*)(), void *, size_t,
pri_t);
--- 780,808 ----
*/
#define ZONE_SPECIALPID(x) ((x) == 0 || (x) == 1)
/*
* A root vnode of the current zone.
+ *
+ * NOTE: It may be necessary (initialization time for file sharing where an
+ * NGZ loads a file-sharing kernel module that does zsd initialization) to NOT
+ * use this macro. One should ASSERT() that curzone == active ZSD (an
+ * ASSERTion that's not always true at ZSD initialization time) during regular
+ * use of this macro.
*/
! #define ZONE_ROOTVP() (curzone->zone_rootvp)
/*
+ * Since a zone's root isn't necessarily an actual filesystem boundary
+ * (i.e. VROOT may not be set on zone->zone_rootvp) we need to not assume it.
+ * This macro helps in checking if a vnode is the current zone's rootvp.
+ * NOTE: Using the VN_ prefix, even though it's defined here in zone.h.
+ * NOTE2: See above warning about ZONE_ROOTVP().
+ */
+ #define VN_IS_CURZONEROOT(vp) (VN_CMP(vp, ZONE_ROOTVP()))
+
+ /*
* Zone-safe version of thread_create() to be used when the caller wants to
* create a kernel thread to run within the current zone's context.
*/
extern kthread_t *zthread_create(caddr_t, size_t, void (*)(), void *, size_t,
pri_t);