diff options
Diffstat (limited to 'usr/src/uts/common/fs')
| -rw-r--r-- | usr/src/uts/common/fs/mntfs/mntvfsops.c | 5 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/mntfs/mntvnops.c | 10 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/nfs/nfs3_vfsops.c | 7 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_client.c | 6 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_vfsops.c | 13 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/nfs/nfs_client.c | 5 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/nfs/nfs_vfsops.c | 7 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/smbclnt/smbfs/smbfs.h | 6 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/smbclnt/smbfs/smbfs_client.c | 9 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c | 17 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vnops.c | 56 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/vfs.c | 11 |
12 files changed, 83 insertions, 69 deletions
diff --git a/usr/src/uts/common/fs/mntfs/mntvfsops.c b/usr/src/uts/common/fs/mntfs/mntvfsops.c index 8f7f7c9f75..9c81e9bc89 100644 --- a/usr/src/uts/common/fs/mntfs/mntvfsops.c +++ b/usr/src/uts/common/fs/mntfs/mntvfsops.c @@ -213,7 +213,8 @@ mntmount(struct vfs *vfsp, struct vnode *mvp, } mutex_exit(&mvp->v_lock); - zone_hold(mnt->mnt_zone = zone); + zone_init_ref(&mnt->mnt_zone_ref); + zone_hold_ref(zone, &mnt->mnt_zone_ref, ZONE_REF_MNTFS); mnp = &mnt->mnt_node; vfsp->vfs_fstype = mntfstype; @@ -256,7 +257,7 @@ mntunmount(struct vfs *vfsp, int flag, struct cred *cr) } mutex_exit(&vp->v_lock); - zone_rele(mnt->mnt_zone); + zone_rele_ref(&mnt->mnt_zone_ref, ZONE_REF_MNTFS); vn_invalid(vp); vn_free(vp); kmem_free(mnt, sizeof (*mnt)); diff --git a/usr/src/uts/common/fs/mntfs/mntvnops.c b/usr/src/uts/common/fs/mntfs/mntvnops.c index da72519dd2..7fff58a602 100644 --- a/usr/src/uts/common/fs/mntfs/mntvnops.c +++ b/usr/src/uts/common/fs/mntfs/mntvnops.c @@ -398,7 +398,7 @@ mntfs_get_next_elem(mntsnap_t *snapp, mntelem_t *elemp) static void mntfs_freesnap(mntnode_t *mnp, mntsnap_t *snapp) { - zone_t *zonep = MTOD(mnp)->mnt_zone; + zone_t *zonep = MTOD(mnp)->mnt_zone_ref.zref_zone; krwlock_t *dblockp = &zonep->zone_mntfs_db_lock; mntelem_t **elempp = &zonep->zone_mntfs_db; mntelem_t *elemp; @@ -500,7 +500,7 @@ static void mntfs_snapshot(mntnode_t *mnp, mntsnap_t *snapp) { mntdata_t *mnd = MTOD(mnp); - zone_t *zonep = mnd->mnt_zone; + zone_t *zonep = mnd->mnt_zone_ref.zref_zone; int is_global_zone = (zonep == global_zone); int show_hidden = mnp->mnt_flags & MNT_SHOWHIDDEN; vfs_t *vfsp, *firstvfsp, *lastvfsp; @@ -885,7 +885,7 @@ static int mntread(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cred, caller_context_t *ct) { mntnode_t *mnp = VTOM(vp); - zone_t *zonep = MTOD(mnp)->mnt_zone; + zone_t *zonep = MTOD(mnp)->mnt_zone_ref.zref_zone; mntsnap_t *snapp = &mnp->mnt_read; off_t off = uio->uio_offset; size_t len = uio->uio_resid; @@ -1472,7 +1472,7 @@ mntioctl(struct vnode *vp, int cmd, intptr_t arg, int flag, cred_t *cr, mntnode_t *mnp = VTOM(vp); mntsnap_t *snapp = &mnp->mnt_ioctl; int error = 0; - zone_t *zonep = MTOD(mnp)->mnt_zone; + zone_t *zonep = MTOD(mnp)->mnt_zone_ref.zref_zone; krwlock_t *dblockp = &zonep->zone_mntfs_db_lock; model_t datamodel = flag & DATAMODEL_MASK; @@ -1554,7 +1554,7 @@ mntioctl(struct vnode *vp, int cmd, intptr_t arg, int flag, cred_t *cr, size_t len; uint_t start = 0; mntdata_t *mntdata = MTOD(mnp); - zone_t *zone = mntdata->mnt_zone; + zone_t *zone = mntdata->mnt_zone_ref.zref_zone; STRUCT_INIT(tagdesc, flag & DATAMODEL_MASK); if (copyin(dp, STRUCT_BUF(tagdesc), STRUCT_SIZE(tagdesc))) { diff --git a/usr/src/uts/common/fs/nfs/nfs3_vfsops.c b/usr/src/uts/common/fs/nfs/nfs3_vfsops.c index 2111e9fabf..207a708771 100644 --- a/usr/src/uts/common/fs/nfs/nfs3_vfsops.c +++ b/usr/src/uts/common/fs/nfs/nfs3_vfsops.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved. */ /* @@ -1122,7 +1121,9 @@ nfs3rootvp(vnode_t **rtvpp, vfs_t *vfsp, struct servinfo *svp, cv_init(&mi->mi_async_cv, NULL, CV_DEFAULT, NULL); mi->mi_vfsp = vfsp; - zone_hold(mi->mi_zone = zone); + mi->mi_zone = zone; + zone_init_ref(&mi->mi_zone_ref); + zone_hold_ref(zone, &mi->mi_zone_ref, ZONE_REF_NFS); nfs_mi_zonelist_add(mi); /* diff --git a/usr/src/uts/common/fs/nfs/nfs4_client.c b/usr/src/uts/common/fs/nfs/nfs4_client.c index 927fbd0456..d85c9d7e31 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_client.c +++ b/usr/src/uts/common/fs/nfs/nfs4_client.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved. */ /* @@ -2932,7 +2931,8 @@ nfs4_mi_shutdown(zoneid_t zoneid, void *data) */ list_remove(&mig->mig_list, mi); mutex_exit(&mig->mig_lock); - zone_rele(mi->mi_zone); + zone_rele_ref(&mi->mi_zone_ref, ZONE_REF_NFSV4); + /* * Release hold on vfs and mi done to prevent race with zone * shutdown. This releases the hold in nfs4_mi_zonelist_add. diff --git a/usr/src/uts/common/fs/nfs/nfs4_vfsops.c b/usr/src/uts/common/fs/nfs/nfs4_vfsops.c index 35152c3a39..1752a28542 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_vfsops.c +++ b/usr/src/uts/common/fs/nfs/nfs4_vfsops.c @@ -1179,7 +1179,8 @@ errout: /* need to remove it from the zone */ removed = nfs4_mi_zonelist_remove(mi); if (removed) - zone_rele(mi->mi_zone); + zone_rele_ref(&mi->mi_zone_ref, + ZONE_REF_NFSV4); MI4_RELE(mi); if (!(uap->flags & MS_SYSSPACE) && args) { nfs4_free_args(args); @@ -2383,7 +2384,9 @@ nfs4rootvp(vnode_t **rtvpp, vfs_t *vfsp, struct servinfo4 *svp_head, cv_init(&mi->mi_inact_req_cv, NULL, CV_DEFAULT, NULL); mi->mi_vfsp = vfsp; - zone_hold(mi->mi_zone = zone); + mi->mi_zone = zone; + zone_init_ref(&mi->mi_zone_ref); + zone_hold_ref(zone, &mi->mi_zone_ref, ZONE_REF_NFSV4); nfs4_mi_zonelist_add(mi); /* @@ -2646,7 +2649,7 @@ bad: nfs4_async_manager_stop(vfsp); removed = nfs4_mi_zonelist_remove(mi); if (removed) - zone_rele(mi->mi_zone); + zone_rele_ref(&mi->mi_zone_ref, ZONE_REF_NFSV4); /* * This releases the initial "hold" of the mi since it will never @@ -2771,7 +2774,7 @@ nfs4_unmount(vfs_t *vfsp, int flag, cred_t *cr) nfs4_remove_mi_from_server(mi, NULL); removed = nfs4_mi_zonelist_remove(mi); if (removed) - zone_rele(mi->mi_zone); + zone_rele_ref(&mi->mi_zone_ref, ZONE_REF_NFSV4); return (0); } @@ -4402,7 +4405,7 @@ nfs4_free_mount(vfs_t *vfsp, int flag, cred_t *cr) removed = nfs4_mi_zonelist_remove(mi); if (removed) - zone_rele(mi->mi_zone); + zone_rele_ref(&mi->mi_zone_ref, ZONE_REF_NFSV4); } /* Referral related sub-routines */ diff --git a/usr/src/uts/common/fs/nfs/nfs_client.c b/usr/src/uts/common/fs/nfs/nfs_client.c index 53047f4cd8..7a6c545d9a 100644 --- a/usr/src/uts/common/fs/nfs/nfs_client.c +++ b/usr/src/uts/common/fs/nfs/nfs_client.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved. * * Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. @@ -3229,7 +3228,7 @@ nfs_free_mi(mntinfo_t *mi) cv_destroy(&mi->mi_async_work_cv[NFS_ASYNC_PGOPS_QUEUE]); cv_destroy(&mi->mi_async_reqs_cv); cv_destroy(&mi->mi_async_cv); - zone_rele(mi->mi_zone); + zone_rele_ref(&mi->mi_zone_ref, ZONE_REF_NFS); kmem_free(mi, sizeof (*mi)); } diff --git a/usr/src/uts/common/fs/nfs/nfs_vfsops.c b/usr/src/uts/common/fs/nfs/nfs_vfsops.c index 8dff0eb2df..57b21778b4 100644 --- a/usr/src/uts/common/fs/nfs/nfs_vfsops.c +++ b/usr/src/uts/common/fs/nfs/nfs_vfsops.c @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1986, 2010, Oracle and/or its affiliates. All rights reserved. * * Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. @@ -1241,7 +1240,9 @@ nfsrootvp(vnode_t **rtvpp, vfs_t *vfsp, struct servinfo *svp, cv_init(&mi->mi_async_cv, NULL, CV_DEFAULT, NULL); mi->mi_vfsp = vfsp; - zone_hold(mi->mi_zone = zone); + mi->mi_zone = zone; + zone_init_ref(&mi->mi_zone_ref); + zone_hold_ref(zone, &mi->mi_zone_ref, ZONE_REF_NFS); nfs_mi_zonelist_add(mi); /* diff --git a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs.h b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs.h index 6565be5ef3..fd9f4ac7f3 100644 --- a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs.h +++ b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs.h @@ -33,8 +33,7 @@ */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _SMBFS_SMBFS_H @@ -56,6 +55,7 @@ #include <sys/vfs.h> #include <sys/vfs_opreg.h> #include <sys/fs/smbfs_mount.h> +#include <sys/zone.h> /* * Path component length @@ -140,7 +140,7 @@ typedef struct smbmntinfo { /* * Zones support. */ - struct zone *smi_zone; /* Zone mounted in */ + zone_ref_t smi_zone_ref; /* Zone FS is mounted in */ list_node_t smi_zone_node; /* Link to per-zone smi list */ /* Lock for the list is: smi_globals_t -> smg_lock */ diff --git a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_client.c b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_client.c index 8d4c617b52..008b8fdc7f 100644 --- a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_client.c +++ b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_client.c @@ -20,8 +20,7 @@ */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * * Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All rights reserved. @@ -418,7 +417,7 @@ smbfsgetattr(vnode_t *vp, struct vattr *vap, cred_t *cr) smi = VTOSMI(vp); - ASSERT(curproc->p_zone == smi->smi_zone); + ASSERT(curproc->p_zone == smi->smi_zone_ref.zref_zone); /* * If asked for UID or GID, update n_uid, n_gid. @@ -610,7 +609,7 @@ smbfs_zonelist_add(smbmntinfo_t *smi) { smi_globals_t *smg; - smg = zone_getspecific(smi_list_key, smi->smi_zone); + smg = zone_getspecific(smi_list_key, smi->smi_zone_ref.zref_zone); mutex_enter(&smg->smg_lock); list_insert_head(&smg->smg_list, smi); mutex_exit(&smg->smg_lock); @@ -624,7 +623,7 @@ smbfs_zonelist_remove(smbmntinfo_t *smi) { smi_globals_t *smg; - smg = zone_getspecific(smi_list_key, smi->smi_zone); + smg = zone_getspecific(smi_list_key, smi->smi_zone_ref.zref_zone); mutex_enter(&smg->smg_lock); list_remove(&smg->smg_list, smi); /* diff --git a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c index d649e9d664..86c8111b72 100644 --- a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c +++ b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c @@ -314,8 +314,8 @@ smbfs_free_smi(smbmntinfo_t *smi) if (smi == NULL) return; - if (smi->smi_zone != NULL) - zone_rele(smi->smi_zone); + if (smi->smi_zone_ref.zref_zone != NULL) + zone_rele_ref(&smi->smi_zone_ref, ZONE_REF_SMBFS); if (smi->smi_share != NULL) smb_share_rele(smi->smi_share); @@ -481,7 +481,14 @@ smbfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr) smi->smi_share = ssp; ssp = NULL; - smi->smi_zone = mntzone; + + /* + * Convert the anonymous zone hold acquired via zone_hold() above + * into a zone reference. + */ + zone_init_ref(&smi->smi_zone_ref); + zone_hold_ref(mntzone, &smi->smi_zone_ref, ZONE_REF_SMBFS); + zone_rele(mntzone); mntzone = NULL; /* @@ -736,7 +743,7 @@ smbfs_root(vfs_t *vfsp, vnode_t **vpp) smi = VFTOSMI(vfsp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EPERM); if (smi->smi_flags & SMI_DEAD || vfsp->vfs_flag & VFS_UNMOUNTED) @@ -770,7 +777,7 @@ smbfs_statvfs(vfs_t *vfsp, statvfs64_t *sbp) hrtime_t now; smb_cred_t scred; - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EPERM); if (smi->smi_flags & SMI_DEAD || vfsp->vfs_flag & VFS_UNMOUNTED) diff --git a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vnops.c b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vnops.c index 048c159fdf..5748a5c181 100644 --- a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vnops.c +++ b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vnops.c @@ -257,7 +257,7 @@ smbfs_open(vnode_t **vpp, int flag, cred_t *cr, caller_context_t *ct) smi = VTOSMI(vp); ssp = smi->smi_share; - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -434,7 +434,7 @@ smbfs_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr, * open; if we happen to get here from the wrong zone we can't do * anything over the wire. */ - if (smi->smi_zone != curproc->p_zone) { + if (smi->smi_zone_ref.zref_zone != curproc->p_zone) { /* * We could attempt to clean up locks, except we're sure * that the current process didn't acquire any locks on @@ -591,7 +591,7 @@ smbfs_read(vnode_t *vp, struct uio *uiop, int ioflag, cred_t *cr, smi = VTOSMI(vp); ssp = smi->smi_share; - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -676,7 +676,7 @@ smbfs_write(vnode_t *vp, struct uio *uiop, int ioflag, cred_t *cr, smi = VTOSMI(vp); ssp = smi->smi_share; - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -787,7 +787,7 @@ smbfs_ioctl(vnode_t *vp, int cmd, intptr_t arg, int flag, smi = VTOSMI(vp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -853,7 +853,7 @@ smbfs_getattr(vnode_t *vp, struct vattr *vap, int flags, cred_t *cr, smi = VTOSMI(vp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -908,7 +908,7 @@ smbfs_setattr(vnode_t *vp, struct vattr *vap, int flags, cred_t *cr, vfsp = vp->v_vfsp; smi = VFTOSMI(vfsp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vfsp->vfs_flag & VFS_UNMOUNTED) @@ -980,7 +980,7 @@ smbfssetattr(vnode_t *vp, struct vattr *vap, int flags, cred_t *cr) int have_fid = 0; uint32_t rights = 0; - ASSERT(curproc->p_zone == VTOSMI(vp)->smi_zone); + ASSERT(curproc->p_zone == VTOSMI(vp)->smi_zone_ref.zref_zone); /* * There are no settable attributes on the XATTR dir, @@ -1252,7 +1252,7 @@ smbfs_access(vnode_t *vp, int mode, int flags, cred_t *cr, caller_context_t *ct) vfsp = vp->v_vfsp; smi = VFTOSMI(vfsp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vfsp->vfs_flag & VFS_UNMOUNTED) @@ -1281,7 +1281,7 @@ smbfs_fsync(vnode_t *vp, int syncflag, cred_t *cr, caller_context_t *ct) np = VTOSMB(vp); smi = VTOSMI(vp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -1399,7 +1399,7 @@ smbfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp, vfs = dvp->v_vfsp; smi = VFTOSMI(vfs); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EPERM); if (smi->smi_flags & SMI_DEAD || vfs->vfs_flag & VFS_UNMOUNTED) @@ -1456,7 +1456,7 @@ smbfslookup(vnode_t *dvp, char *nm, vnode_t **vpp, cred_t *cr, smi = VTOSMI(dvp); dnp = VTOSMB(dvp); - ASSERT(curproc->p_zone == smi->smi_zone); + ASSERT(curproc->p_zone == smi->smi_zone_ref.zref_zone); #ifdef NOT_YET vcp = SSTOVC(smi->smi_share); @@ -1775,7 +1775,7 @@ smbfs_create(vnode_t *dvp, char *nm, struct vattr *va, enum vcexcl exclusive, dnp = VTOSMB(dvp); vp = NULL; - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EPERM); if (smi->smi_flags & SMI_DEAD || vfsp->vfs_flag & VFS_UNMOUNTED) @@ -2007,7 +2007,7 @@ smbfs_remove(vnode_t *dvp, char *nm, cred_t *cr, caller_context_t *ct, smi = VTOSMI(dvp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EPERM); if (smi->smi_flags & SMI_DEAD || dvp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -2101,8 +2101,8 @@ smbfs_rename(vnode_t *odvp, char *onm, vnode_t *ndvp, char *nnm, cred_t *cr, { /* vnode_t *realvp; */ - if (curproc->p_zone != VTOSMI(odvp)->smi_zone || - curproc->p_zone != VTOSMI(ndvp)->smi_zone) + if (curproc->p_zone != VTOSMI(odvp)->smi_zone_ref.zref_zone || + curproc->p_zone != VTOSMI(ndvp)->smi_zone_ref.zref_zone) return (EPERM); if (VTOSMI(odvp)->smi_flags & SMI_DEAD || @@ -2133,7 +2133,7 @@ smbfsrename(vnode_t *odvp, char *onm, vnode_t *ndvp, char *nnm, cred_t *cr, struct smb_cred scred; /* enum smbfsstat status; */ - ASSERT(curproc->p_zone == VTOSMI(odvp)->smi_zone); + ASSERT(curproc->p_zone == VTOSMI(odvp)->smi_zone_ref.zref_zone); if (strcmp(onm, ".") == 0 || strcmp(onm, "..") == 0 || strcmp(nnm, ".") == 0 || strcmp(nnm, "..") == 0) @@ -2361,7 +2361,7 @@ smbfs_mkdir(vnode_t *dvp, char *nm, struct vattr *va, vnode_t **vpp, int nmlen = strlen(name); int error, hiderr; - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EPERM); if (smi->smi_flags & SMI_DEAD || dvp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -2440,7 +2440,7 @@ smbfs_rmdir(vnode_t *dvp, char *nm, vnode_t *cdir, cred_t *cr, struct smb_cred scred; int error; - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EPERM); if (smi->smi_flags & SMI_DEAD || dvp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -2536,7 +2536,7 @@ smbfs_readdir(vnode_t *vp, struct uio *uiop, cred_t *cr, int *eofp, smi = VTOSMI(vp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -2599,7 +2599,7 @@ smbfs_readvdir(vnode_t *vp, uio_t *uio, cred_t *cr, int *eofp, int nmlen, error; ushort_t reclen; - ASSERT(curproc->p_zone == VTOSMI(vp)->smi_zone); + ASSERT(curproc->p_zone == VTOSMI(vp)->smi_zone_ref.zref_zone); /* Make sure we serialize for n_dirseq use. */ ASSERT(smbfs_rw_lock_held(&np->r_lkserlock, RW_WRITER)); @@ -2840,7 +2840,7 @@ smbfs_seek(vnode_t *vp, offset_t ooff, offset_t *noffp, caller_context_t *ct) smi = VTOSMI(vp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EPERM); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -2871,7 +2871,7 @@ smbfs_frlock(vnode_t *vp, int cmd, struct flock64 *bfp, int flag, offset_t offset, struct flk_callback *flk_cbp, cred_t *cr, caller_context_t *ct) { - if (curproc->p_zone != VTOSMI(vp)->smi_zone) + if (curproc->p_zone != VTOSMI(vp)->smi_zone_ref.zref_zone) return (EIO); if (VTOSMI(vp)->smi_flags & SMI_LLOCK) @@ -2897,7 +2897,7 @@ smbfs_space(vnode_t *vp, int cmd, struct flock64 *bfp, int flag, smi = VTOSMI(vp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -2951,7 +2951,7 @@ smbfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, vfs = vp->v_vfsp; smi = VFTOSMI(vfs); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vp->v_vfsp->vfs_flag & VFS_UNMOUNTED) @@ -3019,7 +3019,7 @@ smbfs_getsecattr(vnode_t *vp, vsecattr_t *vsa, int flag, cred_t *cr, vfsp = vp->v_vfsp; smi = VFTOSMI(vfsp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vfsp->vfs_flag & VFS_UNMOUNTED) @@ -3060,7 +3060,7 @@ smbfs_setsecattr(vnode_t *vp, vsecattr_t *vsa, int flag, cred_t *cr, vfsp = vp->v_vfsp; smi = VFTOSMI(vfsp); - if (curproc->p_zone != smi->smi_zone) + if (curproc->p_zone != smi->smi_zone_ref.zref_zone) return (EIO); if (smi->smi_flags & SMI_DEAD || vfsp->vfs_flag & VFS_UNMOUNTED) @@ -3102,7 +3102,7 @@ static int smbfs_shrlock(vnode_t *vp, int cmd, struct shrlock *shr, int flag, cred_t *cr, caller_context_t *ct) { - if (curproc->p_zone != VTOSMI(vp)->smi_zone) + if (curproc->p_zone != VTOSMI(vp)->smi_zone_ref.zref_zone) return (EIO); if (VTOSMI(vp)->smi_flags & SMI_LLOCK) diff --git a/usr/src/uts/common/fs/vfs.c b/usr/src/uts/common/fs/vfs.c index 9a106fd3d0..cbb2adfb37 100644 --- a/usr/src/uts/common/fs/vfs.c +++ b/usr/src/uts/common/fs/vfs.c @@ -3513,11 +3513,13 @@ vfs_list_add(struct vfs *vfsp) /* * The zone that owns the mount is the one that performed the mount. * Note that this isn't necessarily the same as the zone mounted into. - * The corresponding zone_rele() will be done when the vfs_t is - * being free'd. + * The corresponding zone_rele_ref() will be done when the vfs_t + * is being free'd. */ vfsp->vfs_zone = curproc->p_zone; - zone_hold(vfsp->vfs_zone); + zone_init_ref(&vfsp->vfs_implp->vi_zone_ref); + zone_hold_ref(vfsp->vfs_zone, &vfsp->vfs_implp->vi_zone_ref, + ZONE_REF_VFS); /* * Find the zone mounted into, and put this mount on its vfs list. @@ -4342,7 +4344,8 @@ vfs_rele(vfs_t *vfsp) VFS_FREEVFS(vfsp); lofi_remove(vfsp); if (vfsp->vfs_zone) - zone_rele(vfsp->vfs_zone); + zone_rele_ref(&vfsp->vfs_implp->vi_zone_ref, + ZONE_REF_VFS); vfs_freemnttab(vfsp); vfs_free(vfsp); } |
