Print this page
Try to remove assumption that zone's root vnode is marked VROOT
@@ -20,11 +20,11 @@
*/
/*
* 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 Joyent, Inc.
* Copyright 2019 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SYS_ZONE_H
#define _SYS_ZONE_H
@@ -781,13 +781,21 @@
#define ZONE_SPECIALPID(x) ((x) == 0 || (x) == 1)
/*
* A root vnode of the current zone.
*/
-#define ZONE_ROOTVP() (curproc->p_zone->zone_rootvp)
+#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.
+ */
+#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);