summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs
diff options
context:
space:
mode:
authorJohn Levon <john.levon@sun.com>2010-06-16 10:02:44 -0700
committerJohn Levon <john.levon@sun.com>2010-06-16 10:02:44 -0700
commit0fbb751d81ab0a7c7ddfd8d4e447e075a9f7024f (patch)
tree547ed35c638d3c30c437e212b458d74268e35afa /usr/src/uts/common/fs
parentded9341448cd6e2573619c7f6fe98909bdd35ec6 (diff)
downloadillumos-joyent-0fbb751d81ab0a7c7ddfd8d4e447e075a9f7024f.tar.gz
PSARC 2010/144 lofi(7D) in non global zones
6354954 lofi support in non-global zones 6942891 prof_lookup_globaldev() leaks rootdir refs 6945005 lofiadm -a /dev/lofi/1: recursive mutex enter 6946486 lofi_ioctl() shouldn't allow disk ioctl()s on /dev/lofictl
Diffstat (limited to 'usr/src/uts/common/fs')
-rw-r--r--usr/src/uts/common/fs/autofs/auto_vfsops.c2
-rw-r--r--usr/src/uts/common/fs/ctfs/ctfs_root.c11
-rw-r--r--usr/src/uts/common/fs/dcfs/dc_vnops.c5
-rw-r--r--usr/src/uts/common/fs/dev/sdev_profile.c91
-rw-r--r--usr/src/uts/common/fs/dev/sdev_subr.c6
-rw-r--r--usr/src/uts/common/fs/fd/fdops.c7
-rw-r--r--usr/src/uts/common/fs/fifofs/fifosubr.c7
-rw-r--r--usr/src/uts/common/fs/hsfs/hsfs_vfsops.c7
-rw-r--r--usr/src/uts/common/fs/lofs/lofs_vfsops.c2
-rw-r--r--usr/src/uts/common/fs/mntfs/mntvfsops.c5
-rw-r--r--usr/src/uts/common/fs/namefs/namevfs.c2
-rw-r--r--usr/src/uts/common/fs/nfs/nfs4_common.c5
-rw-r--r--usr/src/uts/common/fs/nfs/nfs_common.c20
-rw-r--r--usr/src/uts/common/fs/objfs/objfs_vfs.c7
-rw-r--r--usr/src/uts/common/fs/proc/prvfsops.c7
-rw-r--r--usr/src/uts/common/fs/sharefs/sharefs_vfsops.c7
-rw-r--r--usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c5
-rw-r--r--usr/src/uts/common/fs/sockfs/sockvfsops.c12
-rw-r--r--usr/src/uts/common/fs/specfs/specvfsops.c7
-rw-r--r--usr/src/uts/common/fs/tmpfs/tmp_vfsops.c5
-rw-r--r--usr/src/uts/common/fs/vfs.c64
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_vfsops.c2
22 files changed, 160 insertions, 126 deletions
diff --git a/usr/src/uts/common/fs/autofs/auto_vfsops.c b/usr/src/uts/common/fs/autofs/auto_vfsops.c
index 3bd5fa7591..52c0368dda 100644
--- a/usr/src/uts/common/fs/autofs/auto_vfsops.c
+++ b/usr/src/uts/common/fs/autofs/auto_vfsops.c
@@ -87,7 +87,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"autofs",
autofs_init,
- VSW_HASPROTO|VSW_CANRWRO|VSW_CANREMOUNT|VSW_STATS,
+ VSW_HASPROTO|VSW_CANRWRO|VSW_CANREMOUNT|VSW_STATS|VSW_ZMOUNT,
&auto_mntopts
};
diff --git a/usr/src/uts/common/fs/ctfs/ctfs_root.c b/usr/src/uts/common/fs/ctfs/ctfs_root.c
index 8861b6d73b..1e70b36206 100644
--- a/usr/src/uts/common/fs/ctfs/ctfs_root.c
+++ b/usr/src/uts/common/fs/ctfs/ctfs_root.c
@@ -19,12 +19,9 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/modctl.h>
#include <sys/types.h>
#include <sys/param.h>
@@ -111,7 +108,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"ctfs",
ctfs_init,
- VSW_HASPROTO,
+ VSW_HASPROTO|VSW_ZMOUNT,
&ctfs_mntopts,
};
@@ -241,10 +238,10 @@ ctfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
*/
vfsp->vfs_bsize = DEV_BSIZE;
vfsp->vfs_fstype = ctfs_fstype;
- do
+ do {
dev = makedevice(ctfs_major,
atomic_add_32_nv(&ctfs_minor, 1) & L_MAXMIN32);
- while (vfs_devismounted(dev));
+ } while (vfs_devismounted(dev));
vfs_make_fsid(&vfsp->vfs_fsid, dev, ctfs_fstype);
vfsp->vfs_data = data;
vfsp->vfs_dev = dev;
diff --git a/usr/src/uts/common/fs/dcfs/dc_vnops.c b/usr/src/uts/common/fs/dcfs/dc_vnops.c
index 1e30887d7f..4cf6f9ce62 100644
--- a/usr/src/uts/common/fs/dcfs/dc_vnops.c
+++ b/usr/src/uts/common/fs/dcfs/dc_vnops.c
@@ -20,8 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
@@ -159,7 +158,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"dcfs",
dcinit,
- 0,
+ VSW_ZMOUNT,
NULL
};
diff --git a/usr/src/uts/common/fs/dev/sdev_profile.c b/usr/src/uts/common/fs/dev/sdev_profile.c
index 6a0095657e..01d4aab1ae 100644
--- a/usr/src/uts/common/fs/dev/sdev_profile.c
+++ b/usr/src/uts/common/fs/dev/sdev_profile.c
@@ -20,12 +20,9 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This file implements /dev filesystem operations for non-global
* instances. Three major entry points:
@@ -245,9 +242,6 @@ static void
prof_lookup_globaldev(struct sdev_node *dir, struct sdev_node *gdir,
char *name, char *rename)
{
- /* global OS rootdir */
- extern vnode_t *rootdir;
-
int error;
struct vnode *avp, *gdv, *gddv;
struct sdev_node *newdv;
@@ -269,7 +263,6 @@ prof_lookup_globaldev(struct sdev_node *dir, struct sdev_node *gdir,
/* perform a relative lookup of the global /dev instance */
gddv = SDEVTOV(gdir);
VN_HOLD(gddv);
- VN_HOLD(rootdir);
error = lookuppnvp(&pn, NULL, FOLLOW, NULLVPP, &gdv,
rootdir, gddv, kcred);
pn_free(&pn);
@@ -528,25 +521,96 @@ end:
kmem_free(dbuf, dlen);
}
+/*
+ * Last chance for a zone to see a node. If our parent dir is
+ * SDEV_ZONED, then we look up the "zone" property for the node. If the
+ * property is found and matches the current zone name, we allow it.
+ * Note that this isn't quite correct for the global zone peeking inside
+ * a zone's /dev - for that to work, we'd have to have a per-dev-mount
+ * zone ref squirreled away.
+ */
+static int
+prof_zone_matched(char *name, struct sdev_node *dir)
+{
+ vnode_t *gvn = SDEVTOV(dir->sdev_origin);
+ struct pathname pn;
+ vnode_t *vn = NULL;
+ char zonename[ZONENAME_MAX];
+ int znlen = ZONENAME_MAX;
+ int ret;
+
+ ASSERT((dir->sdev_flags & SDEV_ZONED) != 0);
+
+ sdcmn_err10(("sdev_node %p is zoned, looking for %s\n",
+ (void *)dir, name));
+
+ if (pn_get(name, UIO_SYSSPACE, &pn))
+ return (0);
+
+ VN_HOLD(gvn);
+
+ ret = lookuppnvp(&pn, NULL, FOLLOW, NULLVPP, &vn, rootdir, gvn, kcred);
+
+ pn_free(&pn);
+
+ if (ret != 0) {
+ sdcmn_err10(("prof_zone_matched: %s not found\n", name));
+ return (0);
+ }
+
+ /*
+ * VBLK doesn't matter, and the property name is in fact treated
+ * as a const char *.
+ */
+ ret = e_ddi_getlongprop_buf(vn->v_rdev, VBLK, (char *)"zone",
+ DDI_PROP_NOTPROM | DDI_PROP_DONTPASS, (caddr_t)zonename, &znlen);
+
+ VN_RELE(vn);
+
+ if (ret == DDI_PROP_NOT_FOUND) {
+ sdcmn_err10(("vnode %p: no zone prop\n", (void *)vn));
+ return (0);
+ } else if (ret != DDI_PROP_SUCCESS) {
+ sdcmn_err10(("vnode %p: zone prop error: %d\n",
+ (void *)vn, ret));
+ return (0);
+ }
+
+ sdcmn_err10(("vnode %p zone prop: %s\n", (void *)vn, zonename));
+ return (strcmp(zonename, curproc->p_zone->zone_name) == 0);
+}
+
static int
-prof_make_name(char *nm, void *arg)
+prof_make_name_glob(char *nm, void *arg)
{
struct sdev_node *ddv = (struct sdev_node *)arg;
if (prof_name_matched(nm, ddv))
prof_lookup_globaldev(ddv, ddv->sdev_origin, nm, nm);
+
+ return (WALK_DIR_CONTINUE);
+}
+
+static int
+prof_make_name_zone(char *nm, void *arg)
+{
+ struct sdev_node *ddv = (struct sdev_node *)arg;
+
+ if (prof_zone_matched(nm, ddv))
+ prof_lookup_globaldev(ddv, ddv->sdev_origin, nm, nm);
+
return (WALK_DIR_CONTINUE);
}
static void
-prof_make_names_glob(struct sdev_node *ddv)
+prof_make_names_walk(struct sdev_node *ddv, int (*cb)(char *, void *))
{
struct sdev_node *gdir;
gdir = ddv->sdev_origin;
if (gdir == NULL)
return;
- walk_dir(SDEVTOV(gdir), (void *)ddv, prof_make_name);
+ walk_dir(SDEVTOV(gdir), (void *)ddv, cb);
}
static void
@@ -559,11 +623,14 @@ prof_make_names(struct sdev_node *dir)
ASSERT(RW_WRITE_HELD(&dir->sdev_contents));
+ if ((dir->sdev_flags & SDEV_ZONED) != 0)
+ prof_make_names_walk(dir, prof_make_name_zone);
+
if (nvl == NULL)
return;
if (dir->sdev_prof.has_glob) {
- prof_make_names_glob(dir);
+ prof_make_names_walk(dir, prof_make_name_glob);
return;
}
diff --git a/usr/src/uts/common/fs/dev/sdev_subr.c b/usr/src/uts/common/fs/dev/sdev_subr.c
index 5550bd6a13..3fced7bb9c 100644
--- a/usr/src/uts/common/fs/dev/sdev_subr.c
+++ b/usr/src/uts/common/fs/dev/sdev_subr.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -548,6 +547,9 @@ static struct sdev_vop_table vtab[] =
{ "ipnet", devipnet_vnodeops_tbl, NULL, &devipnet_vnodeops,
devipnet_validate, SDEV_DYNAMIC | SDEV_VTOR | SDEV_NO_NCACHE },
+ { "lofi", NULL, NULL, NULL, NULL, SDEV_ZONED },
+ { "rlofi", NULL, NULL, NULL, NULL, SDEV_ZONED },
+
{ NULL, NULL, NULL, NULL, NULL, 0}
};
diff --git a/usr/src/uts/common/fs/fd/fdops.c b/usr/src/uts/common/fs/fd/fdops.c
index 3288872146..8c398be2ee 100644
--- a/usr/src/uts/common/fs/fd/fdops.c
+++ b/usr/src/uts/common/fs/fd/fdops.c
@@ -19,12 +19,9 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All rights reserved. */
@@ -549,7 +546,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"fd",
fdinit,
- VSW_HASPROTO,
+ VSW_HASPROTO | VSW_ZMOUNT,
&fdfs_mntopts
};
diff --git a/usr/src/uts/common/fs/fifofs/fifosubr.c b/usr/src/uts/common/fs/fifofs/fifosubr.c
index a788124c7f..6e56000ffe 100644
--- a/usr/src/uts/common/fs/fifofs/fifosubr.c
+++ b/usr/src/uts/common/fs/fifofs/fifosubr.c
@@ -21,12 +21,9 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* The routines defined in this file are supporting routines for FIFOFS
* file system type.
@@ -80,7 +77,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"fifofs",
fifoinit,
- 0,
+ VSW_ZMOUNT,
NULL
};
diff --git a/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c b/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c
index aaad2bc864..058d6925e3 100644
--- a/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c
+++ b/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c
@@ -19,12 +19,9 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* VFS operations for High Sierra filesystem
*/
@@ -151,7 +148,7 @@ static vfsdef_t vfw = {
"hsfs",
hsfsinit,
/* We don't suppport remounting */
- VSW_HASPROTO|VSW_STATS|VSW_CANLOFI,
+ VSW_HASPROTO|VSW_STATS|VSW_CANLOFI|VSW_ZMOUNT,
&hsfs_proto_opttbl
};
diff --git a/usr/src/uts/common/fs/lofs/lofs_vfsops.c b/usr/src/uts/common/fs/lofs/lofs_vfsops.c
index d1a927de73..5f1ae8a1a4 100644
--- a/usr/src/uts/common/fs/lofs/lofs_vfsops.c
+++ b/usr/src/uts/common/fs/lofs/lofs_vfsops.c
@@ -58,7 +58,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"lofs",
lofsinit,
- VSW_HASPROTO|VSW_STATS,
+ VSW_HASPROTO|VSW_STATS|VSW_ZMOUNT,
&lofs_mntopts
};
diff --git a/usr/src/uts/common/fs/mntfs/mntvfsops.c b/usr/src/uts/common/fs/mntfs/mntvfsops.c
index 7cd5f82808..102e681e8e 100644
--- a/usr/src/uts/common/fs/mntfs/mntvfsops.c
+++ b/usr/src/uts/common/fs/mntfs/mntvfsops.c
@@ -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.
*/
#include <sys/types.h>
@@ -66,7 +65,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"mntfs",
mntinit,
- VSW_HASPROTO|VSW_STATS,
+ VSW_HASPROTO|VSW_STATS|VSW_ZMOUNT,
&mnt_mntopts
};
diff --git a/usr/src/uts/common/fs/namefs/namevfs.c b/usr/src/uts/common/fs/namefs/namevfs.c
index b0470e45d9..0725504842 100644
--- a/usr/src/uts/common/fs/namefs/namevfs.c
+++ b/usr/src/uts/common/fs/namefs/namevfs.c
@@ -730,7 +730,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"namefs",
nameinit,
- VSW_HASPROTO,
+ VSW_HASPROTO | VSW_ZMOUNT,
&nm_mntopts
};
diff --git a/usr/src/uts/common/fs/nfs/nfs4_common.c b/usr/src/uts/common/fs/nfs/nfs4_common.c
index fbd2670acc..c6d7db3d90 100644
--- a/usr/src/uts/common/fs/nfs/nfs4_common.c
+++ b/usr/src/uts/common/fs/nfs/nfs4_common.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -49,7 +48,7 @@ static vfsdef_t vfw4 = {
VFSDEF_VERSION,
"nfs4",
nfs4init,
- VSW_CANREMOUNT|VSW_NOTZONESAFE|VSW_STATS,
+ VSW_CANREMOUNT|VSW_NOTZONESAFE|VSW_STATS|VSW_ZMOUNT,
NULL
};
diff --git a/usr/src/uts/common/fs/nfs/nfs_common.c b/usr/src/uts/common/fs/nfs/nfs_common.c
index c980d55aed..5588a511c8 100644
--- a/usr/src/uts/common/fs/nfs/nfs_common.c
+++ b/usr/src/uts/common/fs/nfs/nfs_common.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -28,8 +27,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/errno.h>
#include <sys/param.h>
#include <sys/types.h>
@@ -125,7 +122,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"nfsdyn",
nfsdyninit,
- 0,
+ VSW_ZMOUNT,
NULL
};
@@ -142,7 +139,7 @@ static vfsdef_t vfw2 = {
VFSDEF_VERSION,
"nfs",
nfsinit,
- VSW_CANREMOUNT|VSW_NOTZONESAFE|VSW_STATS,
+ VSW_CANREMOUNT|VSW_NOTZONESAFE|VSW_STATS|VSW_ZMOUNT,
NULL
};
@@ -159,7 +156,7 @@ static vfsdef_t vfw3 = {
VFSDEF_VERSION,
"nfs3",
nfs3init,
- VSW_CANREMOUNT|VSW_NOTZONESAFE|VSW_STATS,
+ VSW_CANREMOUNT|VSW_NOTZONESAFE|VSW_STATS|VSW_ZMOUNT,
NULL
};
@@ -410,10 +407,10 @@ nfsdyn_mountroot(vfs_t *vfsp, whymountroot_t why)
vfsflags = 0;
if (error = mount_root(*name ? name : "root", root_path, NFS_V4,
- &args, &vfsflags)) {
+ &args, &vfsflags)) {
if (error != EPROTONOSUPPORT) {
nfs_cmn_err(error, CE_WARN,
- "Unable to mount NFS root filesystem: %m");
+ "Unable to mount NFS root filesystem: %m");
sv_free(svp);
pn_free(&pn);
vfs_setops(vfsp, nfsdyn_vfsops);
@@ -432,7 +429,7 @@ nfsdyn_mountroot(vfs_t *vfsp, whymountroot_t why)
vfsflags = 0;
if (error = mount_root(*name ? name : "root", root_path,
- NFS_V3, &args, &vfsflags)) {
+ NFS_V3, &args, &vfsflags)) {
if (error != EPROTONOSUPPORT) {
nfs_cmn_err(error, CE_WARN,
"Unable to mount NFS root filesystem: %m");
@@ -455,8 +452,7 @@ nfsdyn_mountroot(vfs_t *vfsp, whymountroot_t why)
vfs_setops(vfsp, nfs_vfsops);
if (error = mount_root(*name ? name : "root",
- root_path, NFS_VERSION, &args,
- &vfsflags)) {
+ root_path, NFS_VERSION, &args, &vfsflags)) {
nfs_cmn_err(error, CE_WARN,
"Unable to mount NFS root filesystem: %m");
sv_free(svp);
diff --git a/usr/src/uts/common/fs/objfs/objfs_vfs.c b/usr/src/uts/common/fs/objfs/objfs_vfs.c
index 0ee0b0a577..00dafeb625 100644
--- a/usr/src/uts/common/fs/objfs/objfs_vfs.c
+++ b/usr/src/uts/common/fs/objfs/objfs_vfs.c
@@ -19,12 +19,9 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/atomic.h>
#include <sys/cmn_err.h>
#include <sys/errno.h>
@@ -76,7 +73,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"objfs",
objfs_init,
- VSW_HASPROTO,
+ VSW_HASPROTO | VSW_ZMOUNT,
&objfs_mntopts,
};
diff --git a/usr/src/uts/common/fs/proc/prvfsops.c b/usr/src/uts/common/fs/proc/prvfsops.c
index 1ff5993983..d0bebc7163 100644
--- a/usr/src/uts/common/fs/proc/prvfsops.c
+++ b/usr/src/uts/common/fs/proc/prvfsops.c
@@ -19,16 +19,13 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.25 */
-
#include <sys/types.h>
#include <sys/param.h>
#include <sys/cmn_err.h>
@@ -72,7 +69,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"proc",
prinit,
- VSW_HASPROTO|VSW_STATS|VSW_XID,
+ VSW_HASPROTO|VSW_STATS|VSW_XID|VSW_ZMOUNT,
&proc_mntopts
};
diff --git a/usr/src/uts/common/fs/sharefs/sharefs_vfsops.c b/usr/src/uts/common/fs/sharefs/sharefs_vfsops.c
index ed02061fb9..6f7796e6e0 100644
--- a/usr/src/uts/common/fs/sharefs/sharefs_vfsops.c
+++ b/usr/src/uts/common/fs/sharefs/sharefs_vfsops.c
@@ -20,12 +20,9 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/atomic.h>
#include <sys/cmn_err.h>
#include <sys/errno.h>
@@ -94,7 +91,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"sharefs",
sharefs_init,
- VSW_HASPROTO,
+ VSW_HASPROTO | VSW_ZMOUNT,
&sharefs_mntopts,
};
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 d1e28b971f..d649e9d664 100644
--- a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c
+++ b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vfsops.c
@@ -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.
*/
#include <sys/systm.h>
@@ -116,7 +115,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
(char *)fs_type_name,
smbfsinit, /* init routine */
- VSW_HASPROTO|VSW_NOTZONESAFE, /* flags */
+ VSW_HASPROTO|VSW_NOTZONESAFE|VSW_ZMOUNT, /* flags */
&smbfs_mntopts /* mount options table prototype */
};
diff --git a/usr/src/uts/common/fs/sockfs/sockvfsops.c b/usr/src/uts/common/fs/sockfs/sockvfsops.c
index 2462306bdb..64d96eda41 100644
--- a/usr/src/uts/common/fs/sockfs/sockvfsops.c
+++ b/usr/src/uts/common/fs/sockfs/sockvfsops.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,12 +19,9 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/t_lock.h>
#include <sys/param.h>
@@ -59,7 +55,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"sockfs",
sockinit,
- 0,
+ VSW_ZMOUNT,
NULL
};
diff --git a/usr/src/uts/common/fs/specfs/specvfsops.c b/usr/src/uts/common/fs/specfs/specvfsops.c
index 98342f4424..83f270c90a 100644
--- a/usr/src/uts/common/fs/specfs/specvfsops.c
+++ b/usr/src/uts/common/fs/specfs/specvfsops.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
@@ -37,8 +36,6 @@
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/t_lock.h>
#include <sys/param.h>
@@ -64,7 +61,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"specfs",
specinit,
- 0,
+ VSW_ZMOUNT,
NULL
};
diff --git a/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c b/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c
index ad545f4a0b..9bb96e4165 100644
--- a/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c
+++ b/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#include <sys/types.h>
@@ -77,7 +76,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"tmpfs",
tmpfsinit,
- VSW_HASPROTO|VSW_STATS,
+ VSW_HASPROTO|VSW_STATS|VSW_ZMOUNT,
&tmpfs_proto_opttbl
};
diff --git a/usr/src/uts/common/fs/vfs.c b/usr/src/uts/common/fs/vfs.c
index d5d254a20d..2bfe3908f0 100644
--- a/usr/src/uts/common/fs/vfs.c
+++ b/usr/src/uts/common/fs/vfs.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
@@ -1014,8 +1013,7 @@ lofi_add(const char *fsname, struct vfs *vfsp,
int minor;
int err = 0;
- if (fsname == NULL ||
- (vfssw = vfs_getvfssw(fsname)) == NULL)
+ if ((vfssw = vfs_getvfssw(fsname)) == NULL)
return (0);
if (!(vfssw->vsw_flag & VSW_CANLOFI)) {
@@ -1049,29 +1047,16 @@ lofi_add(const char *fsname, struct vfs *vfsp,
li = kmem_zalloc(sizeof (*li), KM_SLEEP);
(void) strlcpy(li->li_filename, pn.pn_path, MAXPATHLEN);
- /*
- * The lofi control node is currently exclusive-open. We'd like
- * to improve this, but in the meantime, we'll loop waiting for
- * access.
- */
- for (;;) {
- err = ldi_open_by_name("/dev/lofictl", FREAD | FWRITE | FEXCL,
- kcred, &ldi_hdl, ldi_id);
-
- if (err != EBUSY)
- break;
-
- if ((err = delay_sig(hz / 8)) == EINTR)
- break;
- }
+ err = ldi_open_by_name("/dev/lofictl", FREAD | FWRITE, kcred,
+ &ldi_hdl, ldi_id);
if (err)
goto out2;
err = ldi_ioctl(ldi_hdl, LOFI_MAP_FILE, (intptr_t)li,
- FREAD | FWRITE | FEXCL | FKIOCTL, kcred, &minor);
+ FREAD | FWRITE | FKIOCTL, kcred, &minor);
- (void) ldi_close(ldi_hdl, FREAD | FWRITE | FEXCL, kcred);
+ (void) ldi_close(ldi_hdl, FREAD | FWRITE, kcred);
if (!err)
vfsp->vfs_lofi_minor = minor;
@@ -1104,18 +1089,16 @@ lofi_remove(struct vfs *vfsp)
li->li_minor = vfsp->vfs_lofi_minor;
li->li_cleanup = B_TRUE;
- do {
- err = ldi_open_by_name("/dev/lofictl", FREAD | FWRITE | FEXCL,
- kcred, &ldi_hdl, ldi_id);
- } while (err == EBUSY);
+ err = ldi_open_by_name("/dev/lofictl", FREAD | FWRITE, kcred,
+ &ldi_hdl, ldi_id);
if (err)
goto out;
err = ldi_ioctl(ldi_hdl, LOFI_UNMAP_FILE_MINOR, (intptr_t)li,
- FREAD | FWRITE | FEXCL | FKIOCTL, kcred, NULL);
+ FREAD | FWRITE | FKIOCTL, kcred, NULL);
- (void) ldi_close(ldi_hdl, FREAD | FWRITE | FEXCL, kcred);
+ (void) ldi_close(ldi_hdl, FREAD | FWRITE, kcred);
if (!err)
vfsp->vfs_lofi_minor = 0;
@@ -1251,9 +1234,16 @@ domount(char *fsname, struct mounta *uap, vnode_t *vp, struct cred *credp,
} else {
if ((vswp = vfs_getvfsswbyvfsops(vfs_getops(rootvfs))) == NULL)
return (EINVAL);
+ fsname = vswp->vsw_name;
}
if (!VFS_INSTALLED(vswp))
return (EINVAL);
+
+ if ((error = secpolicy_fs_allowed_mount(fsname)) != 0) {
+ vfs_unrefvfssw(vswp);
+ return (error);
+ }
+
vfsops = &vswp->vsw_vfsops;
vfs_copyopttbl(&vswp->vsw_optproto, &mnt_mntopts);
@@ -4782,7 +4772,7 @@ vfs_propagate_features(vfs_t *from, vfs_t *to)
}
}
-#define LOFICTL_PATH "/devices/pseudo/lofi@0:%d"
+#define LOFINODE_PATH "/dev/lofi/%d"
/*
* Return the vnode for the lofi node if there's a lofi mount in place.
@@ -4801,11 +4791,23 @@ vfs_get_lofi(vfs_t *vfsp, vnode_t **vpp)
return (-1);
}
- strsize = snprintf(NULL, 0, LOFICTL_PATH, vfsp->vfs_lofi_minor);
+ strsize = snprintf(NULL, 0, LOFINODE_PATH, vfsp->vfs_lofi_minor);
path = kmem_alloc(strsize + 1, KM_SLEEP);
- (void) snprintf(path, strsize + 1, LOFICTL_PATH, vfsp->vfs_lofi_minor);
+ (void) snprintf(path, strsize + 1, LOFINODE_PATH, vfsp->vfs_lofi_minor);
+
+ /*
+ * We may be inside a zone, so we need to use the /dev path, but
+ * it's created asynchronously, so we wait here.
+ */
+ for (;;) {
+ err = lookupname(path, UIO_SYSSPACE, FOLLOW, NULLVPP, vpp);
+
+ if (err != ENOENT)
+ break;
- err = lookupname(path, UIO_SYSSPACE, FOLLOW, NULLVPP, vpp);
+ if ((err = delay_sig(hz / 8)) == EINTR)
+ break;
+ }
if (err)
*vpp = NULL;
diff --git a/usr/src/uts/common/fs/zfs/zfs_vfsops.c b/usr/src/uts/common/fs/zfs/zfs_vfsops.c
index 6b83f8c803..0f9717ed07 100644
--- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c
+++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c
@@ -2277,7 +2277,7 @@ static vfsdef_t vfw = {
MNTTYPE_ZFS,
zfs_vfsinit,
VSW_HASPROTO|VSW_CANRWRO|VSW_CANREMOUNT|VSW_VOLATILEDEV|VSW_STATS|
- VSW_XID,
+ VSW_XID|VSW_ZMOUNT,
&zfs_mntopts
};