summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Roy <seb@delphix.com>2017-01-31 17:53:32 -0500
committerPrakash Surya <prakash.surya@delphix.com>2018-02-13 08:28:04 -0800
commitd9a54dd1ef75248420c035ec1d240674f8d1f4fb (patch)
tree6dff8e23c5877980c56ed5e5b89bc99c27c3086a
parent213fcdcbdccbdeb7d33fbae7ba8d2639a6f8fd01 (diff)
downloadillumos-joyent-d9a54dd1ef75248420c035ec1d240674f8d1f4fb.tar.gz
9074 domount() interprets ZFS filesystem names as relative paths
Reviewed by: Paul Dagnelie <pcd@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
-rw-r--r--usr/src/uts/common/fs/hsfs/hsfs_vfsops.c3
-rw-r--r--usr/src/uts/common/fs/pcfs/pc_vfsops.c5
-rw-r--r--usr/src/uts/common/fs/udfs/udf_vfsops.c19
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_vfsops.c8
-rw-r--r--usr/src/uts/common/fs/vfs.c8
-rw-r--r--usr/src/uts/common/sys/vfs.h3
6 files changed, 26 insertions, 20 deletions
diff --git a/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c b/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c
index dbe9aa4c07..523964f4ee 100644
--- a/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c
+++ b/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c
@@ -22,6 +22,7 @@
* Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 Bayard G. Bell. All rights reserved.
* Copyright 2013 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2017 by Delphix. All rights reserved.
*/
/*
@@ -150,7 +151,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_MOUNTDEV,
&hsfs_proto_opttbl
};
diff --git a/usr/src/uts/common/fs/pcfs/pc_vfsops.c b/usr/src/uts/common/fs/pcfs/pc_vfsops.c
index b85c6abf43..53c49de28c 100644
--- a/usr/src/uts/common/fs/pcfs/pc_vfsops.c
+++ b/usr/src/uts/common/fs/pcfs/pc_vfsops.c
@@ -23,6 +23,9 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2017 by Delphix. All rights reserved.
+ */
#include <sys/param.h>
#include <sys/systm.h>
@@ -156,7 +159,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"pcfs",
pcfsinit,
- VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI,
+ VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI|VSW_MOUNTDEV,
&pcfs_mntopts
};
diff --git a/usr/src/uts/common/fs/udfs/udf_vfsops.c b/usr/src/uts/common/fs/udfs/udf_vfsops.c
index 479898fe9c..ebb1d7d813 100644
--- a/usr/src/uts/common/fs/udfs/udf_vfsops.c
+++ b/usr/src/uts/common/fs/udfs/udf_vfsops.c
@@ -22,6 +22,7 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright (c) 2011 Bayard G. Bell. All rights reserved.
+ * Copyright (c) 2017 by Delphix. All rights reserved.
*/
#include <sys/types.h>
@@ -121,7 +122,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"udfs",
udfinit,
- VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI,
+ VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI|VSW_MOUNTDEV,
&udfs_mntopts
};
@@ -177,7 +178,7 @@ _NOTE(SCHEME_PROTECTS_DATA("safe sharing", rootvp))
#endif
static int32_t
udf_mount(struct vfs *vfsp, struct vnode *mvp,
- struct mounta *uap, struct cred *cr)
+ struct mounta *uap, struct cred *cr)
{
dev_t dev;
struct vnode *lvp = NULL;
@@ -489,8 +490,7 @@ udf_sync(struct vfs *vfsp, int16_t flag, struct cred *cr)
/* ARGSUSED */
static int32_t
-udf_vget(struct vfs *vfsp,
- struct vnode **vpp, struct fid *fidp)
+udf_vget(struct vfs *vfsp, struct vnode **vpp, struct fid *fidp)
{
int32_t error = 0;
struct udf_fid *udfid;
@@ -612,9 +612,8 @@ udf_mountroot(struct vfs *vfsp, enum whymountroot why)
static int32_t
-ud_mountfs(struct vfs *vfsp,
- enum whymountroot why, dev_t dev, char *name,
- struct cred *cr, int32_t isroot)
+ud_mountfs(struct vfs *vfsp, enum whymountroot why, dev_t dev, char *name,
+ struct cred *cr, int32_t isroot)
{
struct vnode *devvp = NULL;
int32_t error = 0;
@@ -1554,7 +1553,7 @@ ud_destroy_fsp(struct udf_vfs *udf_vfsp)
void
ud_convert_to_superblock(struct udf_vfs *udf_vfsp,
- struct log_vol_int_desc *lvid)
+ struct log_vol_int_desc *lvid)
{
int32_t i, c;
uint32_t *temp;
@@ -1652,7 +1651,7 @@ int32_t ud_sub_count = 4;
*/
static int32_t
ud_val_get_vat(struct udf_vfs *udf_vfsp, dev_t dev,
- daddr_t blkno, struct ud_map *udm)
+ daddr_t blkno, struct ud_map *udm)
{
struct buf *secbp;
struct file_entry *fe;
@@ -1776,7 +1775,7 @@ end:
int32_t
ud_read_sparing_tbls(struct udf_vfs *udf_vfsp,
- dev_t dev, struct ud_map *map, struct pmap_typ2 *typ2)
+ dev_t dev, struct ud_map *map, struct pmap_typ2 *typ2)
{
int32_t index, valid = 0;
uint32_t sz;
diff --git a/usr/src/uts/common/fs/ufs/ufs_vfsops.c b/usr/src/uts/common/fs/ufs/ufs_vfsops.c
index 002d821ec2..afd43e7e63 100644
--- a/usr/src/uts/common/fs/ufs/ufs_vfsops.c
+++ b/usr/src/uts/common/fs/ufs/ufs_vfsops.c
@@ -23,6 +23,7 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2016 Nexenta Systems, Inc.
+ * Copyright (c) 2017 by Delphix. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
@@ -196,7 +197,7 @@ static vfsdef_t vfw = {
VFSDEF_VERSION,
"ufs",
ufsinit,
- VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI,
+ VSW_HASPROTO|VSW_CANREMOUNT|VSW_STATS|VSW_CANLOFI|VSW_MOUNTDEV,
&ufs_mntopts
};
@@ -258,8 +259,7 @@ static int mountfs(struct vfs *, enum whymountroot, struct vnode *, char *,
static int
ufs_mount(struct vfs *vfsp, struct vnode *mvp, struct mounta *uap,
- struct cred *cr)
-
+ struct cred *cr)
{
char *data = uap->dataptr;
int datalen = uap->datalen;
@@ -796,7 +796,7 @@ int ufs_mount_timeout = 60000; /* default to 1 minute */
static int
mountfs(struct vfs *vfsp, enum whymountroot why, struct vnode *devvp,
- char *path, cred_t *cr, int isroot, void *raw_argsp, int args_len)
+ char *path, cred_t *cr, int isroot, void *raw_argsp, int args_len)
{
dev_t dev = devvp->v_rdev;
struct fs *fsp;
diff --git a/usr/src/uts/common/fs/vfs.c b/usr/src/uts/common/fs/vfs.c
index 9d54e2b1bd..42198e2388 100644
--- a/usr/src/uts/common/fs/vfs.c
+++ b/usr/src/uts/common/fs/vfs.c
@@ -23,7 +23,7 @@
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2016 Joyent, Inc.
* Copyright 2016 Toomas Soome <tsoome@me.com>
- * Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2016, 2017 by Delphix. All rights reserved.
* Copyright 2016 Nexenta Systems, Inc.
* Copyright 2017 RackTop Systems.
*/
@@ -1291,7 +1291,8 @@ domount(char *fsname, struct mounta *uap, vnode_t *vp, struct cred *credp,
* successful for later cleanup and addition to
* the mount in progress table.
*/
- if ((uap->flags & MS_GLOBAL) == 0 &&
+ if ((vswp->vsw_flag & VSW_MOUNTDEV) &&
+ (uap->flags & MS_GLOBAL) == 0 &&
lookupname(uap->spec, fromspace,
FOLLOW, NULL, &bvp) == 0) {
addmip = 1;
@@ -1507,7 +1508,8 @@ domount(char *fsname, struct mounta *uap, vnode_t *vp, struct cred *credp,
* wlock above. This case is for a non-spliced, non-global filesystem.
*/
if (!addmip) {
- if ((uap->flags & MS_GLOBAL) == 0 &&
+ if ((vswp->vsw_flag & VSW_MOUNTDEV) &&
+ (uap->flags & MS_GLOBAL) == 0 &&
lookupname(uap->spec, fromspace, FOLLOW, NULL, &bvp) == 0) {
addmip = 1;
}
diff --git a/usr/src/uts/common/sys/vfs.h b/usr/src/uts/common/sys/vfs.h
index 76f8214d8c..3ae530ed22 100644
--- a/usr/src/uts/common/sys/vfs.h
+++ b/usr/src/uts/common/sys/vfs.h
@@ -22,7 +22,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2016 Toomas Soome <tsoome@me.com>
- * Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2016, 2017 by Delphix. All rights reserved.
* Copyright 2016 Nexenta Systems, Inc.
*/
@@ -416,6 +416,7 @@ enum {
#define VSW_XID 0x40 /* file system supports extended ids */
#define VSW_CANLOFI 0x80 /* file system supports lofi mounts */
#define VSW_ZMOUNT 0x100 /* file system always allowed in a zone */
+#define VSW_MOUNTDEV 0x200 /* file system is mounted via device path */
#define VSW_INSTALLED 0x8000 /* this vsw is associated with a file system */