Merge branch 'linux-ioctl' into refs/top-bases/linux-zfs-branch
This commit is contained in:
commit
c495db8223
|
@ -304,8 +304,8 @@ typedef enum zfs_cache_type {
|
||||||
#define ZPL_VERSION_1 1ULL
|
#define ZPL_VERSION_1 1ULL
|
||||||
#define ZPL_VERSION_2 2ULL
|
#define ZPL_VERSION_2 2ULL
|
||||||
#define ZPL_VERSION_3 3ULL
|
#define ZPL_VERSION_3 3ULL
|
||||||
#define ZPL_VERSION ZPL_VERSION_3
|
#define ZPL_VERSION ZPL_VERSION_1
|
||||||
#define ZPL_VERSION_STRING "3"
|
#define ZPL_VERSION_STRING "1"
|
||||||
|
|
||||||
#define ZPL_VERSION_INITIAL ZPL_VERSION_1
|
#define ZPL_VERSION_INITIAL ZPL_VERSION_1
|
||||||
#define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
|
#define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
|
||||||
|
@ -491,6 +491,8 @@ typedef struct vdev_stat {
|
||||||
#define ZVOL_DRIVER "zvol"
|
#define ZVOL_DRIVER "zvol"
|
||||||
#define ZFS_DRIVER "zfs"
|
#define ZFS_DRIVER "zfs"
|
||||||
#define ZFS_DEV "/dev/zfs"
|
#define ZFS_DEV "/dev/zfs"
|
||||||
|
#define ZFS_MAJOR 230 /* XXX: Arbitrary */
|
||||||
|
#define ZFS_MINORS 16 /* XXX: Arbitrary */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* zvol paths. Irritatingly, the devfsadm interfaces want all these
|
* zvol paths. Irritatingly, the devfsadm interfaces want all these
|
||||||
|
|
|
@ -182,6 +182,9 @@ changelist_prefix(prop_changelist_t *clp)
|
||||||
int
|
int
|
||||||
changelist_postfix(prop_changelist_t *clp)
|
changelist_postfix(prop_changelist_t *clp)
|
||||||
{
|
{
|
||||||
|
/* zfs-lustre: not needed */
|
||||||
|
return (0);
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
prop_changenode_t *cn;
|
prop_changenode_t *cn;
|
||||||
char shareopts[ZFS_MAXPROPLEN];
|
char shareopts[ZFS_MAXPROPLEN];
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
@ -296,6 +299,7 @@ changelist_postfix(prop_changelist_t *clp)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (errors ? -1 : 0);
|
return (errors ? -1 : 0);
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2874,6 +2874,8 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
|
||||||
goto ancestorerr;
|
goto ancestorerr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* zfs-lustre: not needed */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
if (zfs_mount(h, NULL, 0) != 0) {
|
if (zfs_mount(h, NULL, 0) != 0) {
|
||||||
opname = dgettext(TEXT_DOMAIN, "mount");
|
opname = dgettext(TEXT_DOMAIN, "mount");
|
||||||
goto ancestorerr;
|
goto ancestorerr;
|
||||||
|
@ -2883,6 +2885,7 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
|
||||||
opname = dgettext(TEXT_DOMAIN, "share");
|
opname = dgettext(TEXT_DOMAIN, "share");
|
||||||
goto ancestorerr;
|
goto ancestorerr;
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
zfs_close(h);
|
zfs_close(h);
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,6 +305,8 @@ zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
|
||||||
/*
|
/*
|
||||||
* Mount the given filesystem.
|
* Mount the given filesystem.
|
||||||
*/
|
*/
|
||||||
|
/* zfs-lustre: not supported */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
int
|
int
|
||||||
zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
|
zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
|
||||||
{
|
{
|
||||||
|
@ -372,6 +374,7 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unmount a single filesystem.
|
* Unmount a single filesystem.
|
||||||
|
@ -470,6 +473,8 @@ zfs_is_shared(zfs_handle_t *zhp)
|
||||||
return (rc ? B_TRUE : B_FALSE);
|
return (rc ? B_TRUE : B_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* zfs-lustre: unsupported */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
int
|
int
|
||||||
zfs_share(zfs_handle_t *zhp)
|
zfs_share(zfs_handle_t *zhp)
|
||||||
{
|
{
|
||||||
|
@ -478,6 +483,7 @@ zfs_share(zfs_handle_t *zhp)
|
||||||
|
|
||||||
return (zfs_share_proto(zhp, share_all_proto));
|
return (zfs_share_proto(zhp, share_all_proto));
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
int
|
int
|
||||||
zfs_unshare(zfs_handle_t *zhp)
|
zfs_unshare(zfs_handle_t *zhp)
|
||||||
|
@ -1168,6 +1174,8 @@ dataset_cmp(const void *a, const void *b)
|
||||||
* we have the list of all filesystems, we iterate over them in order and mount
|
* we have the list of all filesystems, we iterate over them in order and mount
|
||||||
* and/or share each one.
|
* and/or share each one.
|
||||||
*/
|
*/
|
||||||
|
/* zfs-lustre: not needed */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
#pragma weak zpool_mount_datasets = zpool_enable_datasets
|
#pragma weak zpool_mount_datasets = zpool_enable_datasets
|
||||||
int
|
int
|
||||||
zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
|
zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
|
||||||
|
@ -1233,6 +1241,7 @@ out:
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -1936,6 +1936,8 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
||||||
* created). Also mount any children of the target filesystem
|
* created). Also mount any children of the target filesystem
|
||||||
* if we did an incremental receive.
|
* if we did an incremental receive.
|
||||||
*/
|
*/
|
||||||
|
/* zfs-lustre: not needed */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
cp = strchr(zc.zc_value, '@');
|
cp = strchr(zc.zc_value, '@');
|
||||||
if (cp && (ioctl_err == 0 || !newfs)) {
|
if (cp && (ioctl_err == 0 || !newfs)) {
|
||||||
zfs_handle_t *h;
|
zfs_handle_t *h;
|
||||||
|
@ -1962,6 +1964,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
||||||
}
|
}
|
||||||
*cp = '@';
|
*cp = '@';
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
if (clp) {
|
if (clp) {
|
||||||
err |= changelist_postfix(clp);
|
err |= changelist_postfix(clp);
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include <sys/mnttab.h>
|
#include <sys/mnttab.h>
|
||||||
#include <sys/mntent.h>
|
#include <sys/mntent.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/dmu_ctl.h>
|
||||||
|
#include <sys/fs/zfs.h>
|
||||||
|
|
||||||
#include <libzfs.h>
|
#include <libzfs.h>
|
||||||
|
|
||||||
|
@ -561,10 +563,21 @@ libzfs_init(void)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SPL
|
||||||
|
#ifndef HAVE_GPL_ONLY_SYMBOLS
|
||||||
|
/* If we don't have access to GPL-only symbols then we may not use
|
||||||
|
* the udev APIs, therefore we must mknod the device ourselves. */
|
||||||
|
(void)mknod(ZFS_DEV, S_IFCHR | 0600, makedev(ZFS_MAJOR, 0));
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) {
|
if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) {
|
||||||
free(hdl);
|
free(hdl);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((hdl->libzfs_fd = dctlc_connect(DMU_CTL_DEFAULT_DIR, B_TRUE)) < 0)
|
||||||
|
hdl->libzfs_fd = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SETMNTENT
|
#ifdef HAVE_SETMNTENT
|
||||||
if ((hdl->libzfs_mnttab = setmntent(MNTTAB, "r")) == NULL) {
|
if ((hdl->libzfs_mnttab = setmntent(MNTTAB, "r")) == NULL) {
|
||||||
|
@ -587,7 +600,12 @@ libzfs_init(void)
|
||||||
void
|
void
|
||||||
libzfs_fini(libzfs_handle_t *hdl)
|
libzfs_fini(libzfs_handle_t *hdl)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_SPL
|
||||||
(void) close(hdl->libzfs_fd);
|
(void) close(hdl->libzfs_fd);
|
||||||
|
#else
|
||||||
|
if (hdl->libzfs_fd != -1)
|
||||||
|
dctlc_disconnect(hdl->libzfs_fd);
|
||||||
|
#endif
|
||||||
if (hdl->libzfs_mnttab)
|
if (hdl->libzfs_mnttab)
|
||||||
#ifdef HAVE_SETMNTENT
|
#ifdef HAVE_SETMNTENT
|
||||||
(void) endmntent(hdl->libzfs_mnttab);
|
(void) endmntent(hdl->libzfs_mnttab);
|
||||||
|
|
|
@ -38,12 +38,17 @@
|
||||||
#include <sys/zfs_ioctl.h>
|
#include <sys/zfs_ioctl.h>
|
||||||
#include <sys/zap.h>
|
#include <sys/zap.h>
|
||||||
#include <sys/zio_checksum.h>
|
#include <sys/zio_checksum.h>
|
||||||
|
#include <sys/dmu_ctl.h>
|
||||||
|
|
||||||
static char *dmu_recv_tag = "dmu_recv_tag";
|
static char *dmu_recv_tag = "dmu_recv_tag";
|
||||||
|
|
||||||
struct backuparg {
|
struct backuparg {
|
||||||
dmu_replay_record_t *drr;
|
dmu_replay_record_t *drr;
|
||||||
|
#ifdef _KERNEL
|
||||||
vnode_t *vp;
|
vnode_t *vp;
|
||||||
|
#else
|
||||||
|
int fd;
|
||||||
|
#endif
|
||||||
offset_t *off;
|
offset_t *off;
|
||||||
objset_t *os;
|
objset_t *os;
|
||||||
zio_cksum_t zc;
|
zio_cksum_t zc;
|
||||||
|
@ -53,6 +58,7 @@ struct backuparg {
|
||||||
static int
|
static int
|
||||||
dump_bytes(struct backuparg *ba, void *buf, int len)
|
dump_bytes(struct backuparg *ba, void *buf, int len)
|
||||||
{
|
{
|
||||||
|
#ifdef _KERNEL
|
||||||
ssize_t resid; /* have to get resid to get detailed errno */
|
ssize_t resid; /* have to get resid to get detailed errno */
|
||||||
ASSERT3U(len % 8, ==, 0);
|
ASSERT3U(len % 8, ==, 0);
|
||||||
|
|
||||||
|
@ -60,6 +66,12 @@ dump_bytes(struct backuparg *ba, void *buf, int len)
|
||||||
ba->err = vn_rdwr(UIO_WRITE, ba->vp,
|
ba->err = vn_rdwr(UIO_WRITE, ba->vp,
|
||||||
(caddr_t)buf, len,
|
(caddr_t)buf, len,
|
||||||
0, UIO_SYSSPACE, FAPPEND, RLIM64_INFINITY, CRED(), &resid);
|
0, UIO_SYSSPACE, FAPPEND, RLIM64_INFINITY, CRED(), &resid);
|
||||||
|
#else
|
||||||
|
ASSERT3U(len % 8, ==, 0);
|
||||||
|
|
||||||
|
fletcher_4_incremental_native(buf, len, &ba->zc);
|
||||||
|
ba->err = dctls_fd_write(ba->fd, buf, len);
|
||||||
|
#endif
|
||||||
*ba->off += len;
|
*ba->off += len;
|
||||||
return (ba->err);
|
return (ba->err);
|
||||||
}
|
}
|
||||||
|
@ -210,9 +222,15 @@ backup_cb(spa_t *spa, blkptr_t *bp, const zbookmark_t *zb,
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
int
|
int
|
||||||
dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
|
dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
|
||||||
vnode_t *vp, offset_t *off)
|
vnode_t *vp, offset_t *off)
|
||||||
|
#else
|
||||||
|
int
|
||||||
|
dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
|
||||||
|
int fd, offset_t *off)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
dsl_dataset_t *ds = tosnap->os->os_dsl_dataset;
|
dsl_dataset_t *ds = tosnap->os->os_dsl_dataset;
|
||||||
dsl_dataset_t *fromds = fromsnap ? fromsnap->os->os_dsl_dataset : NULL;
|
dsl_dataset_t *fromds = fromsnap ? fromsnap->os->os_dsl_dataset : NULL;
|
||||||
|
@ -272,7 +290,11 @@ dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
|
||||||
dsl_dataset_rele(fromds, FTAG);
|
dsl_dataset_rele(fromds, FTAG);
|
||||||
|
|
||||||
ba.drr = drr;
|
ba.drr = drr;
|
||||||
|
#ifdef _KERNEL
|
||||||
ba.vp = vp;
|
ba.vp = vp;
|
||||||
|
#else
|
||||||
|
ba.fd = fd;
|
||||||
|
#endif
|
||||||
ba.os = tosnap;
|
ba.os = tosnap;
|
||||||
ba.off = off;
|
ba.off = off;
|
||||||
ZIO_SET_CHECKSUM(&ba.zc, 0, 0, 0, 0);
|
ZIO_SET_CHECKSUM(&ba.zc, 0, 0, 0, 0);
|
||||||
|
@ -676,7 +698,11 @@ dmu_recv_begin(char *tofs, char *tosnap, struct drr_begin *drrb,
|
||||||
struct restorearg {
|
struct restorearg {
|
||||||
int err;
|
int err;
|
||||||
int byteswap;
|
int byteswap;
|
||||||
|
#ifdef _KERNEL
|
||||||
vnode_t *vp;
|
vnode_t *vp;
|
||||||
|
#else
|
||||||
|
int fd;
|
||||||
|
#endif
|
||||||
char *buf;
|
char *buf;
|
||||||
uint64_t voff;
|
uint64_t voff;
|
||||||
int bufsize; /* amount of memory allocated for buf */
|
int bufsize; /* amount of memory allocated for buf */
|
||||||
|
@ -695,6 +721,7 @@ restore_read(struct restorearg *ra, int len)
|
||||||
while (done < len) {
|
while (done < len) {
|
||||||
ssize_t resid;
|
ssize_t resid;
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
ra->err = vn_rdwr(UIO_READ, ra->vp,
|
ra->err = vn_rdwr(UIO_READ, ra->vp,
|
||||||
(caddr_t)ra->buf + done, len - done,
|
(caddr_t)ra->buf + done, len - done,
|
||||||
ra->voff, UIO_SYSSPACE, FAPPEND,
|
ra->voff, UIO_SYSSPACE, FAPPEND,
|
||||||
|
@ -702,6 +729,13 @@ restore_read(struct restorearg *ra, int len)
|
||||||
|
|
||||||
if (resid == len - done)
|
if (resid == len - done)
|
||||||
ra->err = EINVAL;
|
ra->err = EINVAL;
|
||||||
|
#else
|
||||||
|
ra->err = dctls_fd_read(ra->fd, (caddr_t) ra->buf + done,
|
||||||
|
len - done, &resid);
|
||||||
|
|
||||||
|
if (ra->err == 0 && resid == len - done)
|
||||||
|
ra->err = EINVAL;
|
||||||
|
#endif
|
||||||
ra->voff += len - done - resid;
|
ra->voff += len - done - resid;
|
||||||
done = len - resid;
|
done = len - resid;
|
||||||
if (ra->err)
|
if (ra->err)
|
||||||
|
@ -959,8 +993,13 @@ dmu_recv_abort_cleanup(dmu_recv_cookie_t *drc)
|
||||||
/*
|
/*
|
||||||
* NB: callers *must* call dmu_recv_end() if this succeeds.
|
* NB: callers *must* call dmu_recv_end() if this succeeds.
|
||||||
*/
|
*/
|
||||||
|
#ifdef _KERNEL
|
||||||
int
|
int
|
||||||
dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp)
|
dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp)
|
||||||
|
#else
|
||||||
|
int
|
||||||
|
dmu_recv_stream(dmu_recv_cookie_t *drc, int fd, offset_t *voffp)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
struct restorearg ra = { 0 };
|
struct restorearg ra = { 0 };
|
||||||
dmu_replay_record_t *drr;
|
dmu_replay_record_t *drr;
|
||||||
|
@ -997,7 +1036,11 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp)
|
||||||
drrb->drr_fromguid = BSWAP_64(drrb->drr_fromguid);
|
drrb->drr_fromguid = BSWAP_64(drrb->drr_fromguid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
ra.vp = vp;
|
ra.vp = vp;
|
||||||
|
#else
|
||||||
|
ra.fd = fd;
|
||||||
|
#endif
|
||||||
ra.voff = *voffp;
|
ra.voff = *voffp;
|
||||||
ra.bufsize = 1<<20;
|
ra.bufsize = 1<<20;
|
||||||
ra.buf = kmem_alloc(ra.bufsize, KM_SLEEP);
|
ra.buf = kmem_alloc(ra.bufsize, KM_SLEEP);
|
||||||
|
|
|
@ -637,8 +637,13 @@ typedef void (*dmu_traverse_cb_t)(objset_t *os, void *arg, struct blkptr *bp,
|
||||||
void dmu_traverse_objset(objset_t *os, uint64_t txg_start,
|
void dmu_traverse_objset(objset_t *os, uint64_t txg_start,
|
||||||
dmu_traverse_cb_t cb, void *arg);
|
dmu_traverse_cb_t cb, void *arg);
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
int dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
|
int dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
|
||||||
struct vnode *vp, offset_t *off);
|
struct vnode *vp, offset_t *off);
|
||||||
|
#else
|
||||||
|
int dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
|
||||||
|
int fd, offset_t *off);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct dmu_recv_cookie {
|
typedef struct dmu_recv_cookie {
|
||||||
/*
|
/*
|
||||||
|
@ -658,7 +663,11 @@ typedef struct dmu_recv_cookie {
|
||||||
|
|
||||||
int dmu_recv_begin(char *tofs, char *tosnap, struct drr_begin *,
|
int dmu_recv_begin(char *tofs, char *tosnap, struct drr_begin *,
|
||||||
boolean_t force, objset_t *origin, boolean_t online, dmu_recv_cookie_t *);
|
boolean_t force, objset_t *origin, boolean_t online, dmu_recv_cookie_t *);
|
||||||
|
#ifdef _KERNEL
|
||||||
int dmu_recv_stream(dmu_recv_cookie_t *drc, struct vnode *vp, offset_t *voffp);
|
int dmu_recv_stream(dmu_recv_cookie_t *drc, struct vnode *vp, offset_t *voffp);
|
||||||
|
#else
|
||||||
|
int dmu_recv_stream(dmu_recv_cookie_t *drc, int fd, offset_t *voffp);
|
||||||
|
#endif
|
||||||
int dmu_recv_end(dmu_recv_cookie_t *drc);
|
int dmu_recv_end(dmu_recv_cookie_t *drc);
|
||||||
void dmu_recv_abort_cleanup(dmu_recv_cookie_t *drc);
|
void dmu_recv_abort_cleanup(dmu_recv_cookie_t *drc);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <sys/zfs_vfsops.h>
|
#include <sys/zfs_vfsops.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/avl.h>
|
#include <sys/avl.h>
|
||||||
|
#include <sys/list.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <sys/dmu.h>
|
#include <sys/dmu.h>
|
||||||
#include <sys/zio.h>
|
#include <sys/zio.h>
|
||||||
#include <sys/dsl_deleg.h>
|
#include <sys/dsl_deleg.h>
|
||||||
|
#include <sys/zfs_i18n.h>
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
#include <sys/nvpair.h>
|
#include <sys/nvpair.h>
|
||||||
|
@ -137,12 +138,9 @@ typedef struct zfs_share {
|
||||||
* name lookups are case-sensitive. They may also be set up so that
|
* name lookups are case-sensitive. They may also be set up so that
|
||||||
* all the name lookups are case-insensitive, or so that only some
|
* all the name lookups are case-insensitive, or so that only some
|
||||||
* lookups, the ones that set an FIGNORECASE flag, are case-insensitive.
|
* lookups, the ones that set an FIGNORECASE flag, are case-insensitive.
|
||||||
|
*
|
||||||
|
* Defined in: <sys/zfs_i18n.h>
|
||||||
*/
|
*/
|
||||||
typedef enum zfs_case {
|
|
||||||
ZFS_CASE_SENSITIVE,
|
|
||||||
ZFS_CASE_INSENSITIVE,
|
|
||||||
ZFS_CASE_MIXED
|
|
||||||
} zfs_case_t;
|
|
||||||
|
|
||||||
typedef struct zfs_cmd {
|
typedef struct zfs_cmd {
|
||||||
char zc_name[MAXPATHLEN];
|
char zc_name[MAXPATHLEN];
|
||||||
|
@ -172,23 +170,57 @@ typedef struct zfs_cmd {
|
||||||
#define ZFS_MIN_MINOR (ZVOL_MAX_MINOR + 1)
|
#define ZFS_MIN_MINOR (ZVOL_MAX_MINOR + 1)
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
|
#ifdef HAVE_SPL
|
||||||
|
/* XXX: DISABLE ALL PERMISSION CHECKS */
|
||||||
|
static __inline__ int
|
||||||
|
zfs_secpolicy_destroy_perms(const char *name, cred_t *cr)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct zfs_creat {
|
static __inline__ int
|
||||||
nvlist_t *zct_zplprops;
|
secpolicy_zfs(const cred_t *cr)
|
||||||
nvlist_t *zct_props;
|
{
|
||||||
} zfs_creat_t;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline__ int
|
||||||
|
secpolicy_fs_unmount(cred_t *cr, struct vfs *vfsp)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static __inline__ int
|
||||||
|
secpolicy_sys_config(cred_t *cr, boolean_t flag)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline__ int
|
||||||
|
secpolicy_zinject(cred_t *cr)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
extern dev_info_t *zfs_dip;
|
extern dev_info_t *zfs_dip;
|
||||||
|
|
||||||
extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
|
extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
|
||||||
extern int zfs_secpolicy_rename_perms(const char *from,
|
extern int zfs_secpolicy_rename_perms(const char *from,
|
||||||
const char *to, cred_t *cr);
|
const char *to, cred_t *cr);
|
||||||
extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
|
extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
|
||||||
|
#endif /* HAVE_SPL */
|
||||||
|
|
||||||
extern int zfs_busy(void);
|
extern int zfs_busy(void);
|
||||||
extern int zfs_unmount_snap(char *, void *);
|
extern int zfs_unmount_snap(char *, void *);
|
||||||
|
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
#if defined(_KERNEL) || defined(WANT_KERNEL_EMUL) || defined(HAVE_SPL)
|
||||||
|
typedef struct zfs_creat {
|
||||||
|
nvlist_t *zct_zplprops;
|
||||||
|
nvlist_t *zct_props;
|
||||||
|
} zfs_creat_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -264,21 +264,6 @@ typedef struct znode {
|
||||||
#define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \
|
#define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \
|
||||||
mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
|
mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num)))
|
||||||
|
|
||||||
/*
|
|
||||||
* Macros to encode/decode ZFS stored time values from/to struct timespec
|
|
||||||
*/
|
|
||||||
#define ZFS_TIME_ENCODE(tp, stmp) \
|
|
||||||
{ \
|
|
||||||
(stmp)[0] = (uint64_t)(tp)->tv_sec; \
|
|
||||||
(stmp)[1] = (uint64_t)(tp)->tv_nsec; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ZFS_TIME_DECODE(tp, stmp) \
|
|
||||||
{ \
|
|
||||||
(tp)->tv_sec = (time_t)(stmp)[0]; \
|
|
||||||
(tp)->tv_nsec = (long)(stmp)[1]; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Timestamp defines
|
* Timestamp defines
|
||||||
*/
|
*/
|
||||||
|
@ -292,8 +277,6 @@ typedef struct znode {
|
||||||
|
|
||||||
extern int zfs_init_fs(zfsvfs_t *, znode_t **);
|
extern int zfs_init_fs(zfsvfs_t *, znode_t **);
|
||||||
extern void zfs_set_dataprop(objset_t *);
|
extern void zfs_set_dataprop(objset_t *);
|
||||||
extern void zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *,
|
|
||||||
dmu_tx_t *tx);
|
|
||||||
extern void zfs_time_stamper(znode_t *, uint_t, dmu_tx_t *);
|
extern void zfs_time_stamper(znode_t *, uint_t, dmu_tx_t *);
|
||||||
extern void zfs_time_stamper_locked(znode_t *, uint_t, dmu_tx_t *);
|
extern void zfs_time_stamper_locked(znode_t *, uint_t, dmu_tx_t *);
|
||||||
extern void zfs_grow_blocksize(znode_t *, uint64_t, dmu_tx_t *);
|
extern void zfs_grow_blocksize(znode_t *, uint64_t, dmu_tx_t *);
|
||||||
|
@ -309,8 +292,6 @@ extern void zfs_remove_op_tables(void);
|
||||||
extern int zfs_create_op_tables(void);
|
extern int zfs_create_op_tables(void);
|
||||||
extern int zfs_sync(vfs_t *vfsp, short flag, cred_t *cr);
|
extern int zfs_sync(vfs_t *vfsp, short flag, cred_t *cr);
|
||||||
extern dev_t zfs_cmpldev(uint64_t);
|
extern dev_t zfs_cmpldev(uint64_t);
|
||||||
extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value);
|
|
||||||
extern int zfs_set_version(const char *name, uint64_t newvers);
|
|
||||||
extern int zfs_get_stats(objset_t *os, nvlist_t *nv);
|
extern int zfs_get_stats(objset_t *os, nvlist_t *nv);
|
||||||
extern void zfs_znode_dmu_fini(znode_t *);
|
extern void zfs_znode_dmu_fini(znode_t *);
|
||||||
|
|
||||||
|
@ -347,6 +328,30 @@ extern int zfsfstype;
|
||||||
|
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
#if defined(_KERNEL) || defined(WANT_KERNEL_EMUL)
|
||||||
|
|
||||||
|
extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value);
|
||||||
|
extern int zfs_set_version(const char *name, uint64_t newvers);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macros to encode/decode ZFS stored time values from/to struct timespec
|
||||||
|
*/
|
||||||
|
#define ZFS_TIME_ENCODE(tp, stmp) \
|
||||||
|
{ \
|
||||||
|
(stmp)[0] = (uint64_t)(tp)->tv_sec; \
|
||||||
|
(stmp)[1] = (uint64_t)(tp)->tv_nsec; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ZFS_TIME_DECODE(tp, stmp) \
|
||||||
|
{ \
|
||||||
|
(tp)->tv_sec = (time_t)(stmp)[0]; \
|
||||||
|
(tp)->tv_nsec = (long)(stmp)[1]; \
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *,
|
||||||
|
dmu_tx_t *tx);
|
||||||
extern int zfs_obj_to_path(objset_t *osp, uint64_t obj, char *buf, int len);
|
extern int zfs_obj_to_path(objset_t *osp, uint64_t obj, char *buf, int len);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -38,10 +38,13 @@ extern "C" {
|
||||||
#define ZVOL_OBJ 1ULL
|
#define ZVOL_OBJ 1ULL
|
||||||
#define ZVOL_ZAP_OBJ 2ULL
|
#define ZVOL_ZAP_OBJ 2ULL
|
||||||
|
|
||||||
|
#if defined(_KERNEL) || defined(WANT_KERNEL_EMUL)
|
||||||
|
extern int zvol_get_stats(objset_t *os, nvlist_t *nv);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
extern int zvol_check_volsize(uint64_t volsize, uint64_t blocksize);
|
extern int zvol_check_volsize(uint64_t volsize, uint64_t blocksize);
|
||||||
extern int zvol_check_volblocksize(uint64_t volblocksize);
|
extern int zvol_check_volblocksize(uint64_t volblocksize);
|
||||||
extern int zvol_get_stats(objset_t *os, nvlist_t *nv);
|
|
||||||
extern void zvol_create_cb(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx);
|
extern void zvol_create_cb(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx);
|
||||||
extern int zvol_create_minor(const char *, major_t);
|
extern int zvol_create_minor(const char *, major_t);
|
||||||
extern int zvol_remove_minor(const char *);
|
extern int zvol_remove_minor(const char *);
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
#include <sys/systeminfo.h>
|
#include <sys/systeminfo.h>
|
||||||
#include <sys/sunddi.h>
|
#include <sys/sunddi.h>
|
||||||
#include <sys/spa_boot.h>
|
#include <sys/spa_boot.h>
|
||||||
|
#include <sys/zfs_znode.h>
|
||||||
|
|
||||||
#include "zfs_prop.h"
|
#include "zfs_prop.h"
|
||||||
#include "zfs_comutil.h"
|
#include "zfs_comutil.h"
|
||||||
|
@ -1903,10 +1904,11 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
|
||||||
dsl_pool_t *dp;
|
dsl_pool_t *dp;
|
||||||
dmu_tx_t *tx;
|
dmu_tx_t *tx;
|
||||||
int c, error = 0;
|
int c, error = 0;
|
||||||
uint64_t txg = TXG_INITIAL;
|
uint64_t txg = TXG_INITIAL, zpl_version;
|
||||||
nvlist_t **spares, **l2cache;
|
nvlist_t **spares, **l2cache, *zprops;
|
||||||
uint_t nspares, nl2cache;
|
uint_t nspares, nl2cache;
|
||||||
uint64_t version;
|
uint64_t version;
|
||||||
|
objset_t *os;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this pool already exists, return failure.
|
* If this pool already exists, return failure.
|
||||||
|
@ -2234,6 +2236,39 @@ spa_import_common(const char *pool, nvlist_t *config, nvlist_t *props,
|
||||||
spa->spa_import_faulted = B_FALSE;
|
spa->spa_import_faulted = B_FALSE;
|
||||||
mutex_exit(&spa_namespace_lock);
|
mutex_exit(&spa_namespace_lock);
|
||||||
|
|
||||||
|
#ifndef HAVE_ZPL
|
||||||
|
/*
|
||||||
|
* Create the pool's root filesystem.
|
||||||
|
*/
|
||||||
|
error = dmu_objset_open(pool, DMU_OST_ZFS, DS_MODE_PRIMARY, &os);
|
||||||
|
if (error != 0)
|
||||||
|
return (error);
|
||||||
|
|
||||||
|
tx = dmu_tx_create(os);
|
||||||
|
|
||||||
|
dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* master */
|
||||||
|
dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* del queue */
|
||||||
|
dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT); /* root node */
|
||||||
|
|
||||||
|
error = dmu_tx_assign(tx, TXG_WAIT);
|
||||||
|
ASSERT3U(error, ==, 0);
|
||||||
|
|
||||||
|
if (spa_version(dmu_objset_spa(os)) >= SPA_VERSION_FUID)
|
||||||
|
zpl_version = ZPL_VERSION;
|
||||||
|
else
|
||||||
|
zpl_version = MIN(ZPL_VERSION, ZPL_VERSION_FUID - 1);
|
||||||
|
|
||||||
|
VERIFY(nvlist_alloc(&zprops, NV_UNIQUE_NAME, KM_SLEEP) == 0);
|
||||||
|
VERIFY(nvlist_add_uint64(zprops, zfs_prop_to_name(ZFS_PROP_VERSION),
|
||||||
|
zpl_version) == 0);
|
||||||
|
|
||||||
|
zfs_create_fs(os, CRED(), zprops, tx);
|
||||||
|
nvlist_free(zprops);
|
||||||
|
|
||||||
|
dmu_tx_commit(tx);
|
||||||
|
dmu_objset_close(os);
|
||||||
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,19 +23,14 @@
|
||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/zfs_ioctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/buf.h>
|
|
||||||
#include <sys/modctl.h>
|
|
||||||
#include <sys/open.h>
|
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/kmem.h>
|
|
||||||
#include <sys/conf.h>
|
|
||||||
#include <sys/cmn_err.h>
|
#include <sys/cmn_err.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/zfs_ioctl.h>
|
|
||||||
#include <sys/zfs_znode.h>
|
#include <sys/zfs_znode.h>
|
||||||
#include <sys/zap.h>
|
#include <sys/zap.h>
|
||||||
#include <sys/spa.h>
|
#include <sys/spa.h>
|
||||||
|
@ -48,33 +43,34 @@
|
||||||
#include <sys/dsl_prop.h>
|
#include <sys/dsl_prop.h>
|
||||||
#include <sys/dsl_deleg.h>
|
#include <sys/dsl_deleg.h>
|
||||||
#include <sys/dmu_objset.h>
|
#include <sys/dmu_objset.h>
|
||||||
#include <sys/ddi.h>
|
|
||||||
#include <sys/sunddi.h>
|
#include <sys/sunddi.h>
|
||||||
#include <sys/sunldi.h>
|
|
||||||
#include <sys/policy.h>
|
#include <sys/policy.h>
|
||||||
#include <sys/zone.h>
|
|
||||||
#include <sys/nvpair.h>
|
#include <sys/nvpair.h>
|
||||||
#include <sys/pathname.h>
|
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/sdt.h>
|
#include <sys/sdt.h>
|
||||||
#include <sys/fs/zfs.h>
|
#include <sys/fs/zfs.h>
|
||||||
#include <sys/zfs_ctldir.h>
|
|
||||||
#include <sys/zfs_dir.h>
|
|
||||||
#include <sys/zvol.h>
|
#include <sys/zvol.h>
|
||||||
#include <sharefs/share.h>
|
|
||||||
#include <sys/dmu_objset.h>
|
#include <sys/dmu_objset.h>
|
||||||
|
#include <sys/systm.h>
|
||||||
|
#ifndef _KERNEL
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "zfs_namecheck.h"
|
#include "zfs_namecheck.h"
|
||||||
#include "zfs_prop.h"
|
#include "zfs_prop.h"
|
||||||
#include "zfs_deleg.h"
|
#include "zfs_deleg.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
extern struct modlfs zfs_modlfs;
|
extern struct modlfs zfs_modlfs;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void zfs_init(void);
|
extern void zfs_init(void);
|
||||||
extern void zfs_fini(void);
|
extern void zfs_fini(void);
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
ldi_ident_t zfs_li = NULL;
|
ldi_ident_t zfs_li = NULL;
|
||||||
dev_info_t *zfs_dip;
|
dev_info_t *zfs_dip;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef int zfs_ioc_func_t(zfs_cmd_t *);
|
typedef int zfs_ioc_func_t(zfs_cmd_t *);
|
||||||
typedef int zfs_secpolicy_func_t(zfs_cmd_t *, cred_t *);
|
typedef int zfs_secpolicy_func_t(zfs_cmd_t *, cred_t *);
|
||||||
|
@ -96,6 +92,7 @@ static int zfs_fill_zplprops_root(uint64_t, nvlist_t *, nvlist_t *,
|
||||||
int zfs_set_prop_nvlist(const char *, nvlist_t *);
|
int zfs_set_prop_nvlist(const char *, nvlist_t *);
|
||||||
|
|
||||||
/* _NOTE(PRINTFLIKE(4)) - this is printf-like, but lint is too whiney */
|
/* _NOTE(PRINTFLIKE(4)) - this is printf-like, but lint is too whiney */
|
||||||
|
#if 0
|
||||||
void
|
void
|
||||||
__dprintf(const char *file, const char *func, int line, const char *fmt, ...)
|
__dprintf(const char *file, const char *func, int line, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
@ -130,6 +127,7 @@ __dprintf(const char *file, const char *func, int line, const char *fmt, ...)
|
||||||
DTRACE_PROBE4(zfs__dprintf,
|
DTRACE_PROBE4(zfs__dprintf,
|
||||||
char *, newfile, char *, func, int, line, char *, buf);
|
char *, newfile, char *, func, int, line, char *, buf);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
history_str_free(char *buf)
|
history_str_free(char *buf)
|
||||||
|
@ -394,6 +392,8 @@ zfs_secpolicy_send(zfs_cmd_t *zc, cred_t *cr)
|
||||||
int
|
int
|
||||||
zfs_secpolicy_share(zfs_cmd_t *zc, cred_t *cr)
|
zfs_secpolicy_share(zfs_cmd_t *zc, cred_t *cr)
|
||||||
{
|
{
|
||||||
|
return (ENOTSUP);
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
if (!INGLOBALZONE(curproc))
|
if (!INGLOBALZONE(curproc))
|
||||||
return (EPERM);
|
return (EPERM);
|
||||||
|
|
||||||
|
@ -420,6 +420,7 @@ zfs_secpolicy_share(zfs_cmd_t *zc, cred_t *cr)
|
||||||
return (dsl_deleg_access(zc->zc_name,
|
return (dsl_deleg_access(zc->zc_name,
|
||||||
ZFS_DELEG_PERM_SHARE, cr));
|
ZFS_DELEG_PERM_SHARE, cr));
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -444,6 +445,8 @@ zfs_get_parent(const char *datasetname, char *parent, int parentsize)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For zfs-lustre function is already defined in kernel.c */
|
||||||
|
#ifdef _KERENL
|
||||||
int
|
int
|
||||||
zfs_secpolicy_destroy_perms(const char *name, cred_t *cr)
|
zfs_secpolicy_destroy_perms(const char *name, cred_t *cr)
|
||||||
{
|
{
|
||||||
|
@ -455,6 +458,7 @@ zfs_secpolicy_destroy_perms(const char *name, cred_t *cr)
|
||||||
|
|
||||||
return (zfs_secpolicy_write_perms(name, ZFS_DELEG_PERM_DESTROY, cr));
|
return (zfs_secpolicy_write_perms(name, ZFS_DELEG_PERM_DESTROY, cr));
|
||||||
}
|
}
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zfs_secpolicy_destroy(zfs_cmd_t *zc, cred_t *cr)
|
zfs_secpolicy_destroy(zfs_cmd_t *zc, cred_t *cr)
|
||||||
|
@ -472,6 +476,8 @@ zfs_secpolicy_iscsi(zfs_cmd_t *zc, cred_t *cr)
|
||||||
return (secpolicy_zfs(cr));
|
return (secpolicy_zfs(cr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For zfs-lustre function is already defined in kernel.c */
|
||||||
|
#ifdef _KERNEL
|
||||||
int
|
int
|
||||||
zfs_secpolicy_rename_perms(const char *from, const char *to, cred_t *cr)
|
zfs_secpolicy_rename_perms(const char *from, const char *to, cred_t *cr)
|
||||||
{
|
{
|
||||||
|
@ -500,6 +506,7 @@ zfs_secpolicy_rename_perms(const char *from, const char *to, cred_t *cr)
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zfs_secpolicy_rename(zfs_cmd_t *zc, cred_t *cr)
|
zfs_secpolicy_rename(zfs_cmd_t *zc, cred_t *cr)
|
||||||
|
@ -566,6 +573,8 @@ zfs_secpolicy_receive(zfs_cmd_t *zc, cred_t *cr)
|
||||||
ZFS_DELEG_PERM_CREATE, cr));
|
ZFS_DELEG_PERM_CREATE, cr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For zfs-lustre function is already defined in kernel.c */
|
||||||
|
#ifdef _KERNEL
|
||||||
int
|
int
|
||||||
zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr)
|
zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr)
|
||||||
{
|
{
|
||||||
|
@ -580,6 +589,7 @@ zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr)
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zfs_secpolicy_snapshot(zfs_cmd_t *zc, cred_t *cr)
|
zfs_secpolicy_snapshot(zfs_cmd_t *zc, cred_t *cr)
|
||||||
|
@ -614,6 +624,7 @@ zfs_secpolicy_create(zfs_cmd_t *zc, cred_t *cr)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
static int
|
static int
|
||||||
zfs_secpolicy_umount(zfs_cmd_t *zc, cred_t *cr)
|
zfs_secpolicy_umount(zfs_cmd_t *zc, cred_t *cr)
|
||||||
{
|
{
|
||||||
|
@ -625,6 +636,7 @@ zfs_secpolicy_umount(zfs_cmd_t *zc, cred_t *cr)
|
||||||
}
|
}
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Policy for pool operations - create/destroy pools, add vdevs, etc. Requires
|
* Policy for pool operations - create/destroy pools, add vdevs, etc. Requires
|
||||||
|
@ -1521,17 +1533,10 @@ zfs_set_prop_nvlist(const char *name, nvlist_t *nvl)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZFS_PROP_VOLSIZE:
|
case ZFS_PROP_VOLSIZE:
|
||||||
if ((error = nvpair_value_uint64(elem, &intval)) != 0 ||
|
return (ENOTSUP);
|
||||||
(error = zvol_set_volsize(name,
|
|
||||||
ddi_driver_major(zfs_dip), intval)) != 0)
|
|
||||||
return (error);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZFS_PROP_VOLBLOCKSIZE:
|
case ZFS_PROP_VOLBLOCKSIZE:
|
||||||
if ((error = nvpair_value_uint64(elem, &intval)) != 0 ||
|
return (ENOTSUP);
|
||||||
(error = zvol_set_volblocksize(name, intval)) != 0)
|
|
||||||
return (error);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZFS_PROP_VERSION:
|
case ZFS_PROP_VERSION:
|
||||||
if ((error = nvpair_value_uint64(elem, &intval)) != 0 ||
|
if ((error = nvpair_value_uint64(elem, &intval)) != 0 ||
|
||||||
|
@ -1688,6 +1693,8 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc)
|
||||||
static int
|
static int
|
||||||
zfs_ioc_iscsi_perm_check(zfs_cmd_t *zc)
|
zfs_ioc_iscsi_perm_check(zfs_cmd_t *zc)
|
||||||
{
|
{
|
||||||
|
return (ENOTSUP);
|
||||||
|
#if 0
|
||||||
nvlist_t *nvp;
|
nvlist_t *nvp;
|
||||||
int error;
|
int error;
|
||||||
uint32_t uid;
|
uint32_t uid;
|
||||||
|
@ -1730,6 +1737,7 @@ zfs_ioc_iscsi_perm_check(zfs_cmd_t *zc)
|
||||||
zfs_prop_to_name(ZFS_PROP_SHAREISCSI), usercred);
|
zfs_prop_to_name(ZFS_PROP_SHAREISCSI), usercred);
|
||||||
crfree(usercred);
|
crfree(usercred);
|
||||||
return (error);
|
return (error);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1812,7 +1820,11 @@ zfs_ioc_get_fsacl(zfs_cmd_t *zc)
|
||||||
static int
|
static int
|
||||||
zfs_ioc_create_minor(zfs_cmd_t *zc)
|
zfs_ioc_create_minor(zfs_cmd_t *zc)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ZVOL
|
||||||
return (zvol_create_minor(zc->zc_name, ddi_driver_major(zfs_dip)));
|
return (zvol_create_minor(zc->zc_name, ddi_driver_major(zfs_dip)));
|
||||||
|
#else
|
||||||
|
return (ENOTSUP);
|
||||||
|
#endif /* HAVE_ZVOL */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1824,7 +1836,11 @@ zfs_ioc_create_minor(zfs_cmd_t *zc)
|
||||||
static int
|
static int
|
||||||
zfs_ioc_remove_minor(zfs_cmd_t *zc)
|
zfs_ioc_remove_minor(zfs_cmd_t *zc)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ZVOL
|
||||||
return (zvol_remove_minor(zc->zc_name));
|
return (zvol_remove_minor(zc->zc_name));
|
||||||
|
#else
|
||||||
|
return (ENOTSUP);
|
||||||
|
#endif /* HAVE_ZVOL */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1832,6 +1848,7 @@ zfs_ioc_remove_minor(zfs_cmd_t *zc)
|
||||||
* or NULL if no suitable entry is found. The caller of this routine
|
* or NULL if no suitable entry is found. The caller of this routine
|
||||||
* is responsible for releasing the returned vfs pointer.
|
* is responsible for releasing the returned vfs pointer.
|
||||||
*/
|
*/
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
static vfs_t *
|
static vfs_t *
|
||||||
zfs_get_vfs(const char *resource)
|
zfs_get_vfs(const char *resource)
|
||||||
{
|
{
|
||||||
|
@ -1851,6 +1868,7 @@ zfs_get_vfs(const char *resource)
|
||||||
vfs_list_unlock();
|
vfs_list_unlock();
|
||||||
return (vfs_found);
|
return (vfs_found);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
static void
|
static void
|
||||||
|
@ -2038,8 +2056,12 @@ zfs_ioc_create(zfs_cmd_t *zc)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DMU_OST_ZVOL:
|
case DMU_OST_ZVOL:
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
cbfunc = zvol_create_cb;
|
cbfunc = zvol_create_cb;
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
return (ENOTSUP);
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cbfunc = NULL;
|
cbfunc = NULL;
|
||||||
|
@ -2091,6 +2113,7 @@ zfs_ioc_create(zfs_cmd_t *zc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == DMU_OST_ZVOL) {
|
if (type == DMU_OST_ZVOL) {
|
||||||
|
#ifdef HAVE_ZVOL
|
||||||
uint64_t volsize, volblocksize;
|
uint64_t volsize, volblocksize;
|
||||||
|
|
||||||
if (nvprops == NULL ||
|
if (nvprops == NULL ||
|
||||||
|
@ -2119,6 +2142,10 @@ zfs_ioc_create(zfs_cmd_t *zc)
|
||||||
nvlist_free(nvprops);
|
nvlist_free(nvprops);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/* This should never be reached in zfs-lustre */
|
||||||
|
ASSERT(0);
|
||||||
|
#endif /* HAVE_ZVOL */
|
||||||
} else if (type == DMU_OST_ZFS) {
|
} else if (type == DMU_OST_ZFS) {
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -2225,6 +2252,8 @@ zfs_ioc_snapshot(zfs_cmd_t *zc)
|
||||||
int
|
int
|
||||||
zfs_unmount_snap(char *name, void *arg)
|
zfs_unmount_snap(char *name, void *arg)
|
||||||
{
|
{
|
||||||
|
/* Not needed in zfs-lustre */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
vfs_t *vfsp = NULL;
|
vfs_t *vfsp = NULL;
|
||||||
|
|
||||||
if (arg) {
|
if (arg) {
|
||||||
|
@ -2256,6 +2285,7 @@ zfs_unmount_snap(char *name, void *arg)
|
||||||
if ((err = dounmount(vfsp, flag, kcred)) != 0)
|
if ((err = dounmount(vfsp, flag, kcred)) != 0)
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2308,6 +2338,7 @@ zfs_ioc_destroy(zfs_cmd_t *zc)
|
||||||
static int
|
static int
|
||||||
zfs_ioc_rollback(zfs_cmd_t *zc)
|
zfs_ioc_rollback(zfs_cmd_t *zc)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
objset_t *os;
|
objset_t *os;
|
||||||
int error;
|
int error;
|
||||||
zfsvfs_t *zfsvfs = NULL;
|
zfsvfs_t *zfsvfs = NULL;
|
||||||
|
@ -2353,6 +2384,13 @@ zfs_ioc_rollback(zfs_cmd_t *zc)
|
||||||
/* Note, the dmu_objset_rollback() releases the objset for us. */
|
/* Note, the dmu_objset_rollback() releases the objset for us. */
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* Rollback is not supported in zfs-lustre yet.
|
||||||
|
* This functionality would require a proper implementation.
|
||||||
|
*/
|
||||||
|
return (ENOTSUP);
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2573,7 +2611,9 @@ zfs_ioc_send(zfs_cmd_t *zc)
|
||||||
{
|
{
|
||||||
objset_t *fromsnap = NULL;
|
objset_t *fromsnap = NULL;
|
||||||
objset_t *tosnap;
|
objset_t *tosnap;
|
||||||
|
#ifdef _KERNEL
|
||||||
file_t *fp;
|
file_t *fp;
|
||||||
|
#endif
|
||||||
int error;
|
int error;
|
||||||
offset_t off;
|
offset_t off;
|
||||||
|
|
||||||
|
@ -2601,6 +2641,7 @@ zfs_ioc_send(zfs_cmd_t *zc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
fp = getf(zc->zc_cookie);
|
fp = getf(zc->zc_cookie);
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
dmu_objset_close(tosnap);
|
dmu_objset_close(tosnap);
|
||||||
|
@ -2612,9 +2653,12 @@ zfs_ioc_send(zfs_cmd_t *zc)
|
||||||
off = fp->f_offset;
|
off = fp->f_offset;
|
||||||
error = dmu_sendbackup(tosnap, fromsnap, zc->zc_obj, fp->f_vnode, &off);
|
error = dmu_sendbackup(tosnap, fromsnap, zc->zc_obj, fp->f_vnode, &off);
|
||||||
|
|
||||||
if (VOP_SEEK(fp->f_vnode, fp->f_offset, &off, NULL) == 0)
|
|
||||||
fp->f_offset = off;
|
|
||||||
releasef(zc->zc_cookie);
|
releasef(zc->zc_cookie);
|
||||||
|
#else
|
||||||
|
off = 0;
|
||||||
|
error = dmu_sendbackup(tosnap, fromsnap, zc->zc_obj, zc->zc_cookie, &off);
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
if (fromsnap)
|
if (fromsnap)
|
||||||
dmu_objset_close(fromsnap);
|
dmu_objset_close(fromsnap);
|
||||||
dmu_objset_close(tosnap);
|
dmu_objset_close(tosnap);
|
||||||
|
@ -2760,6 +2804,7 @@ zfs_ioc_promote(zfs_cmd_t *zc)
|
||||||
* the first file system is shared.
|
* the first file system is shared.
|
||||||
* Neither sharefs, nfs or smbsrv are unloadable modules.
|
* Neither sharefs, nfs or smbsrv are unloadable modules.
|
||||||
*/
|
*/
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
int (*znfsexport_fs)(void *arg);
|
int (*znfsexport_fs)(void *arg);
|
||||||
int (*zshare_fs)(enum sharefs_sys_op, share_t *, uint32_t);
|
int (*zshare_fs)(enum sharefs_sys_op, share_t *, uint32_t);
|
||||||
int (*zsmbexport_fs)(void *arg, boolean_t add_share);
|
int (*zsmbexport_fs)(void *arg, boolean_t add_share);
|
||||||
|
@ -2770,8 +2815,13 @@ int zfs_smbshare_inited;
|
||||||
ddi_modhandle_t nfs_mod;
|
ddi_modhandle_t nfs_mod;
|
||||||
ddi_modhandle_t sharefs_mod;
|
ddi_modhandle_t sharefs_mod;
|
||||||
ddi_modhandle_t smbsrv_mod;
|
ddi_modhandle_t smbsrv_mod;
|
||||||
kmutex_t zfs_share_lock;
|
|
||||||
|
|
||||||
|
kmutex_t zfs_share_lock;
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
|
|
||||||
|
/* Not supported in zfs-lustre */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
static int
|
static int
|
||||||
zfs_init_sharefs()
|
zfs_init_sharefs()
|
||||||
{
|
{
|
||||||
|
@ -2791,10 +2841,12 @@ zfs_init_sharefs()
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zfs_ioc_share(zfs_cmd_t *zc)
|
zfs_ioc_share(zfs_cmd_t *zc)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
int error;
|
int error;
|
||||||
int opcode;
|
int opcode;
|
||||||
|
|
||||||
|
@ -2884,7 +2936,10 @@ zfs_ioc_share(zfs_cmd_t *zc)
|
||||||
zc->zc_share.z_sharemax);
|
zc->zc_share.z_sharemax);
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
|
#else
|
||||||
|
/* Not supported in zfs-lustre */
|
||||||
|
return (ENOTSUP);
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2945,18 +3000,24 @@ static zfs_ioc_vec_t zfs_ioc_vec[] = {
|
||||||
{ zfs_ioc_inherit_prop, zfs_secpolicy_inherit, DATASET_NAME, B_TRUE },
|
{ zfs_ioc_inherit_prop, zfs_secpolicy_inherit, DATASET_NAME, B_TRUE },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
int
|
||||||
zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
||||||
{
|
{
|
||||||
zfs_cmd_t *zc;
|
zfs_cmd_t *zc;
|
||||||
uint_t vec;
|
uint_t vec;
|
||||||
int error, rc;
|
int error, rc;
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
#ifdef HAVE_ZVOL
|
||||||
if (getminor(dev) != 0)
|
if (getminor(dev) != 0)
|
||||||
return (zvol_ioctl(dev, cmd, arg, flag, cr, rvalp));
|
return (zvol_ioctl(dev, cmd, arg, flag, cr, rvalp));
|
||||||
|
#endif /* HAVE_ZVOL */
|
||||||
|
|
||||||
vec = cmd - ZFS_IOC;
|
vec = cmd - ZFS_IOC;
|
||||||
ASSERT3U(getmajor(dev), ==, ddi_driver_major(zfs_dip));
|
ASSERT3U(getmajor(dev), ==, ddi_driver_major(zfs_dip));
|
||||||
|
#else
|
||||||
|
vec = cmd - ZFS_IOC;
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
if (vec >= sizeof (zfs_ioc_vec) / sizeof (zfs_ioc_vec[0]))
|
if (vec >= sizeof (zfs_ioc_vec) / sizeof (zfs_ioc_vec[0]))
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
@ -3004,6 +3065,7 @@ zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
static int
|
static int
|
||||||
zfs_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
|
zfs_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
|
||||||
{
|
{
|
||||||
|
@ -3024,7 +3086,15 @@ zfs_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
|
||||||
static int
|
static int
|
||||||
zfs_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
|
zfs_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
|
||||||
{
|
{
|
||||||
if (spa_busy() || zfs_busy() || zvol_busy())
|
#ifdef HAVE_ZVOL
|
||||||
|
if (zvol_busy())
|
||||||
|
return (DDI_FAILURE);
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
|
if (zfs_busy())
|
||||||
|
return (DDI_FAILURE);
|
||||||
|
#endif
|
||||||
|
if (spa_busy())
|
||||||
return (DDI_FAILURE);
|
return (DDI_FAILURE);
|
||||||
|
|
||||||
if (cmd != DDI_DETACH)
|
if (cmd != DDI_DETACH)
|
||||||
|
@ -3065,13 +3135,22 @@ zfs_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
|
||||||
* so most of the standard driver entry points are in zvol.c.
|
* so most of the standard driver entry points are in zvol.c.
|
||||||
*/
|
*/
|
||||||
static struct cb_ops zfs_cb_ops = {
|
static struct cb_ops zfs_cb_ops = {
|
||||||
|
#ifdef HAVE_ZVOL
|
||||||
zvol_open, /* open */
|
zvol_open, /* open */
|
||||||
zvol_close, /* close */
|
zvol_close, /* close */
|
||||||
zvol_strategy, /* strategy */
|
zvol_strategy, /* strategy */
|
||||||
nodev, /* print */
|
|
||||||
zvol_dump, /* dump */
|
zvol_dump, /* dump */
|
||||||
zvol_read, /* read */
|
zvol_read, /* read */
|
||||||
zvol_write, /* write */
|
zvol_write, /* write */
|
||||||
|
#else
|
||||||
|
nodev, /* open */
|
||||||
|
nodev, /* close */
|
||||||
|
nodev, /* strategy */
|
||||||
|
nodev, /* dump */
|
||||||
|
nodev, /* read */
|
||||||
|
nodev, /* write */
|
||||||
|
#endif
|
||||||
|
nodev, /* print */
|
||||||
zfsdev_ioctl, /* ioctl */
|
zfsdev_ioctl, /* ioctl */
|
||||||
nodev, /* devmap */
|
nodev, /* devmap */
|
||||||
nodev, /* mmap */
|
nodev, /* mmap */
|
||||||
|
|
|
@ -23,21 +23,15 @@
|
||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/zfs_znode.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
#include <sys/kmem.h>
|
|
||||||
#include <sys/pathname.h>
|
|
||||||
#include <sys/vnode.h>
|
|
||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
#include <sys/vfs_opreg.h>
|
|
||||||
#include <sys/mntent.h>
|
#include <sys/mntent.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/cmn_err.h>
|
#include <sys/cmn_err.h>
|
||||||
#include "fs/fs_subr.h"
|
|
||||||
#include <sys/zfs_znode.h>
|
|
||||||
#include <sys/zfs_dir.h>
|
|
||||||
#include <sys/zil.h>
|
#include <sys/zil.h>
|
||||||
#include <sys/fs/zfs.h>
|
#include <sys/fs/zfs.h>
|
||||||
#include <sys/dmu.h>
|
#include <sys/dmu.h>
|
||||||
|
@ -48,19 +42,15 @@
|
||||||
#include <sys/zap.h>
|
#include <sys/zap.h>
|
||||||
#include <sys/varargs.h>
|
#include <sys/varargs.h>
|
||||||
#include <sys/policy.h>
|
#include <sys/policy.h>
|
||||||
#include <sys/atomic.h>
|
|
||||||
#include <sys/mkdev.h>
|
#include <sys/mkdev.h>
|
||||||
#include <sys/modctl.h>
|
|
||||||
#include <sys/refstr.h>
|
|
||||||
#include <sys/zfs_ioctl.h>
|
#include <sys/zfs_ioctl.h>
|
||||||
#include <sys/zfs_ctldir.h>
|
|
||||||
#include <sys/zfs_fuid.h>
|
#include <sys/zfs_fuid.h>
|
||||||
#include <sys/bootconf.h>
|
|
||||||
#include <sys/sunddi.h>
|
#include <sys/sunddi.h>
|
||||||
#include <sys/dnlc.h>
|
|
||||||
#include <sys/dmu_objset.h>
|
|
||||||
#include <sys/spa_boot.h>
|
#include <sys/spa_boot.h>
|
||||||
|
#include <sys/dmu_objset.h>
|
||||||
|
|
||||||
|
/* This code is not needed for zfs-lustre */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
int zfsfstype;
|
int zfsfstype;
|
||||||
vfsops_t *zfs_vfsops = NULL;
|
vfsops_t *zfs_vfsops = NULL;
|
||||||
static major_t zfs_major;
|
static major_t zfs_major;
|
||||||
|
@ -1544,6 +1534,7 @@ zfs_busy(void)
|
||||||
{
|
{
|
||||||
return (zfs_active_fs_count != 0);
|
return (zfs_active_fs_count != 0);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
int
|
int
|
||||||
zfs_set_version(const char *name, uint64_t newvers)
|
zfs_set_version(const char *name, uint64_t newvers)
|
||||||
|
@ -1638,6 +1629,7 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
static vfsdef_t vfw = {
|
static vfsdef_t vfw = {
|
||||||
VFSDEF_VERSION,
|
VFSDEF_VERSION,
|
||||||
MNTTYPE_ZFS,
|
MNTTYPE_ZFS,
|
||||||
|
@ -1650,3 +1642,4 @@ static vfsdef_t vfw = {
|
||||||
struct modlfs zfs_modlfs = {
|
struct modlfs zfs_modlfs = {
|
||||||
&mod_fsops, "ZFS filesystem version " SPA_VERSION_STRING, &vfw
|
&mod_fsops, "ZFS filesystem version " SPA_VERSION_STRING, &vfw
|
||||||
};
|
};
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/mntent.h>
|
#include <sys/mntent.h>
|
||||||
#include <sys/mkdev.h>
|
#include <sys/mkdev.h>
|
||||||
#include <sys/u8_textprep.h>
|
|
||||||
#include <sys/dsl_dataset.h>
|
#include <sys/dsl_dataset.h>
|
||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
#include <sys/vfs_opreg.h>
|
#include <sys/vfs_opreg.h>
|
||||||
|
@ -61,6 +60,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/zap.h>
|
#include <sys/zap.h>
|
||||||
#include <sys/zfs_znode.h>
|
#include <sys/zfs_znode.h>
|
||||||
|
#include <sys/zfs_i18n.h>
|
||||||
|
|
||||||
#include "zfs_prop.h"
|
#include "zfs_prop.h"
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@
|
||||||
* (such as VFS logic) that will not compile easily in userland.
|
* (such as VFS logic) that will not compile easily in userland.
|
||||||
*/
|
*/
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
|
#ifndef HAVE_SPL /* Commented out until ZPL layer is written */
|
||||||
static kmem_cache_t *znode_cache = NULL;
|
static kmem_cache_t *znode_cache = NULL;
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
|
@ -1473,20 +1474,17 @@ log:
|
||||||
dmu_tx_commit(tx);
|
dmu_tx_commit(tx);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_SPL */
|
||||||
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
void
|
void
|
||||||
zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
|
zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
|
||||||
{
|
{
|
||||||
zfsvfs_t zfsvfs;
|
|
||||||
uint64_t moid, doid, version;
|
uint64_t moid, doid, version;
|
||||||
uint64_t sense = ZFS_CASE_SENSITIVE;
|
uint64_t sense = ZFS_CASE_SENSITIVE;
|
||||||
uint64_t norm = 0;
|
uint64_t norm = 0;
|
||||||
nvpair_t *elem;
|
nvpair_t *elem;
|
||||||
int error;
|
int error;
|
||||||
znode_t *rootzp = NULL;
|
|
||||||
vnode_t *vp;
|
|
||||||
vattr_t vattr;
|
|
||||||
znode_t *zp;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First attempt to create master node.
|
* First attempt to create master node.
|
||||||
|
@ -1541,10 +1539,18 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
|
||||||
error = zap_add(os, moid, ZFS_UNLINKED_SET, 8, 1, &doid, tx);
|
error = zap_add(os, moid, ZFS_UNLINKED_SET, 8, 1, &doid, tx);
|
||||||
ASSERT(error == 0);
|
ASSERT(error == 0);
|
||||||
|
|
||||||
|
#if defined(_KERNEL) && defined(HAVE_VFS)
|
||||||
/*
|
/*
|
||||||
* Create root znode. Create minimal znode/vnode/zfsvfs
|
* Create root znode. Create minimal znode/vnode/zfsvfs
|
||||||
* to allow zfs_mknode to work.
|
* to allow zfs_mknode to work.
|
||||||
*/
|
*/
|
||||||
|
{
|
||||||
|
znode_t *rootzp = NULL;
|
||||||
|
vnode_t *vp;
|
||||||
|
vattr_t vattr;
|
||||||
|
znode_t *zp;
|
||||||
|
zfsvfs_t zfsvfs;
|
||||||
|
|
||||||
vattr.va_mask = AT_MODE|AT_UID|AT_GID|AT_TYPE;
|
vattr.va_mask = AT_MODE|AT_UID|AT_GID|AT_TYPE;
|
||||||
vattr.va_type = VDIR;
|
vattr.va_type = VDIR;
|
||||||
vattr.va_mode = S_IFDIR|0755;
|
vattr.va_mode = S_IFDIR|0755;
|
||||||
|
@ -1593,9 +1599,64 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
|
||||||
dmu_buf_rele(rootzp->z_dbuf, NULL);
|
dmu_buf_rele(rootzp->z_dbuf, NULL);
|
||||||
rootzp->z_dbuf = NULL;
|
rootzp->z_dbuf = NULL;
|
||||||
kmem_cache_free(znode_cache, rootzp);
|
kmem_cache_free(znode_cache, rootzp);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* Create the root znode with code free of VFS dependencies.
|
||||||
|
* Sadly, we cannot create ACE entries as it's too tied to
|
||||||
|
* the VFS interface.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
uint64_t obj, z_norm = norm;
|
||||||
|
timestruc_t now;
|
||||||
|
dmu_buf_t *db;
|
||||||
|
znode_phys_t *pzp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fold case on file systems that are always or sometimes case
|
||||||
|
* insensitive.
|
||||||
|
*/
|
||||||
|
if (sense == ZFS_CASE_INSENSITIVE || sense == ZFS_CASE_MIXED)
|
||||||
|
z_norm |= U8_TEXTPREP_TOUPPER;
|
||||||
|
|
||||||
|
obj = zap_create_norm(os, z_norm, DMU_OT_DIRECTORY_CONTENTS,
|
||||||
|
DMU_OT_ZNODE, sizeof (znode_phys_t), tx);
|
||||||
|
|
||||||
|
VERIFY(0 == dmu_bonus_hold(os, obj, FTAG, &db));
|
||||||
|
dmu_buf_will_dirty(db, tx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the znode physical data to zero.
|
||||||
|
*/
|
||||||
|
ASSERT(db->db_size >= sizeof (znode_phys_t));
|
||||||
|
bzero(db->db_data, db->db_size);
|
||||||
|
pzp = db->db_data;
|
||||||
|
|
||||||
|
if (USE_FUIDS(version, os))
|
||||||
|
pzp->zp_flags = ZFS_ARCHIVE | ZFS_AV_MODIFIED;
|
||||||
|
|
||||||
|
pzp->zp_size = 2; /* "." and ".." */
|
||||||
|
pzp->zp_links = 2;
|
||||||
|
pzp->zp_parent = obj;
|
||||||
|
pzp->zp_gen = dmu_tx_get_txg(tx);
|
||||||
|
pzp->zp_mode = S_IFDIR | 0755;
|
||||||
|
pzp->zp_flags = ZFS_ACL_TRIVIAL;
|
||||||
|
|
||||||
|
gethrestime(&now);
|
||||||
|
|
||||||
|
ZFS_TIME_ENCODE(&now, pzp->zp_crtime);
|
||||||
|
ZFS_TIME_ENCODE(&now, pzp->zp_ctime);
|
||||||
|
ZFS_TIME_ENCODE(&now, pzp->zp_atime);
|
||||||
|
ZFS_TIME_ENCODE(&now, pzp->zp_mtime);
|
||||||
|
|
||||||
|
error = zap_add(os, moid, ZFS_ROOT_OBJ, 8, 1, &obj, tx);
|
||||||
|
ASSERT(error == 0);
|
||||||
|
|
||||||
|
dmu_buf_rele(db, FTAG);
|
||||||
|
}
|
||||||
|
#endif /* _KERNEL */
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _KERNEL */
|
|
||||||
/*
|
/*
|
||||||
* Given an object number, return its parent object number and whether
|
* Given an object number, return its parent object number and whether
|
||||||
* or not the object is an extended attribute directory.
|
* or not the object is an extended attribute directory.
|
||||||
|
|
|
@ -41,11 +41,6 @@
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/buf.h>
|
|
||||||
#include <sys/modctl.h>
|
|
||||||
#include <sys/open.h>
|
|
||||||
#include <sys/kmem.h>
|
|
||||||
#include <sys/conf.h>
|
|
||||||
#include <sys/cmn_err.h>
|
#include <sys/cmn_err.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/zap.h>
|
#include <sys/zap.h>
|
||||||
|
@ -58,11 +53,7 @@
|
||||||
#include <sys/dkio.h>
|
#include <sys/dkio.h>
|
||||||
#include <sys/efi_partition.h>
|
#include <sys/efi_partition.h>
|
||||||
#include <sys/byteorder.h>
|
#include <sys/byteorder.h>
|
||||||
#include <sys/pathname.h>
|
|
||||||
#include <sys/ddi.h>
|
|
||||||
#include <sys/sunddi.h>
|
#include <sys/sunddi.h>
|
||||||
#include <sys/crc32.h>
|
|
||||||
#include <sys/dirent.h>
|
|
||||||
#include <sys/policy.h>
|
#include <sys/policy.h>
|
||||||
#include <sys/fs/zfs.h>
|
#include <sys/fs/zfs.h>
|
||||||
#include <sys/zfs_ioctl.h>
|
#include <sys/zfs_ioctl.h>
|
||||||
|
@ -83,6 +74,8 @@
|
||||||
|
|
||||||
#include "zfs_namecheck.h"
|
#include "zfs_namecheck.h"
|
||||||
|
|
||||||
|
/* This code is not necessary for zfs-lustre */
|
||||||
|
#ifdef HAVE_ZVOL
|
||||||
static void *zvol_state;
|
static void *zvol_state;
|
||||||
|
|
||||||
#define ZVOL_DUMPSIZE "dumpsize"
|
#define ZVOL_DUMPSIZE "dumpsize"
|
||||||
|
@ -154,6 +147,7 @@ zvol_size_changed(zvol_state_t *zv, major_t maj)
|
||||||
spec_size_invalidate(dev, VBLK);
|
spec_size_invalidate(dev, VBLK);
|
||||||
spec_size_invalidate(dev, VCHR);
|
spec_size_invalidate(dev, VCHR);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZVOL */
|
||||||
|
|
||||||
int
|
int
|
||||||
zvol_check_volsize(uint64_t volsize, uint64_t blocksize)
|
zvol_check_volsize(uint64_t volsize, uint64_t blocksize)
|
||||||
|
@ -194,6 +188,7 @@ zvol_check_volblocksize(uint64_t volblocksize)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ZVOL
|
||||||
static void
|
static void
|
||||||
zvol_readonly_changed_cb(void *arg, uint64_t newval)
|
zvol_readonly_changed_cb(void *arg, uint64_t newval)
|
||||||
{
|
{
|
||||||
|
@ -204,6 +199,7 @@ zvol_readonly_changed_cb(void *arg, uint64_t newval)
|
||||||
else
|
else
|
||||||
zv->zv_flags &= ~ZVOL_RDONLY;
|
zv->zv_flags &= ~ZVOL_RDONLY;
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZVOL */
|
||||||
|
|
||||||
int
|
int
|
||||||
zvol_get_stats(objset_t *os, nvlist_t *nv)
|
zvol_get_stats(objset_t *os, nvlist_t *nv)
|
||||||
|
@ -229,6 +225,8 @@ zvol_get_stats(objset_t *os, nvlist_t *nv)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This code is not necessary for zfs-lustre */
|
||||||
|
#ifdef HAVE_ZVOL
|
||||||
/*
|
/*
|
||||||
* Find a free minor number.
|
* Find a free minor number.
|
||||||
*/
|
*/
|
||||||
|
@ -1737,3 +1735,4 @@ zvol_dump_fini(zvol_state_t *zv)
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZVOL */
|
||||||
|
|
|
@ -504,7 +504,8 @@ zfs_do_clone(int argc, char **argv)
|
||||||
/* pass to libzfs */
|
/* pass to libzfs */
|
||||||
ret = zfs_clone(zhp, argv[1], props);
|
ret = zfs_clone(zhp, argv[1], props);
|
||||||
|
|
||||||
/* create the mountpoint if necessary */
|
/* In zfs-lustre we can't mount the filesystem */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
zfs_handle_t *clone;
|
zfs_handle_t *clone;
|
||||||
|
|
||||||
|
@ -515,6 +516,7 @@ zfs_do_clone(int argc, char **argv)
|
||||||
zfs_close(clone);
|
zfs_close(clone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
zfs_close(zhp);
|
zfs_close(zhp);
|
||||||
nvlist_free(props);
|
nvlist_free(props);
|
||||||
|
@ -710,8 +712,11 @@ zfs_do_create(int argc, char **argv)
|
||||||
* Mount and/or share the new filesystem as appropriate. We provide a
|
* Mount and/or share the new filesystem as appropriate. We provide a
|
||||||
* verbose error message to let the user know that their filesystem was
|
* verbose error message to let the user know that their filesystem was
|
||||||
* in fact created, even if we failed to mount or share it.
|
* in fact created, even if we failed to mount or share it.
|
||||||
|
*
|
||||||
|
* In zfs-lustre, this is not supported.
|
||||||
*/
|
*/
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
if (canmount == ZFS_CANMOUNT_ON) {
|
if (canmount == ZFS_CANMOUNT_ON) {
|
||||||
if (zfs_mount(zhp, NULL, 0) != 0) {
|
if (zfs_mount(zhp, NULL, 0) != 0) {
|
||||||
(void) fprintf(stderr, gettext("filesystem "
|
(void) fprintf(stderr, gettext("filesystem "
|
||||||
|
@ -723,6 +728,7 @@ zfs_do_create(int argc, char **argv)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (zhp)
|
if (zhp)
|
||||||
|
@ -3140,7 +3146,7 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
|
||||||
*/
|
*/
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case OP_SHARE:
|
case OP_SHARE:
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
shared_nfs = zfs_is_shared_nfs(zhp, NULL);
|
shared_nfs = zfs_is_shared_nfs(zhp, NULL);
|
||||||
shared_smb = zfs_is_shared_smb(zhp, NULL);
|
shared_smb = zfs_is_shared_smb(zhp, NULL);
|
||||||
|
|
||||||
|
@ -3180,8 +3186,16 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
/* zfs-lustre: unsupported operation */
|
||||||
|
(void) fprintf(stderr, gettext("cannot share "
|
||||||
|
"'%s': unsupported operation\n"),
|
||||||
|
zfs_get_name(zhp));
|
||||||
|
return (1);
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
case OP_MOUNT:
|
case OP_MOUNT:
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
if (options == NULL)
|
if (options == NULL)
|
||||||
mnt.mnt_mntopts = "";
|
mnt.mnt_mntopts = "";
|
||||||
else
|
else
|
||||||
|
@ -3200,7 +3214,15 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
|
||||||
|
|
||||||
if (zfs_mount(zhp, options, flags) != 0)
|
if (zfs_mount(zhp, options, flags) != 0)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
/* zfs-lustre: unsupported operation */
|
||||||
|
(void) fprintf(stderr, gettext("cannot mount "
|
||||||
|
"'%s': unsupported operation\n"),
|
||||||
|
zfs_get_name(zhp));
|
||||||
|
return (1);
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(op == OP_SHARE);
|
assert(op == OP_SHARE);
|
||||||
|
@ -3949,6 +3971,7 @@ zfs_do_unshare(int argc, char **argv)
|
||||||
* Called when invoked as /etc/fs/zfs/mount. Do the mount if the mountpoint is
|
* Called when invoked as /etc/fs/zfs/mount. Do the mount if the mountpoint is
|
||||||
* 'legacy'. Otherwise, complain that use should be using 'zfs mount'.
|
* 'legacy'. Otherwise, complain that use should be using 'zfs mount'.
|
||||||
*/
|
*/
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
static int
|
static int
|
||||||
manual_mount(int argc, char **argv)
|
manual_mount(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -4079,6 +4102,7 @@ manual_unmount(int argc, char **argv)
|
||||||
|
|
||||||
return (unshare_unmount_path(OP_MOUNT, argv[0], flags, B_TRUE));
|
return (unshare_unmount_path(OP_MOUNT, argv[0], flags, B_TRUE));
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
volcheck(zpool_handle_t *zhp, void *data)
|
volcheck(zpool_handle_t *zhp, void *data)
|
||||||
|
@ -4148,6 +4172,7 @@ main(int argc, char **argv)
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
/*
|
/*
|
||||||
* This command also doubles as the /etc/fs mount and unmount program.
|
* This command also doubles as the /etc/fs mount and unmount program.
|
||||||
* Determine if we should take this behavior based on argv[0].
|
* Determine if we should take this behavior based on argv[0].
|
||||||
|
@ -4158,6 +4183,10 @@ main(int argc, char **argv)
|
||||||
} else if (strcmp(progname, "umount") == 0) {
|
} else if (strcmp(progname, "umount") == 0) {
|
||||||
ret = manual_unmount(argc, argv);
|
ret = manual_unmount(argc, argv);
|
||||||
} else {
|
} else {
|
||||||
|
#else
|
||||||
|
/* zfs-lustre: we always do this */
|
||||||
|
if (1) {
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
/*
|
/*
|
||||||
* Make sure the user has specified some command.
|
* Make sure the user has specified some command.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -722,6 +722,8 @@ zpool_do_create(int argc, char **argv)
|
||||||
mountpoint);
|
mountpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* zfs-lustre: not necessary */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
if ((dirp = opendir(buf)) == NULL && errno != ENOENT) {
|
if ((dirp = opendir(buf)) == NULL && errno != ENOENT) {
|
||||||
(void) fprintf(stderr, gettext("mountpoint '%s' : "
|
(void) fprintf(stderr, gettext("mountpoint '%s' : "
|
||||||
"%s\n"), buf, strerror(errno));
|
"%s\n"), buf, strerror(errno));
|
||||||
|
@ -744,6 +746,7 @@ zpool_do_create(int argc, char **argv)
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dryrun) {
|
if (dryrun) {
|
||||||
|
@ -774,8 +777,13 @@ zpool_do_create(int argc, char **argv)
|
||||||
zfs_prop_to_name(
|
zfs_prop_to_name(
|
||||||
ZFS_PROP_MOUNTPOINT),
|
ZFS_PROP_MOUNTPOINT),
|
||||||
mountpoint) == 0);
|
mountpoint) == 0);
|
||||||
|
/* zfs-lustre: not supported */
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
if (zfs_mount(pool, NULL, 0) == 0)
|
if (zfs_mount(pool, NULL, 0) == 0)
|
||||||
ret = zfs_shareall(pool);
|
ret = zfs_shareall(pool);
|
||||||
|
#else
|
||||||
|
ret = 0;
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
zfs_close(pool);
|
zfs_close(pool);
|
||||||
}
|
}
|
||||||
} else if (libzfs_errno(g_zfs) == EZFS_INVALIDNAME) {
|
} else if (libzfs_errno(g_zfs) == EZFS_INVALIDNAME) {
|
||||||
|
@ -1315,10 +1323,13 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
|
||||||
|
|
||||||
verify((zhp = zpool_open_canfail(g_zfs, name)) != NULL);
|
verify((zhp = zpool_open_canfail(g_zfs, name)) != NULL);
|
||||||
|
|
||||||
|
/* zfs-lustre: not needed */
|
||||||
|
#if HAVE_ZPL
|
||||||
if (zpool_enable_datasets(zhp, mntopts, 0) != 0) {
|
if (zpool_enable_datasets(zhp, mntopts, 0) != 0) {
|
||||||
zpool_close(zhp);
|
zpool_close(zhp);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
zpool_close(zhp);
|
zpool_close(zhp);
|
||||||
return (error);
|
return (error);
|
||||||
|
|
Loading…
Reference in New Issue