diff options
Diffstat (limited to 'usr/src/uts/common/sys')
-rw-r--r-- | usr/src/uts/common/sys/fs/mntdata.h | 26 | ||||
-rw-r--r-- | usr/src/uts/common/sys/ipc_impl.h | 9 | ||||
-rw-r--r-- | usr/src/uts/common/sys/lofi.h | 2 | ||||
-rw-r--r-- | usr/src/uts/common/sys/vfs.h | 45 | ||||
-rw-r--r-- | usr/src/uts/common/sys/zone.h | 64 |
5 files changed, 103 insertions, 43 deletions
diff --git a/usr/src/uts/common/sys/fs/mntdata.h b/usr/src/uts/common/sys/fs/mntdata.h index c0cd7ebf30..8d0efeaf48 100644 --- a/usr/src/uts/common/sys/fs/mntdata.h +++ b/usr/src/uts/common/sys/fs/mntdata.h @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _SYS_MNTFS_MNTDATA_H @@ -29,6 +28,7 @@ #include <sys/vnode.h> #include <sys/poll.h> #include <sys/mnttab.h> +#include <sys/zone.h> #ifdef __cplusplus extern "C" { @@ -70,18 +70,6 @@ typedef struct mntnode { mntsnap_t mnt_ioctl; /* data for ioctl() */ } mntnode_t; -struct zone; - -typedef struct mntdata { - struct zone *mnt_zone; /* zone for mount point */ - uint_t mnt_nopen; /* count of vnodes open */ - size_t mnt_size; /* size of last normal snapshot */ - size_t mnt_hidden_size; /* size of last hidden snapshot */ - timespec_t mnt_mtime; /* mtime at last normal snapshot */ - timespec_t mnt_hidden_mtime; /* mtime at last hidden snapshot */ - struct mntnode mnt_node; /* embedded mntnode */ -} mntdata_t; - /* * Conversion macros. */ @@ -95,6 +83,16 @@ typedef struct mntdata { #if defined(_KERNEL) +typedef struct mntdata { + zone_ref_t mnt_zone_ref; /* zone for mount point */ + uint_t mnt_nopen; /* count of vnodes open */ + size_t mnt_size; /* size of last normal snapshot */ + size_t mnt_hidden_size; /* size of last hidden snapshot */ + timespec_t mnt_mtime; /* mtime at last normal snapshot */ + timespec_t mnt_hidden_mtime; /* mtime at last hidden snapshot */ + struct mntnode mnt_node; /* embedded mntnode */ +} mntdata_t; + /* * Value for a mntsnap_t's mnts_flags. */ diff --git a/usr/src/uts/common/sys/ipc_impl.h b/usr/src/uts/common/sys/ipc_impl.h index 712317d2e1..0569c3e967 100644 --- a/usr/src/uts/common/sys/ipc_impl.h +++ b/usr/src/uts/common/sys/ipc_impl.h @@ -19,15 +19,12 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _IPC_IMPL_H #define _IPC_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/ipc.h> #include <sys/mutex.h> @@ -151,7 +148,7 @@ struct msqid_ds64 { (*(rctl_qty_t *)(((char *)&p->ipc_proj->kpj_data.kpd_ipc) + \ s->ipcs_rctlofs)) #define IPC_ZONE_USAGE(p, s) \ - (*(rctl_qty_t *)(((char *)&p->ipc_zone->zone_ipc) + \ + (*(rctl_qty_t *)(((char *)&p->ipc_zone_ref.zref_zone->zone_ipc) + \ s->ipcs_rctlofs)) #define IPC_LOCKED(s, o) \ MUTEX_HELD(&s->ipcs_table[IPC_INDEX(o->ipc_id)].ipct_lock) @@ -172,7 +169,7 @@ typedef struct kipc_perm { kproject_t *ipc_proj; /* creator's project */ uint_t ipc_id; /* id */ zoneid_t ipc_zoneid; /* creator's zone id */ - zone_t *ipc_zone; /* creator's zone */ + zone_ref_t ipc_zone_ref; /* reference to creator's zone */ } kipc_perm_t; typedef struct ipc_slot { diff --git a/usr/src/uts/common/sys/lofi.h b/usr/src/uts/common/sys/lofi.h index 8e385b6fe2..d82cc0341e 100644 --- a/usr/src/uts/common/sys/lofi.h +++ b/usr/src/uts/common/sys/lofi.h @@ -229,7 +229,7 @@ struct lofi_state { struct dk_geom ls_dkg; struct vtoc ls_vtoc; struct dk_cinfo ls_ci; - zone_t *ls_zone; + zone_ref_t ls_zone; list_node_t ls_list; /* all lofis */ dev_t ls_dev; /* this node's dev_t */ diff --git a/usr/src/uts/common/sys/vfs.h b/usr/src/uts/common/sys/vfs.h index 5fca4584eb..ba013a0eda 100644 --- a/usr/src/uts/common/sys/vfs.h +++ b/usr/src/uts/common/sys/vfs.h @@ -33,6 +33,7 @@ #ifndef _SYS_VFS_H #define _SYS_VFS_H +#include <sys/zone.h> #include <sys/types.h> #include <sys/t_lock.h> #include <sys/cred.h> @@ -173,26 +174,6 @@ extern avl_tree_t vskstat_tree; extern kmutex_t vskstat_tree_lock; /* - * Private vfs data, NOT to be used by a file system implementation. - */ - -#define VFS_FEATURE_MAXSZ 4 - -typedef struct vfs_impl { - /* Counted array - Bitmap of vfs features */ - uint32_t vi_featureset[VFS_FEATURE_MAXSZ]; - /* - * Support for statistics on the vnode operations - */ - vsk_anchor_t *vi_vskap; /* anchor for vopstats' kstat */ - vopstats_t *vi_fstypevsp; /* ptr to per-fstype vopstats */ - vopstats_t vi_vopstats; /* per-mount vnode op stats */ - - timespec_t vi_hrctime; /* High-res creation time */ -} vfs_impl_t; - - -/* * Structure per mounted file system. Each mounted file system has * an array of operations and an instance record. * @@ -241,7 +222,7 @@ typedef struct vfs { refstr_t *vfs_resource; /* mounted resource name */ refstr_t *vfs_mntpt; /* mount point name */ time_t vfs_mtime; /* time we were mounted */ - vfs_impl_t *vfs_implp; /* impl specific data */ + struct vfs_impl *vfs_implp; /* impl specific data */ /* * Zones support. Note that the zone that "owns" the mount isn't * necessarily the same as the zone in which the zone is visible. @@ -448,6 +429,28 @@ enum { #define VFSSP_VERBATIM 0x1 /* do not prefix the supplied path */ #if defined(_KERNEL) + +/* + * Private vfs data, NOT to be used by a file system implementation. + */ + +#define VFS_FEATURE_MAXSZ 4 + +typedef struct vfs_impl { + /* Counted array - Bitmap of vfs features */ + uint32_t vi_featureset[VFS_FEATURE_MAXSZ]; + /* + * Support for statistics on the vnode operations + */ + vsk_anchor_t *vi_vskap; /* anchor for vopstats' kstat */ + vopstats_t *vi_fstypevsp; /* ptr to per-fstype vopstats */ + vopstats_t vi_vopstats; /* per-mount vnode op stats */ + + timespec_t vi_hrctime; /* High-res creation time */ + + zone_ref_t vi_zone_ref; /* reference to zone */ +} vfs_impl_t; + /* * Public operations. */ diff --git a/usr/src/uts/common/sys/zone.h b/usr/src/uts/common/sys/zone.h index b89a6902db..3ba7bf47f4 100644 --- a/usr/src/uts/common/sys/zone.h +++ b/usr/src/uts/common/sys/zone.h @@ -204,7 +204,12 @@ typedef struct { #define ZE_AREMOUNTS 2 /* there are mounts within the zone */ #define ZE_LABELINUSE 3 /* label is already in use by some other zone */ -/* zone_status */ +/* + * zone_status values + * + * You must modify zone_status_names in mdb(1M)'s genunix module + * (genunix/zone.c) when you modify this enum. + */ typedef enum { ZONE_IS_UNINITIALIZED = 0, ZONE_IS_INITIALIZED, @@ -274,11 +279,22 @@ typedef struct zone_cmd_rval { */ #define ZONE_DOOR_PATH ZONES_TMPDIR "/%s.zoneadmd_door" + /* zone_flags */ +/* + * Threads that read or write the following flag must hold zone_lock. + */ +#define ZF_REFCOUNTS_LOGGED 0x1 /* a thread logged the zone's refs */ + +/* + * The following threads are set when the zone is created and never changed. + * Threads that test for these flags don't have to hold zone_lock. + */ #define ZF_HASHED_LABEL 0x2 /* zone has a unique label */ #define ZF_IS_SCRATCH 0x4 /* scratch zone */ #define ZF_NET_EXCL 0x8 /* Zone has an exclusive IP stack */ + /* zone_create flags */ #define ZCF_NET_EXCL 0x1 /* Create a zone with exclusive IP */ @@ -298,6 +314,7 @@ typedef struct zone_net_data { #ifdef _KERNEL + /* * We need to protect the definition of 'list_t' from userland applications and * libraries which may be defining ther own versions. @@ -310,6 +327,38 @@ struct pool; struct brand; /* + * Each of these constants identifies a kernel subsystem that acquires and + * releases zone references. Each subsystem that invokes + * zone_hold_ref() and zone_rele_ref() should specify the + * zone_ref_subsys_t constant associated with the subsystem. Tracked holds + * help users and developers quickly identify subsystems that stall zone + * shutdowns indefinitely. + * + * NOTE: You must modify zone_ref_subsys_names in usr/src/uts/common/os/zone.c + * when you modify this enumeration. + */ +typedef enum zone_ref_subsys { + ZONE_REF_NFS, /* NFS */ + ZONE_REF_NFSV4, /* NFSv4 */ + ZONE_REF_SMBFS, /* SMBFS */ + ZONE_REF_MNTFS, /* MNTFS */ + ZONE_REF_LOFI, /* LOFI devices */ + ZONE_REF_VFS, /* VFS infrastructure */ + ZONE_REF_IPC, /* IPC infrastructure */ + ZONE_REF_NUM_SUBSYS /* This must be the last entry. */ +} zone_ref_subsys_t; + +/* + * zone_ref represents a general-purpose references to a zone. Each zone's + * references are linked into the zone's zone_t::zone_ref_list. This allows + * debuggers to walk zones' references. + */ +typedef struct zone_ref { + struct zone *zref_zone; /* the zone to which the reference refers */ + list_node_t zref_linkage; /* linkage for zone_t::zone_ref_list */ +} zone_ref_t; + +/* * Structure to record list of ZFS datasets exported to a zone. */ typedef struct zone_dataset { @@ -353,6 +402,8 @@ typedef struct zone { * zone_lock protects the following fields of a zone_t: * zone_ref * zone_cred_ref + * zone_subsys_ref + * zone_ref_list * zone_ntasks * zone_flags * zone_zsd @@ -368,6 +419,14 @@ typedef struct zone { uint_t zone_ref; /* count of zone_hold()s on zone */ uint_t zone_cred_ref; /* count of zone_hold_cred()s on zone */ /* + * Fixed-sized array of subsystem-specific reference counts + * The sum of all of the counts must be less than or equal to zone_ref. + * The array is indexed by the counts' subsystems' zone_ref_subsys_t + * constants. + */ + uint_t zone_subsys_ref[ZONE_REF_NUM_SUBSYS]; + list_t zone_ref_list; /* list of zone_ref_t structs */ + /* * zone_rootvp and zone_rootpath can never be modified once set. */ struct vnode *zone_rootvp; /* zone's root vnode */ @@ -494,6 +553,9 @@ extern void zone_zsd_init(void); extern void zone_init(void); extern void zone_hold(zone_t *); extern void zone_rele(zone_t *); +extern void zone_init_ref(zone_ref_t *); +extern void zone_hold_ref(zone_t *, zone_ref_t *, zone_ref_subsys_t); +extern void zone_rele_ref(zone_ref_t *, zone_ref_subsys_t); extern void zone_cred_hold(zone_t *); extern void zone_cred_rele(zone_t *); extern void zone_task_hold(zone_t *); |