Refresh linux-ioctl

This commit is contained in:
Brian Behlendorf 2008-12-05 11:11:50 -08:00
parent 9baaa468ac
commit 8dea9da02d
21 changed files with 436 additions and 112 deletions

View File

@ -1,3 +1 @@
gcc-branch
fix-branch
feature-branch
zfs-branch

17
.topmsg
View File

@ -1,19 +1,6 @@
From: Brian Behlendorf <behlendorf1@llnl.gov>
Subject: [PATCH] zfs branch
Subject: [PATCH] linux ioctl
Merged result of all changes which are relevant to both Solaris
and Linux builds of the ZFS code. These are changes where there
is a reasonable chance they will be accepted upstream.
Additionally, since this is effectively the root of the linux
ZFS tree the core linux build system is added here. This
includes autogen.sh, configure.ac, m4 macros, some scripts/*,
and makefiles for all the core ZFS components. Linux-only
features which require tweaks to the build system should appear
on the relevant topic branches. All autotools products which
result from autogen.sh are commited to the linux-configure-branch.
This branch also contains the META, ChangeLog, AUTHORS,
README, and GIT files.
Linux ioctl kernel+user support
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>

View File

@ -304,8 +304,8 @@ typedef enum zfs_cache_type {
#define ZPL_VERSION_1 1ULL
#define ZPL_VERSION_2 2ULL
#define ZPL_VERSION_3 3ULL
#define ZPL_VERSION ZPL_VERSION_3
#define ZPL_VERSION_STRING "3"
#define ZPL_VERSION ZPL_VERSION_1
#define ZPL_VERSION_STRING "1"
#define ZPL_VERSION_INITIAL ZPL_VERSION_1
#define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
@ -491,6 +491,8 @@ typedef struct vdev_stat {
#define ZVOL_DRIVER "zvol"
#define ZFS_DRIVER "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

View File

@ -182,6 +182,9 @@ changelist_prefix(prop_changelist_t *clp)
int
changelist_postfix(prop_changelist_t *clp)
{
/* zfs-lustre: not needed */
return (0);
#ifdef HAVE_ZPL
prop_changenode_t *cn;
char shareopts[ZFS_MAXPROPLEN];
int errors = 0;
@ -296,6 +299,7 @@ changelist_postfix(prop_changelist_t *clp)
}
return (errors ? -1 : 0);
#endif /* HAVE_ZPL */
}
/*

View File

@ -2874,6 +2874,8 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
goto ancestorerr;
}
/* zfs-lustre: not needed */
#ifdef HAVE_ZPL
if (zfs_mount(h, NULL, 0) != 0) {
opname = dgettext(TEXT_DOMAIN, "mount");
goto ancestorerr;
@ -2883,6 +2885,7 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
opname = dgettext(TEXT_DOMAIN, "share");
goto ancestorerr;
}
#endif /* HAVE_ZPL */
zfs_close(h);
}

View File

@ -305,6 +305,8 @@ zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
/*
* Mount the given filesystem.
*/
/* zfs-lustre: not supported */
#ifdef HAVE_ZPL
int
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);
}
#endif /* HAVE_ZPL */
/*
* Unmount a single filesystem.
@ -470,6 +473,8 @@ zfs_is_shared(zfs_handle_t *zhp)
return (rc ? B_TRUE : B_FALSE);
}
/* zfs-lustre: unsupported */
#ifdef HAVE_ZPL
int
zfs_share(zfs_handle_t *zhp)
{
@ -478,6 +483,7 @@ zfs_share(zfs_handle_t *zhp)
return (zfs_share_proto(zhp, share_all_proto));
}
#endif /* HAVE_ZPL */
int
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
* and/or share each one.
*/
/* zfs-lustre: not needed */
#ifdef HAVE_ZPL
#pragma weak zpool_mount_datasets = zpool_enable_datasets
int
zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
@ -1233,6 +1241,7 @@ out:
return (ret);
}
#endif /* HAVE_ZPL */
static int

View File

@ -1930,6 +1930,8 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
* created). Also mount any children of the target filesystem
* if we did an incremental receive.
*/
/* zfs-lustre: not needed */
#ifdef HAVE_ZPL
cp = strchr(zc.zc_value, '@');
if (cp && (ioctl_err == 0 || !newfs)) {
zfs_handle_t *h;
@ -1956,6 +1958,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
}
*cp = '@';
}
#endif /* HAVE_ZPL */
if (clp) {
err |= changelist_postfix(clp);

View File

@ -40,6 +40,8 @@
#include <sys/mnttab.h>
#include <sys/mntent.h>
#include <sys/types.h>
#include <sys/dmu_ctl.h>
#include <sys/fs/zfs.h>
#include <libzfs.h>
@ -561,10 +563,21 @@ libzfs_init(void)
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) {
free(hdl);
return (NULL);
}
#else
if ((hdl->libzfs_fd = dctlc_connect(DMU_CTL_DEFAULT_DIR, B_TRUE)) < 0)
hdl->libzfs_fd = -1;
#endif
if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) {
(void) close(hdl->libzfs_fd);
@ -583,7 +596,12 @@ libzfs_init(void)
void
libzfs_fini(libzfs_handle_t *hdl)
{
#ifdef HAVE_SPL
(void) close(hdl->libzfs_fd);
#else
if (hdl->libzfs_fd != -1)
dctlc_disconnect(hdl->libzfs_fd);
#endif
if (hdl->libzfs_mnttab)
(void) fclose(hdl->libzfs_mnttab);
if (hdl->libzfs_sharetab)

View File

@ -38,12 +38,17 @@
#include <sys/zfs_ioctl.h>
#include <sys/zap.h>
#include <sys/zio_checksum.h>
#include <sys/dmu_ctl.h>
static char *dmu_recv_tag = "dmu_recv_tag";
struct backuparg {
dmu_replay_record_t *drr;
#ifdef _KERNEL
vnode_t *vp;
#else
int fd;
#endif
offset_t *off;
objset_t *os;
zio_cksum_t zc;
@ -53,6 +58,7 @@ struct backuparg {
static int
dump_bytes(struct backuparg *ba, void *buf, int len)
{
#ifdef _KERNEL
ssize_t resid; /* have to get resid to get detailed errno */
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,
(caddr_t)buf, len,
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;
return (ba->err);
}
@ -210,9 +222,15 @@ backup_cb(spa_t *spa, blkptr_t *bp, const zbookmark_t *zb,
return (err);
}
#ifdef _KERNEL
int
dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
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 *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);
ba.drr = drr;
#ifdef _KERNEL
ba.vp = vp;
#else
ba.fd = fd;
#endif
ba.os = tosnap;
ba.off = off;
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 {
int err;
int byteswap;
#ifdef _KERNEL
vnode_t *vp;
#else
int fd;
#endif
char *buf;
uint64_t voff;
int bufsize; /* amount of memory allocated for buf */
@ -695,6 +721,7 @@ restore_read(struct restorearg *ra, int len)
while (done < len) {
ssize_t resid;
#ifdef _KERNEL
ra->err = vn_rdwr(UIO_READ, ra->vp,
(caddr_t)ra->buf + done, len - done,
ra->voff, UIO_SYSSPACE, FAPPEND,
@ -702,6 +729,13 @@ restore_read(struct restorearg *ra, int len)
if (resid == len - done)
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;
done = len - resid;
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.
*/
#ifdef _KERNEL
int
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 };
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);
}
#ifdef _KERNEL
ra.vp = vp;
#else
ra.fd = fd;
#endif
ra.voff = *voffp;
ra.bufsize = 1<<20;
ra.buf = kmem_alloc(ra.bufsize, KM_SLEEP);

View File

@ -629,8 +629,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,
dmu_traverse_cb_t cb, void *arg);
#ifdef _KERNEL
int dmu_sendbackup(objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin,
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 {
/*
@ -650,7 +655,11 @@ typedef struct dmu_recv_cookie {
int dmu_recv_begin(char *tofs, char *tosnap, struct drr_begin *,
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);
#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);
void dmu_recv_abort_cleanup(dmu_recv_cookie_t *drc);

View File

@ -35,6 +35,7 @@
#include <sys/zfs_vfsops.h>
#endif
#include <sys/avl.h>
#include <sys/list.h>
#ifdef __cplusplus
extern "C" {

View File

@ -32,6 +32,7 @@
#include <sys/dmu.h>
#include <sys/zio.h>
#include <sys/dsl_deleg.h>
#include <sys/zfs_i18n.h>
#ifdef _KERNEL
#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
* all the name lookups are case-insensitive, or so that only some
* 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 {
char zc_name[MAXPATHLEN];
@ -172,23 +170,57 @@ typedef struct zfs_cmd {
#define ZFS_MIN_MINOR (ZVOL_MAX_MINOR + 1)
#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 {
nvlist_t *zct_zplprops;
nvlist_t *zct_props;
} zfs_creat_t;
static __inline__ int
secpolicy_zfs(const cred_t *cr)
{
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 int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
extern int zfs_secpolicy_rename_perms(const char *from,
const char *to, 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_unmount_snap(char *, void *);
#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
}
#endif

View File

@ -264,21 +264,6 @@ typedef struct znode {
#define ZFS_OBJ_HOLD_EXIT(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
*/
@ -292,8 +277,6 @@ typedef struct znode {
extern int zfs_init_fs(zfsvfs_t *, znode_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_locked(znode_t *, uint_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_sync(vfs_t *vfsp, short flag, cred_t *cr);
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 void zfs_znode_dmu_fini(znode_t *);
@ -347,6 +328,30 @@ extern int zfsfstype;
#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);
#ifdef __cplusplus

View File

@ -38,10 +38,13 @@ extern "C" {
#define ZVOL_OBJ 1ULL
#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
extern int zvol_check_volsize(uint64_t volsize, uint64_t blocksize);
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 int zvol_create_minor(const char *, major_t);
extern int zvol_remove_minor(const char *);

View File

@ -59,6 +59,7 @@
#include <sys/systeminfo.h>
#include <sys/sunddi.h>
#include <sys/spa_boot.h>
#include <sys/zfs_znode.h>
#include "zfs_prop.h"
#include "zfs_comutil.h"
@ -1900,10 +1901,11 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
dsl_pool_t *dp;
dmu_tx_t *tx;
int c, error = 0;
uint64_t txg = TXG_INITIAL;
nvlist_t **spares, **l2cache;
uint64_t txg = TXG_INITIAL, zpl_version;
nvlist_t **spares, **l2cache, *zprops;
uint_t nspares, nl2cache;
uint64_t version;
objset_t *os;
/*
* If this pool already exists, return failure.
@ -2231,6 +2233,39 @@ spa_import_common(const char *pool, nvlist_t *config, nvlist_t *props,
spa->spa_import_faulted = B_FALSE;
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);
}

View File

@ -23,19 +23,14 @@
* Use is subject to license terms.
*/
#include <sys/zfs_ioctl.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/uio.h>
#include <sys/buf.h>
#include <sys/modctl.h>
#include <sys/open.h>
#include <sys/file.h>
#include <sys/kmem.h>
#include <sys/conf.h>
#include <sys/cmn_err.h>
#include <sys/stat.h>
#include <sys/zfs_ioctl.h>
#include <sys/zfs_znode.h>
#include <sys/zap.h>
#include <sys/spa.h>
@ -48,33 +43,34 @@
#include <sys/dsl_prop.h>
#include <sys/dsl_deleg.h>
#include <sys/dmu_objset.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/sunldi.h>
#include <sys/policy.h>
#include <sys/zone.h>
#include <sys/nvpair.h>
#include <sys/pathname.h>
#include <sys/mount.h>
#include <sys/sdt.h>
#include <sys/fs/zfs.h>
#include <sys/zfs_ctldir.h>
#include <sys/zfs_dir.h>
#include <sys/zvol.h>
#include <sharefs/share.h>
#include <sys/dmu_objset.h>
#include <sys/systm.h>
#ifndef _KERNEL
#include <pthread.h>
#endif
#include "zfs_namecheck.h"
#include "zfs_prop.h"
#include "zfs_deleg.h"
#ifdef HAVE_ZPL
extern struct modlfs zfs_modlfs;
#endif
extern void zfs_init(void);
extern void zfs_fini(void);
#ifdef _KERNEL
ldi_ident_t zfs_li = NULL;
dev_info_t *zfs_dip;
#endif
typedef int zfs_ioc_func_t(zfs_cmd_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 *);
/* _NOTE(PRINTFLIKE(4)) - this is printf-like, but lint is too whiney */
#if 0
void
__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,
char *, newfile, char *, func, int, line, char *, buf);
}
#endif
static void
history_str_free(char *buf)
@ -394,6 +392,8 @@ zfs_secpolicy_send(zfs_cmd_t *zc, cred_t *cr)
int
zfs_secpolicy_share(zfs_cmd_t *zc, cred_t *cr)
{
return (ENOTSUP);
#ifdef HAVE_ZPL
if (!INGLOBALZONE(curproc))
return (EPERM);
@ -420,6 +420,7 @@ zfs_secpolicy_share(zfs_cmd_t *zc, cred_t *cr)
return (dsl_deleg_access(zc->zc_name,
ZFS_DELEG_PERM_SHARE, cr));
}
#endif /* HAVE_ZPL */
}
static int
@ -444,6 +445,8 @@ zfs_get_parent(const char *datasetname, char *parent, int parentsize)
return (0);
}
/* For zfs-lustre function is already defined in kernel.c */
#ifdef _KERENL
int
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));
}
#endif /* _KERNEL */
static int
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));
}
/* For zfs-lustre function is already defined in kernel.c */
#ifdef _KERNEL
int
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);
}
#endif /* _KERNEL */
static int
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));
}
/* For zfs-lustre function is already defined in kernel.c */
#ifdef _KERNEL
int
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);
}
#endif /* _KERNEL */
static int
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);
}
#ifdef HAVE_ZPL
static int
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);
}
#endif /* HAVE_ZPL */
/*
* 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;
case ZFS_PROP_VOLSIZE:
if ((error = nvpair_value_uint64(elem, &intval)) != 0 ||
(error = zvol_set_volsize(name,
ddi_driver_major(zfs_dip), intval)) != 0)
return (error);
break;
return (ENOTSUP);
case ZFS_PROP_VOLBLOCKSIZE:
if ((error = nvpair_value_uint64(elem, &intval)) != 0 ||
(error = zvol_set_volblocksize(name, intval)) != 0)
return (error);
break;
return (ENOTSUP);
case ZFS_PROP_VERSION:
if ((error = nvpair_value_uint64(elem, &intval)) != 0 ||
@ -1688,6 +1693,8 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc)
static int
zfs_ioc_iscsi_perm_check(zfs_cmd_t *zc)
{
return (ENOTSUP);
#if 0
nvlist_t *nvp;
int error;
uint32_t uid;
@ -1730,6 +1737,7 @@ zfs_ioc_iscsi_perm_check(zfs_cmd_t *zc)
zfs_prop_to_name(ZFS_PROP_SHAREISCSI), usercred);
crfree(usercred);
return (error);
#endif
}
/*
@ -1812,7 +1820,11 @@ zfs_ioc_get_fsacl(zfs_cmd_t *zc)
static int
zfs_ioc_create_minor(zfs_cmd_t *zc)
{
#ifdef HAVE_ZVOL
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
zfs_ioc_remove_minor(zfs_cmd_t *zc)
{
#ifdef HAVE_ZVOL
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
* is responsible for releasing the returned vfs pointer.
*/
#ifdef HAVE_ZPL
static vfs_t *
zfs_get_vfs(const char *resource)
{
@ -1851,6 +1868,7 @@ zfs_get_vfs(const char *resource)
vfs_list_unlock();
return (vfs_found);
}
#endif /* HAVE_ZPL */
/* ARGSUSED */
static void
@ -2038,8 +2056,12 @@ zfs_ioc_create(zfs_cmd_t *zc)
break;
case DMU_OST_ZVOL:
#ifdef HAVE_ZPL
cbfunc = zvol_create_cb;
break;
#else
return (ENOTSUP);
#endif /* HAVE_ZPL */
default:
cbfunc = NULL;
@ -2091,6 +2113,7 @@ zfs_ioc_create(zfs_cmd_t *zc)
}
if (type == DMU_OST_ZVOL) {
#ifdef HAVE_ZVOL
uint64_t volsize, volblocksize;
if (nvprops == NULL ||
@ -2119,6 +2142,10 @@ zfs_ioc_create(zfs_cmd_t *zc)
nvlist_free(nvprops);
return (error);
}
#else
/* This should never be reached in zfs-lustre */
ASSERT(0);
#endif /* HAVE_ZVOL */
} else if (type == DMU_OST_ZFS) {
int error;
@ -2225,6 +2252,8 @@ zfs_ioc_snapshot(zfs_cmd_t *zc)
int
zfs_unmount_snap(char *name, void *arg)
{
/* Not needed in zfs-lustre */
#ifdef HAVE_ZPL
vfs_t *vfsp = NULL;
if (arg) {
@ -2256,6 +2285,7 @@ zfs_unmount_snap(char *name, void *arg)
if ((err = dounmount(vfsp, flag, kcred)) != 0)
return (err);
}
#endif /* HAVE_ZPL */
return (0);
}
@ -2308,6 +2338,7 @@ zfs_ioc_destroy(zfs_cmd_t *zc)
static int
zfs_ioc_rollback(zfs_cmd_t *zc)
{
#ifdef HAVE_ZPL
objset_t *os;
int error;
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. */
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 *tosnap;
#ifdef _KERNEL
file_t *fp;
#endif
int error;
offset_t off;
@ -2601,6 +2641,7 @@ zfs_ioc_send(zfs_cmd_t *zc)
}
}
#ifdef _KERNEL
fp = getf(zc->zc_cookie);
if (fp == NULL) {
dmu_objset_close(tosnap);
@ -2612,9 +2653,12 @@ zfs_ioc_send(zfs_cmd_t *zc)
off = fp->f_offset;
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);
#else
off = 0;
error = dmu_sendbackup(tosnap, fromsnap, zc->zc_obj, zc->zc_cookie, &off);
#endif /* _KERNEL */
if (fromsnap)
dmu_objset_close(fromsnap);
dmu_objset_close(tosnap);
@ -2760,6 +2804,7 @@ zfs_ioc_promote(zfs_cmd_t *zc)
* the first file system is shared.
* Neither sharefs, nfs or smbsrv are unloadable modules.
*/
#ifdef HAVE_ZPL
int (*znfsexport_fs)(void *arg);
int (*zshare_fs)(enum sharefs_sys_op, share_t *, uint32_t);
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 sharefs_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
zfs_init_sharefs()
{
@ -2791,10 +2841,12 @@ zfs_init_sharefs()
}
return (0);
}
#endif /* HAVE_ZPL */
static int
zfs_ioc_share(zfs_cmd_t *zc)
{
#ifdef HAVE_ZPL
int error;
int opcode;
@ -2884,7 +2936,10 @@ zfs_ioc_share(zfs_cmd_t *zc)
zc->zc_share.z_sharemax);
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 },
};
static int
int
zfsdev_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
{
zfs_cmd_t *zc;
uint_t vec;
int error, rc;
#ifdef _KERNEL
#ifdef HAVE_ZVOL
if (getminor(dev) != 0)
return (zvol_ioctl(dev, cmd, arg, flag, cr, rvalp));
#endif /* HAVE_ZVOL */
vec = cmd - ZFS_IOC;
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]))
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);
}
#ifdef _KERNEL
static int
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
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);
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.
*/
static struct cb_ops zfs_cb_ops = {
#ifdef HAVE_ZVOL
zvol_open, /* open */
zvol_close, /* close */
zvol_strategy, /* strategy */
nodev, /* print */
zvol_dump, /* dump */
zvol_read, /* read */
zvol_write, /* write */
#else
nodev, /* open */
nodev, /* close */
nodev, /* strategy */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
#endif
nodev, /* print */
zfsdev_ioctl, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */

View File

@ -23,21 +23,15 @@
* Use is subject to license terms.
*/
#include <sys/zfs_znode.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysmacros.h>
#include <sys/kmem.h>
#include <sys/pathname.h>
#include <sys/vnode.h>
#include <sys/vfs.h>
#include <sys/vfs_opreg.h>
#include <sys/mntent.h>
#include <sys/mount.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/fs/zfs.h>
#include <sys/dmu.h>
@ -48,19 +42,15 @@
#include <sys/zap.h>
#include <sys/varargs.h>
#include <sys/policy.h>
#include <sys/atomic.h>
#include <sys/mkdev.h>
#include <sys/modctl.h>
#include <sys/refstr.h>
#include <sys/zfs_ioctl.h>
#include <sys/zfs_ctldir.h>
#include <sys/zfs_fuid.h>
#include <sys/bootconf.h>
#include <sys/sunddi.h>
#include <sys/dnlc.h>
#include <sys/dmu_objset.h>
#include <sys/spa_boot.h>
#include <sys/dmu_objset.h>
/* This code is not needed for zfs-lustre */
#ifdef HAVE_ZPL
int zfsfstype;
vfsops_t *zfs_vfsops = NULL;
static major_t zfs_major;
@ -1544,6 +1534,7 @@ zfs_busy(void)
{
return (zfs_active_fs_count != 0);
}
#endif /* HAVE_ZPL */
int
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);
}
#ifdef HAVE_ZPL
static vfsdef_t vfw = {
VFSDEF_VERSION,
MNTTYPE_ZFS,
@ -1650,3 +1642,4 @@ static vfsdef_t vfw = {
struct modlfs zfs_modlfs = {
&mod_fsops, "ZFS filesystem version " SPA_VERSION_STRING, &vfw
};
#endif /* HAVE_ZPL */

View File

@ -34,7 +34,6 @@
#include <sys/resource.h>
#include <sys/mntent.h>
#include <sys/mkdev.h>
#include <sys/u8_textprep.h>
#include <sys/dsl_dataset.h>
#include <sys/vfs.h>
#include <sys/vfs_opreg.h>
@ -61,6 +60,7 @@
#include <sys/stat.h>
#include <sys/zap.h>
#include <sys/zfs_znode.h>
#include <sys/zfs_i18n.h>
#include "zfs_prop.h"
@ -87,6 +87,7 @@
* (such as VFS logic) that will not compile easily in userland.
*/
#ifdef _KERNEL
#ifndef HAVE_SPL /* Commented out until ZPL layer is written */
static kmem_cache_t *znode_cache = NULL;
/*ARGSUSED*/
@ -1473,20 +1474,17 @@ log:
dmu_tx_commit(tx);
return (0);
}
#endif /* HAVE_SPL */
#endif /* _KERNEL */
void
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 sense = ZFS_CASE_SENSITIVE;
uint64_t norm = 0;
nvpair_t *elem;
int error;
znode_t *rootzp = NULL;
vnode_t *vp;
vattr_t vattr;
znode_t *zp;
/*
* 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);
ASSERT(error == 0);
#if defined(_KERNEL) && defined(HAVE_VFS)
/*
* Create root znode. Create minimal znode/vnode/zfsvfs
* 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_type = VDIR;
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);
rootzp->z_dbuf = NULL;
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
* or not the object is an extended attribute directory.

View File

@ -41,11 +41,6 @@
#include <sys/param.h>
#include <sys/errno.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/stat.h>
#include <sys/zap.h>
@ -58,11 +53,7 @@
#include <sys/dkio.h>
#include <sys/efi_partition.h>
#include <sys/byteorder.h>
#include <sys/pathname.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/crc32.h>
#include <sys/dirent.h>
#include <sys/policy.h>
#include <sys/fs/zfs.h>
#include <sys/zfs_ioctl.h>
@ -78,6 +69,8 @@
#include "zfs_namecheck.h"
/* This code is not necessary for zfs-lustre */
#ifdef HAVE_ZVOL
static void *zvol_state;
#define ZVOL_DUMPSIZE "dumpsize"
@ -149,6 +142,7 @@ zvol_size_changed(zvol_state_t *zv, major_t maj)
spec_size_invalidate(dev, VBLK);
spec_size_invalidate(dev, VCHR);
}
#endif /* HAVE_ZVOL */
int
zvol_check_volsize(uint64_t volsize, uint64_t blocksize)
@ -177,6 +171,7 @@ zvol_check_volblocksize(uint64_t volblocksize)
return (0);
}
#ifdef HAVE_ZVOL
static void
zvol_readonly_changed_cb(void *arg, uint64_t newval)
{
@ -187,6 +182,7 @@ zvol_readonly_changed_cb(void *arg, uint64_t newval)
else
zv->zv_flags &= ~ZVOL_RDONLY;
}
#endif /* HAVE_ZVOL */
int
zvol_get_stats(objset_t *os, nvlist_t *nv)
@ -212,6 +208,8 @@ zvol_get_stats(objset_t *os, nvlist_t *nv)
return (error);
}
/* This code is not necessary for zfs-lustre */
#ifdef HAVE_ZVOL
/*
* Find a free minor number.
*/
@ -1720,3 +1718,4 @@ zvol_dump_fini(zvol_state_t *zv)
return (0);
}
#endif /* HAVE_ZVOL */

View File

@ -504,7 +504,8 @@ zfs_do_clone(int argc, char **argv)
/* pass to libzfs */
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) {
zfs_handle_t *clone;
@ -515,6 +516,7 @@ zfs_do_clone(int argc, char **argv)
zfs_close(clone);
}
}
#endif /* HAVE_ZPL */
zfs_close(zhp);
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
* 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 zfs-lustre, this is not supported.
*/
ret = 0;
#ifdef HAVE_ZPL
if (canmount == ZFS_CANMOUNT_ON) {
if (zfs_mount(zhp, NULL, 0) != 0) {
(void) fprintf(stderr, gettext("filesystem "
@ -723,6 +728,7 @@ zfs_do_create(int argc, char **argv)
ret = 1;
}
}
#endif /* HAVE_ZPL */
error:
if (zhp)
@ -3140,7 +3146,7 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
*/
switch (op) {
case OP_SHARE:
#ifdef HAVE_ZPL
shared_nfs = zfs_is_shared_nfs(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;
#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:
#ifdef HAVE_ZPL
if (options == NULL)
mnt.mnt_mntopts = "";
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)
return (1);
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 {
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
* 'legacy'. Otherwise, complain that use should be using 'zfs mount'.
*/
#ifdef HAVE_ZPL
static int
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));
}
#endif /* HAVE_ZPL */
static int
volcheck(zpool_handle_t *zhp, void *data)
@ -4148,6 +4172,7 @@ main(int argc, char **argv)
return (1);
}
#ifdef HAVE_ZPL
/*
* This command also doubles as the /etc/fs mount and unmount program.
* 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) {
ret = manual_unmount(argc, argv);
} else {
#else
/* zfs-lustre: we always do this */
if (1) {
#endif /* HAVE_ZPL */
/*
* Make sure the user has specified some command.
*/

View File

@ -722,6 +722,8 @@ zpool_do_create(int argc, char **argv)
mountpoint);
}
/* zfs-lustre: not necessary */
#ifdef HAVE_ZPL
if ((dirp = opendir(buf)) == NULL && errno != ENOENT) {
(void) fprintf(stderr, gettext("mountpoint '%s' : "
"%s\n"), buf, strerror(errno));
@ -744,6 +746,7 @@ zpool_do_create(int argc, char **argv)
goto errout;
}
}
#endif /* HAVE_ZPL */
}
if (dryrun) {
@ -774,8 +777,13 @@ zpool_do_create(int argc, char **argv)
zfs_prop_to_name(
ZFS_PROP_MOUNTPOINT),
mountpoint) == 0);
/* zfs-lustre: not supported */
#ifdef HAVE_ZPL
if (zfs_mount(pool, NULL, 0) == 0)
ret = zfs_shareall(pool);
#else
ret = 0;
#endif /* HAVE_ZPL */
zfs_close(pool);
}
} 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);
/* zfs-lustre: not needed */
#if HAVE_ZPL
if (zpool_enable_datasets(zhp, mntopts, 0) != 0) {
zpool_close(zhp);
return (1);
}
#endif /* HAVE_ZPL */
zpool_close(zhp);
return (error);