diff options
author | Matt Macy <mmacy@FreeBSD.org> | 2020-10-17 00:05:34 +0000 |
---|---|---|
committer | Matt Macy <mmacy@FreeBSD.org> | 2020-10-17 00:05:34 +0000 |
commit | 0be360124f8f108f73365e31448e7550f877f3ac (patch) | |
tree | 78557e980720fdcfd76497e6630c29ce1688559c /module/os | |
parent | e2228bd99047bb6a0cef0da931147b1f28f155c2 (diff) | |
download | src-vendor/openzfs.tar.gz src-vendor/openzfs.zip |
Update OpenZFS to 2.0.0-rc3-gbd565fvendor/openzfs/2.0.0-rc3-gfc5966vendor/openzfs
Notes
Notes:
svn path=/vendor-sys/openzfs/dist/; revision=366774
svn path=/vendor-sys/openzfs/2.0.0-rc3-gfc5966/; revision=366775; tag=vendor/openzfs/2.0.0-rc3-gfc5966
Diffstat (limited to 'module/os')
30 files changed, 205 insertions, 140 deletions
diff --git a/module/os/freebsd/spl/list.c b/module/os/freebsd/spl/list.c index 8796be4a98fb..0f5ae629126c 100644 --- a/module/os/freebsd/spl/list.c +++ b/module/os/freebsd/spl/list.c @@ -27,10 +27,10 @@ * Generic doubly-linked list implementation */ +#include <sys/param.h> #include <sys/list.h> #include <sys/list_impl.h> #include <sys/types.h> -#include <sys/sysmacros.h> #include <sys/debug.h> #define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset)) diff --git a/module/os/freebsd/spl/spl_kstat.c b/module/os/freebsd/spl/spl_kstat.c index 4cc77e20a4eb..b26753bacc21 100644 --- a/module/os/freebsd/spl/spl_kstat.c +++ b/module/os/freebsd/spl/spl_kstat.c @@ -231,6 +231,7 @@ restart: } free(ksp->ks_raw_buf, M_TEMP); mutex_exit(ksp->ks_lock); + sbuf_trim(sb); rc = sbuf_finish(sb); if (rc == 0) rc = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb)); diff --git a/module/os/freebsd/spl/spl_taskq.c b/module/os/freebsd/spl/spl_taskq.c index cc025de959e3..3fa7939bdb3c 100644 --- a/module/os/freebsd/spl/spl_taskq.c +++ b/module/os/freebsd/spl/spl_taskq.c @@ -29,18 +29,21 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/types.h> #include <sys/param.h> +#include <sys/ck.h> +#include <sys/epoch.h> #include <sys/kernel.h> #include <sys/kmem.h> #include <sys/lock.h> #include <sys/mutex.h> #include <sys/queue.h> -#include <sys/taskqueue.h> #include <sys/taskq.h> +#include <sys/taskqueue.h> #include <sys/zfs_context.h> -#include <sys/ck.h> -#include <sys/epoch.h> + +#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__) +#include <machine/pcb.h> +#endif #include <vm/uma.h> @@ -67,7 +70,7 @@ static unsigned long tqenthash; static unsigned long tqenthashlock; static struct sx *tqenthashtbl_lock; -static uint32_t tqidnext = 1; +static taskqid_t tqidnext; #define TQIDHASH(tqid) (&tqenthashtbl[(tqid) & tqenthash]) #define TQIDHASHLOCK(tqid) (&tqenthashtbl_lock[((tqid) & tqenthashlock)]) @@ -90,7 +93,6 @@ system_taskq_init(void *arg) M_TASKQ, M_WAITOK | M_ZERO); for (i = 0; i < tqenthashlock + 1; i++) sx_init_flags(&tqenthashtbl_lock[i], "tqenthash", SX_DUPOK); - tqidnext = 1; taskq_zone = uma_zcreate("taskq_zone", sizeof (taskq_ent_t), NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0); @@ -121,6 +123,35 @@ system_taskq_fini(void *arg) SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_fini, NULL); +#ifdef __LP64__ +static taskqid_t +__taskq_genid(void) +{ + taskqid_t tqid; + + /* + * Assume a 64-bit counter will not wrap in practice. + */ + tqid = atomic_add_64_nv(&tqidnext, 1); + VERIFY(tqid); + return (tqid); +} +#else +static taskqid_t +__taskq_genid(void) +{ + taskqid_t tqid; + + for (;;) { + tqid = atomic_add_32_nv(&tqidnext, 1); + if (__predict_true(tqid != 0)) + break; + } + VERIFY(tqid); + return (tqid); +} +#endif + static taskq_ent_t * taskq_lookup(taskqid_t tqid) { @@ -140,8 +171,9 @@ taskq_lookup(taskqid_t tqid) static taskqid_t taskq_insert(taskq_ent_t *ent) { - taskqid_t tqid = atomic_fetchadd_int(&tqidnext, 1); + taskqid_t tqid; + tqid = __taskq_genid(); ent->tqent_id = tqid; ent->tqent_registered = B_TRUE; sx_xlock(TQIDHASHLOCK(tqid)); @@ -289,7 +321,7 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, uint_t flags, clock_t expire_time) { taskq_ent_t *task; - taskqid_t tid; + taskqid_t tqid; clock_t timo; int mflag; @@ -310,13 +342,13 @@ taskq_dispatch_delay(taskq_t *tq, task_func_t func, void *arg, task->tqent_type = TIMEOUT_TASK; task->tqent_cancelled = B_FALSE; refcount_init(&task->tqent_rc, 1); - tid = taskq_insert(task); + tqid = taskq_insert(task); TIMEOUT_TASK_INIT(tq->tq_queue, &task->tqent_timeout_task, 0, taskq_run, task); taskqueue_enqueue_timeout(tq->tq_queue, &task->tqent_timeout_task, timo); - return (tid); + return (tqid); } taskqid_t @@ -324,7 +356,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) { taskq_ent_t *task; int mflag, prio; - taskqid_t tid; + taskqid_t tqid; if ((flags & (TQ_SLEEP | TQ_NOQUEUE)) == TQ_SLEEP) mflag = M_WAITOK; @@ -344,11 +376,10 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) task->tqent_arg = arg; task->tqent_cancelled = B_FALSE; task->tqent_type = NORMAL_TASK; - tid = taskq_insert(task); + tqid = taskq_insert(task); TASK_INIT(&task->tqent_task, prio, taskq_run, task); taskqueue_enqueue(tq->tq_queue, &task->tqent_task); - VERIFY(tid); - return (tid); + return (tqid); } static void diff --git a/module/os/freebsd/zfs/kmod_core.c b/module/os/freebsd/zfs/kmod_core.c index 3a13271aac6f..c11d4dbcf660 100644 --- a/module/os/freebsd/zfs/kmod_core.c +++ b/module/os/freebsd/zfs/kmod_core.c @@ -28,73 +28,68 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/types.h> #include <sys/param.h> -#include <sys/systm.h> +#include <sys/buf.h> +#include <sys/cmn_err.h> #include <sys/conf.h> +#include <sys/dmu.h> +#include <sys/dmu_impl.h> +#include <sys/dmu_objset.h> +#include <sys/dmu_send.h> +#include <sys/dmu_tx.h> +#include <sys/dsl_bookmark.h> +#include <sys/dsl_crypt.h> +#include <sys/dsl_dataset.h> +#include <sys/dsl_deleg.h> +#include <sys/dsl_destroy.h> +#include <sys/dsl_dir.h> +#include <sys/dsl_prop.h> +#include <sys/dsl_scan.h> +#include <sys/dsl_userhold.h> +#include <sys/errno.h> #include <sys/eventhandler.h> +#include <sys/file.h> +#include <sys/fm/util.h> +#include <sys/fs/zfs.h> #include <sys/kernel.h> +#include <sys/kmem.h> #include <sys/lock.h> #include <sys/malloc.h> +#include <sys/mount.h> #include <sys/mutex.h> +#include <sys/nvpair.h> +#include <sys/policy.h> #include <sys/proc.h> -#include <sys/errno.h> -#include <sys/uio.h> -#include <sys/buf.h> -#include <sys/file.h> -#include <sys/kmem.h> -#include <sys/conf.h> -#include <sys/eventhandler.h> -#include <sys/cmn_err.h> -#include <sys/stat.h> -#include <sys/zfs_ioctl.h> -#include <sys/zfs_vfsops.h> -#include <sys/zfs_znode.h> -#include <sys/zap.h> +#include <sys/sdt.h> #include <sys/spa.h> #include <sys/spa_impl.h> -#include <sys/vdev.h> -#include <sys/dmu.h> -#include <sys/dsl_dir.h> -#include <sys/dsl_dataset.h> -#include <sys/dsl_prop.h> -#include <sys/dsl_deleg.h> -#include <sys/dmu_objset.h> -#include <sys/dmu_impl.h> -#include <sys/dmu_tx.h> -#include <sys/fm/util.h> +#include <sys/stat.h> #include <sys/sunddi.h> -#include <sys/policy.h> -#include <sys/zone.h> -#include <sys/nvpair.h> -#include <sys/mount.h> +#include <sys/systm.h> #include <sys/taskqueue.h> -#include <sys/sdt.h> -#include <sys/fs/zfs.h> -#include <sys/zfs_ctldir.h> -#include <sys/zfs_dir.h> -#include <sys/zfs_onexit.h> -#include <sys/zvol.h> -#include <sys/dsl_scan.h> -#include <sys/dmu_objset.h> -#include <sys/dmu_send.h> -#include <sys/dsl_destroy.h> -#include <sys/dsl_bookmark.h> -#include <sys/dsl_userhold.h> -#include <sys/zfeature.h> -#include <sys/zcp.h> -#include <sys/zio_checksum.h> +#include <sys/uio.h> +#include <sys/vdev.h> #include <sys/vdev_removal.h> -#include <sys/dsl_crypt.h> +#include <sys/zap.h> +#include <sys/zcp.h> +#include <sys/zfeature.h> #include <sys/zfs_context.h> - +#include <sys/zfs_ctldir.h> +#include <sys/zfs_dir.h> +#include <sys/zfs_ioctl.h> #include <sys/zfs_ioctl_compat.h> #include <sys/zfs_ioctl_impl.h> +#include <sys/zfs_onexit.h> +#include <sys/zfs_vfsops.h> +#include <sys/zfs_znode.h> +#include <sys/zio_checksum.h> +#include <sys/zone.h> +#include <sys/zvol.h> +#include "zfs_comutil.h" +#include "zfs_deleg.h" #include "zfs_namecheck.h" #include "zfs_prop.h" -#include "zfs_deleg.h" -#include "zfs_comutil.h" SYSCTL_DECL(_vfs_zfs); SYSCTL_DECL(_vfs_zfs_vdev); @@ -122,7 +117,6 @@ extern zfsdev_state_t *zfsdev_state_list; #define ZFS_MIN_KSTACK_PAGES 4 - static int zfsdev_ioctl(struct cdev *dev, ulong_t zcmd, caddr_t arg, int flag, struct thread *td) @@ -333,7 +327,6 @@ zfs_shutdown(void *arg __unused, int howto __unused) zfs__fini(); } - static int zfs_modevent(module_t mod, int type, void *unused __unused) { diff --git a/module/os/freebsd/zfs/sysctl_os.c b/module/os/freebsd/zfs/sysctl_os.c index c9b350a540ea..1b37ce0d7f6b 100644 --- a/module/os/freebsd/zfs/sysctl_os.c +++ b/module/os/freebsd/zfs/sysctl_os.c @@ -300,8 +300,9 @@ SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_distance, CTLFLAG_RWTUN, /* max bytes to prefetch indirects for per stream (default 64MB) */ extern uint32_t zfetch_max_idistance; -SYSCTL_UINT(_vfs_zfs_prefetch, OID_AUTO, max_idistance, CTLFLAG_RWTUN, - &zfetch_max_idistance, 0, "Max bytes to prefetch indirects for per stream"); +SYSCTL_UINT(_vfs_zfs_zfetch, OID_AUTO, max_idistance, CTLFLAG_RWTUN, + &zfetch_max_idistance, 0, + "Max bytes to prefetch indirects for per stream (LEGACY)"); /* dsl_pool.c */ diff --git a/module/os/freebsd/zfs/zfs_acl.c b/module/os/freebsd/zfs/zfs_acl.c index 018120c82ab3..23b87de8bd0d 100644 --- a/module/os/freebsd/zfs/zfs_acl.c +++ b/module/os/freebsd/zfs/zfs_acl.c @@ -2494,7 +2494,7 @@ zfs_zaccess(znode_t *zp, int mode, int flags, boolean_t skipaclchk, cred_t *cr) /* * Translate traditional unix VREAD/VWRITE/VEXEC mode into - * native ACL format and call zfs_zaccess() + * NFSv4-style ZFS ACL format and call zfs_zaccess() */ int zfs_zaccess_rwx(znode_t *zp, mode_t mode, int flags, cred_t *cr) diff --git a/module/os/freebsd/zfs/zfs_ctldir.c b/module/os/freebsd/zfs/zfs_ctldir.c index 0fe32b19520c..587c648a028a 100644 --- a/module/os/freebsd/zfs/zfs_ctldir.c +++ b/module/os/freebsd/zfs/zfs_ctldir.c @@ -314,7 +314,6 @@ sfs_readdir_common(uint64_t parent_id, uint64_t id, struct vop_readdir_args *ap, static struct vop_vector zfsctl_ops_root; static struct vop_vector zfsctl_ops_snapdir; static struct vop_vector zfsctl_ops_snapshot; -static struct vop_vector zfsctl_ops_shares_dir; void zfsctl_init(void) @@ -331,8 +330,7 @@ zfsctl_is_node(vnode_t *vp) { return (vn_matchops(vp, zfsctl_ops_root) || vn_matchops(vp, zfsctl_ops_snapdir) || - vn_matchops(vp, zfsctl_ops_snapshot) || - vn_matchops(vp, zfsctl_ops_shares_dir)); + vn_matchops(vp, zfsctl_ops_snapshot)); } @@ -798,6 +796,9 @@ zfsctl_common_getacl(struct vop_getacl_args *ap) static struct vop_vector zfsctl_ops_root = { .vop_default = &default_vnodeops, +#if __FreeBSD_version >= 1300121 + .vop_fplookup_vexec = VOP_EAGAIN, +#endif .vop_open = zfsctl_common_open, .vop_close = zfsctl_common_close, .vop_ioctl = VOP_EINVAL, @@ -1115,6 +1116,9 @@ zfsctl_snapdir_getattr(struct vop_getattr_args *ap) static struct vop_vector zfsctl_ops_snapdir = { .vop_default = &default_vnodeops, +#if __FreeBSD_version >= 1300121 + .vop_fplookup_vexec = VOP_EAGAIN, +#endif .vop_open = zfsctl_common_open, .vop_close = zfsctl_common_close, .vop_getattr = zfsctl_snapdir_getattr, @@ -1216,6 +1220,9 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap) */ static struct vop_vector zfsctl_ops_snapshot = { .vop_default = NULL, /* ensure very restricted access */ +#if __FreeBSD_version >= 1300121 + .vop_fplookup_vexec = VOP_EAGAIN, +#endif .vop_inactive = zfsctl_snapshot_inactive, #if __FreeBSD_version >= 1300045 .vop_need_inactive = vop_stdneed_inactive, @@ -1327,7 +1334,7 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int fflags, cred_t *cr) } int -zfsctl_snapshot_unmount(char *snapname, int flags __unused) +zfsctl_snapshot_unmount(const char *snapname, int flags __unused) { vfs_t *vfsp = NULL; zfsvfs_t *zfsvfs = NULL; diff --git a/module/os/freebsd/zfs/zfs_vfsops.c b/module/os/freebsd/zfs/zfs_vfsops.c index ec8303283414..4e437f5bacc1 100644 --- a/module/os/freebsd/zfs/zfs_vfsops.c +++ b/module/os/freebsd/zfs/zfs_vfsops.c @@ -592,6 +592,14 @@ acl_inherit_changed_cb(void *arg, uint64_t newval) zfsvfs->z_acl_inherit = newval; } +static void +acl_type_changed_cb(void *arg, uint64_t newval) +{ + zfsvfs_t *zfsvfs = arg; + + zfsvfs->z_acl_type = newval; +} + static int zfs_register_callbacks(vfs_t *vfsp) { @@ -723,6 +731,8 @@ zfs_register_callbacks(vfs_t *vfsp) error = error ? error : dsl_prop_register(ds, zfs_prop_to_name(ZFS_PROP_SNAPDIR), snapdir_changed_cb, zfsvfs); error = error ? error : dsl_prop_register(ds, + zfs_prop_to_name(ZFS_PROP_ACLTYPE), acl_type_changed_cb, zfsvfs); + error = error ? error : dsl_prop_register(ds, zfs_prop_to_name(ZFS_PROP_ACLMODE), acl_mode_changed_cb, zfsvfs); error = error ? error : dsl_prop_register(ds, zfs_prop_to_name(ZFS_PROP_ACLINHERIT), acl_inherit_changed_cb, @@ -797,6 +807,11 @@ zfsvfs_init(zfsvfs_t *zfsvfs, objset_t *os) return (error); zfsvfs->z_case = (uint_t)val; + error = zfs_get_zplprop(os, ZFS_PROP_ACLTYPE, &val); + if (error != 0) + return (error); + zfsvfs->z_acl_type = (uint_t)val; + /* * Fold case on file systems that are always or sometimes case * insensitive. @@ -1232,6 +1247,10 @@ zfs_domount(vfs_t *vfsp, char *osname) "xattr", &pval, NULL))) goto out; xattr_changed_cb(zfsvfs, pval); + if ((error = dsl_prop_get_integer(osname, + "acltype", &pval, NULL))) + goto out; + acl_type_changed_cb(zfsvfs, pval); zfsvfs->z_issnap = B_TRUE; zfsvfs->z_os->os_sync = ZFS_SYNC_DISABLED; @@ -2220,6 +2239,9 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value) case ZFS_PROP_CASE: *value = ZFS_CASE_SENSITIVE; break; + case ZFS_PROP_ACLTYPE: + *value = ZFS_ACLTYPE_NFSV4; + break; default: return (error); } diff --git a/module/os/freebsd/zfs/zfs_vnops.c b/module/os/freebsd/zfs/zfs_vnops.c index 79202b60a6f0..18c71511fccd 100644 --- a/module/os/freebsd/zfs/zfs_vnops.c +++ b/module/os/freebsd/zfs/zfs_vnops.c @@ -104,14 +104,6 @@ VFS_SMR_DECLARE; #define vm_page_wire_unlock(pp) vm_page_unlock(pp) #endif -static int -zfs_u8_validate(const char *u8str, size_t n, char **list, int flag, int *errnum) -{ - - return (u8_validate(__DECONST(char *, u8str), n, list, flag, errnum)); -} -#define u8_validate zfs_u8_validate - #ifdef DEBUG_VFS_LOCKS #define VNCHECKREF(vp) \ VNASSERT((vp)->v_holdcnt > 0 && (vp)->v_usecount > 0, vp, \ @@ -1536,8 +1528,9 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *vp, const char *name, int lkflags) */ /* ARGSUSED */ static int -zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, - int nameiop, cred_t *cr, kthread_t *td, int flags, boolean_t cached) +zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp, + struct componentname *cnp, int nameiop, cred_t *cr, kthread_t *td, + int flags, boolean_t cached) { znode_t *zdp = VTOZ(dvp); znode_t *zp; @@ -1561,7 +1554,8 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, } } - DTRACE_PROBE2(zfs__fastpath__lookup__miss, vnode_t *, dvp, char *, nm); + DTRACE_PROBE2(zfs__fastpath__lookup__miss, vnode_t *, dvp, + const char *, nm); ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zdp); @@ -1778,7 +1772,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp, /* ARGSUSED */ int -zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl, int mode, +zfs_create(znode_t *dzp, const char *name, vattr_t *vap, int excl, int mode, znode_t **zpp, cred_t *cr, int flag, vsecattr_t *vsecp) { znode_t *zp; @@ -1945,7 +1939,7 @@ out: /*ARGSUSED*/ static int -zfs_remove_(vnode_t *dvp, vnode_t *vp, char *name, cred_t *cr) +zfs_remove_(vnode_t *dvp, vnode_t *vp, const char *name, cred_t *cr) { znode_t *dzp = VTOZ(dvp); znode_t *zp; @@ -2059,13 +2053,13 @@ out: static int -zfs_lookup_internal(znode_t *dzp, char *name, vnode_t **vpp, +zfs_lookup_internal(znode_t *dzp, const char *name, vnode_t **vpp, struct componentname *cnp, int nameiop) { zfsvfs_t *zfsvfs = dzp->z_zfsvfs; int error; - cnp->cn_nameptr = name; + cnp->cn_nameptr = __DECONST(char *, name); cnp->cn_namelen = strlen(name); cnp->cn_nameiop = nameiop; cnp->cn_flags = ISLASTCN | SAVENAME; @@ -2096,7 +2090,7 @@ zfs_lookup_internal(znode_t *dzp, char *name, vnode_t **vpp, } int -zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags) +zfs_remove(znode_t *dzp, const char *name, cred_t *cr, int flags) { vnode_t *vp; int error; @@ -2131,8 +2125,8 @@ zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags) */ /*ARGSUSED*/ int -zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap, znode_t **zpp, cred_t *cr, - int flags, vsecattr_t *vsecp) +zfs_mkdir(znode_t *dzp, const char *dirname, vattr_t *vap, znode_t **zpp, + cred_t *cr, int flags, vsecattr_t *vsecp) { znode_t *zp; zfsvfs_t *zfsvfs = dzp->z_zfsvfs; @@ -2298,7 +2292,7 @@ zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap, znode_t **zpp, cred_t *cr, */ /*ARGSUSED*/ static int -zfs_rmdir_(vnode_t *dvp, vnode_t *vp, char *name, cred_t *cr) +zfs_rmdir_(vnode_t *dvp, vnode_t *vp, const char *name, cred_t *cr) { znode_t *dzp = VTOZ(dvp); znode_t *zp = VTOZ(vp); @@ -2360,7 +2354,7 @@ out: } int -zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd, cred_t *cr, int flags) +zfs_rmdir(znode_t *dzp, const char *name, znode_t *cwd, cred_t *cr, int flags) { struct componentname cn; vnode_t *vp; @@ -3907,6 +3901,19 @@ zfs_rename_check(znode_t *szp, znode_t *sdzp, znode_t *tdzp) return (error); } +#if __FreeBSD_version < 1300110 +static void +cache_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, + struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp) +{ + + cache_purge(fvp); + if (tvp != NULL) + cache_purge(tvp); + cache_purge_negative(tdvp); +} +#endif + /* * Move an entry from the provided source directory to the target * directory. Change the entry name as indicated. @@ -3934,8 +3941,8 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp, znode_t *sdzp, *tdzp, *szp, *tzp; zilog_t *zilog = NULL; dmu_tx_t *tx; - char *snm = scnp->cn_nameptr; - char *tnm = tcnp->cn_nameptr; + const char *snm = scnp->cn_nameptr; + const char *tnm = tcnp->cn_nameptr; int error = 0; bool want_seqc_end __maybe_unused = false; @@ -4165,10 +4172,7 @@ zfs_rename_(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp, } } if (error == 0) { - cache_purge(*svpp); - if (*tvpp != NULL) - cache_purge(*tvpp); - cache_purge_negative(tdvp); + cache_rename(sdvp, *svpp, tdvp, *tvpp, scnp, tcnp); } } @@ -4201,7 +4205,7 @@ out: /* original two vnodes are locked */ } int -zfs_rename(znode_t *sdzp, char *sname, znode_t *tdzp, char *tname, +zfs_rename(znode_t *sdzp, const char *sname, znode_t *tdzp, const char *tname, cred_t *cr, int flags) { struct componentname scn, tcn; @@ -4360,8 +4364,7 @@ zfs_symlink(znode_t *dzp, const char *name, vattr_t *vap, */ (void) zfs_link_create(dzp, name, zp, tx, ZNEW); - zfs_log_symlink(zilog, tx, txtype, dzp, zp, - __DECONST(char *, name), __DECONST(char *, link)); + zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link); *zpp = zp; zfs_acl_ids_free(&acl_ids); @@ -4432,7 +4435,7 @@ zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr, caller_context_t *ct) */ /* ARGSUSED */ int -zfs_link(znode_t *tdzp, znode_t *szp, char *name, cred_t *cr, +zfs_link(znode_t *tdzp, znode_t *szp, const char *name, cred_t *cr, int flags) { znode_t *tzp; @@ -4741,6 +4744,8 @@ static int zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, caller_context_t *ct) { + znode_t *zp; + zfsvfs_t *zfsvfs; switch (cmd) { case _PC_LINK_MAX: @@ -4754,11 +4759,25 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr, *valp = (int)SPA_MINBLOCKSIZE; return (0); case _PC_ACL_EXTENDED: +#if 0 /* POSIX ACLs are not implemented for ZFS on FreeBSD yet. */ + zp = VTOZ(vp); + zfsvfs = zp->z_zfsvfs; + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + *valp = zfsvfs->z_acl_type == ZFSACLTYPE_POSIX ? 1 : 0; + ZFS_EXIT(zfsvfs); +#else *valp = 0; +#endif return (0); case _PC_ACL_NFS4: - *valp = 1; + zp = VTOZ(vp); + zfsvfs = zp->z_zfsvfs; + ZFS_ENTER(zfsvfs); + ZFS_VERIFY_ZP(zp); + *valp = zfsvfs->z_acl_type == ZFS_ACLTYPE_NFSV4 ? 1 : 0; + ZFS_EXIT(zfsvfs); return (0); case _PC_ACL_PATH_MAX: @@ -6622,6 +6641,9 @@ VFS_VOP_VECTOR_REGISTER(zfs_fifoops); */ struct vop_vector zfs_shareops = { .vop_default = &default_vnodeops, +#if __FreeBSD_version >= 1300121 + .vop_fplookup_vexec = VOP_EAGAIN, +#endif .vop_access = zfs_freebsd_access, .vop_inactive = zfs_freebsd_inactive, .vop_reclaim = zfs_freebsd_reclaim, diff --git a/module/os/linux/spl/README.md b/module/os/linux/spl/README.md index 51166425f063..906530bcf2ad 100644 --- a/module/os/linux/spl/README.md +++ b/module/os/linux/spl/README.md @@ -1,5 +1,5 @@ The Solaris Porting Layer, SPL, is a Linux kernel module which provides a -compatibility layer used by the [ZFS on Linux](https://zfsonlinux.org) project. +compatibility layer used by the [OpenZFS](https://github.com/openzfs/zfs) project. # Installation diff --git a/module/os/linux/spl/spl-atomic.c b/module/os/linux/spl/spl-atomic.c index 47ed1886e157..accf656fbcc6 100644 --- a/module/os/linux/spl/spl-atomic.c +++ b/module/os/linux/spl/spl-atomic.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-condvar.c b/module/os/linux/spl/spl-condvar.c index 49f48664503a..d0461a9f1298 100644 --- a/module/os/linux/spl/spl-condvar.c +++ b/module/os/linux/spl/spl-condvar.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-cred.c b/module/os/linux/spl/spl-cred.c index 6e93a32e60d7..8fe1cc30ba99 100644 --- a/module/os/linux/spl/spl-cred.c +++ b/module/os/linux/spl/spl-cred.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-err.c b/module/os/linux/spl/spl-err.c index 3c0bb71c0629..10b768d57360 100644 --- a/module/os/linux/spl/spl-err.c +++ b/module/os/linux/spl/spl-err.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c index 820fb86c3c7d..1da7618185ec 100644 --- a/module/os/linux/spl/spl-generic.c +++ b/module/os/linux/spl/spl-generic.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c index 15dc27624c55..6b3d559ffc1c 100644 --- a/module/os/linux/spl/spl-kmem-cache.c +++ b/module/os/linux/spl/spl-kmem-cache.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-kmem.c b/module/os/linux/spl/spl-kmem.c index f19421cfcc03..943966cbb17a 100644 --- a/module/os/linux/spl/spl-kmem.c +++ b/module/os/linux/spl/spl-kmem.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -217,7 +216,7 @@ spl_kmem_alloc_impl(size_t size, int flags, int node) !(flags & KM_VMEM)) { printk(KERN_WARNING "Large kmem_alloc(%lu, 0x%x), please file an issue at:\n" - "https://github.com/zfsonlinux/zfs/issues/new\n", + "https://github.com/openzfs/zfs/issues/new\n", (unsigned long)size, flags); dump_stack(); } diff --git a/module/os/linux/spl/spl-kstat.c b/module/os/linux/spl/spl-kstat.c index b9eeb332ee57..dbbf72c8569d 100644 --- a/module/os/linux/spl/spl-kstat.c +++ b/module/os/linux/spl/spl-kstat.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-proc.c b/module/os/linux/spl/spl-proc.c index 6936db5d6466..3e58598d43f8 100644 --- a/module/os/linux/spl/spl-proc.c +++ b/module/os/linux/spl/spl-proc.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-taskq.c b/module/os/linux/spl/spl-taskq.c index 9cbf3e38137c..fafadffc751c 100644 --- a/module/os/linux/spl/spl-taskq.c +++ b/module/os/linux/spl/spl-taskq.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-thread.c b/module/os/linux/spl/spl-thread.c index 0352a31ea835..db23fb64a298 100644 --- a/module/os/linux/spl/spl-thread.c +++ b/module/os/linux/spl/spl-thread.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-tsd.c b/module/os/linux/spl/spl-tsd.c index b955ed65470f..546db9ab8bd7 100644 --- a/module/os/linux/spl/spl-tsd.c +++ b/module/os/linux/spl/spl-tsd.c @@ -5,7 +5,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-vmem.c b/module/os/linux/spl/spl-vmem.c index 32372e6f2b60..cab3e9549cfe 100644 --- a/module/os/linux/spl/spl-vmem.c +++ b/module/os/linux/spl/spl-vmem.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-xdr.c b/module/os/linux/spl/spl-xdr.c index 1dd31ffc1483..5e763c25606f 100644 --- a/module/os/linux/spl/spl-xdr.c +++ b/module/os/linux/spl/spl-xdr.c @@ -3,7 +3,6 @@ * Written by Ricardo Correia <Ricardo.M.Correia@Sun.COM> * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/spl/spl-zlib.c b/module/os/linux/spl/spl-zlib.c index db05e28925b5..589496da0c78 100644 --- a/module/os/linux/spl/spl-zlib.c +++ b/module/os/linux/spl/spl-zlib.c @@ -6,7 +6,6 @@ * UCRL-CODE-235197 * * This file is part of the SPL, Solaris Porting Layer. - * For details, see <http://zfsonlinux.org/>. * * The SPL is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/module/os/linux/zfs/zfs_acl.c b/module/os/linux/zfs/zfs_acl.c index 11b5559321ad..2628325c0ba9 100644 --- a/module/os/linux/zfs/zfs_acl.c +++ b/module/os/linux/zfs/zfs_acl.c @@ -2666,7 +2666,7 @@ zfs_zaccess(znode_t *zp, int mode, int flags, boolean_t skipaclchk, cred_t *cr) /* * Translate traditional unix S_IRUSR/S_IWUSR/S_IXUSR mode into - * native ACL format and call zfs_zaccess() + * NFSv4-style ZFS ACL format and call zfs_zaccess() */ int zfs_zaccess_rwx(znode_t *zp, mode_t mode, int flags, cred_t *cr) diff --git a/module/os/linux/zfs/zfs_ctldir.c b/module/os/linux/zfs/zfs_ctldir.c index 26e785a0d422..c13a9771235d 100644 --- a/module/os/linux/zfs/zfs_ctldir.c +++ b/module/os/linux/zfs/zfs_ctldir.c @@ -131,7 +131,7 @@ static void zfsctl_snapshot_unmount_delay_impl(zfs_snapentry_t *se, int delay); * the snapshot name and provided mount point. No reference is taken. */ static zfs_snapentry_t * -zfsctl_snapshot_alloc(char *full_name, char *full_path, spa_t *spa, +zfsctl_snapshot_alloc(const char *full_name, const char *full_path, spa_t *spa, uint64_t objsetid, struct dentry *root_dentry) { zfs_snapentry_t *se; @@ -261,13 +261,13 @@ snapentry_compare_by_objsetid(const void *a, const void *b) * NULL will be returned. */ static zfs_snapentry_t * -zfsctl_snapshot_find_by_name(char *snapname) +zfsctl_snapshot_find_by_name(const char *snapname) { zfs_snapentry_t *se, search; ASSERT(RW_LOCK_HELD(&zfs_snapshot_lock)); - search.se_name = snapname; + search.se_name = (char *)snapname; se = avl_find(&zfs_snapshots_by_name, &search, NULL); if (se) zfsctl_snapshot_hold(se); @@ -301,7 +301,7 @@ zfsctl_snapshot_find_by_objsetid(spa_t *spa, uint64_t objsetid) * removed, renamed, and added back to the new correct location in the tree. */ static int -zfsctl_snapshot_rename(char *old_snapname, char *new_snapname) +zfsctl_snapshot_rename(const char *old_snapname, const char *new_snapname) { zfs_snapentry_t *se; @@ -410,7 +410,7 @@ zfsctl_snapshot_unmount_delay(spa_t *spa, uint64_t objsetid, int delay) * and zero when unmounted. */ static boolean_t -zfsctl_snapshot_ismounted(char *snapname) +zfsctl_snapshot_ismounted(const char *snapname) { zfs_snapentry_t *se; boolean_t ismounted = B_FALSE; @@ -751,7 +751,7 @@ out: * Special case the handling of "..". */ int -zfsctl_root_lookup(struct inode *dip, char *name, struct inode **ipp, +zfsctl_root_lookup(struct inode *dip, const char *name, struct inode **ipp, int flags, cred_t *cr, int *direntflags, pathname_t *realpnp) { zfsvfs_t *zfsvfs = ITOZSB(dip); @@ -784,7 +784,7 @@ zfsctl_root_lookup(struct inode *dip, char *name, struct inode **ipp, * snapshot if it exist, creating the pseudo filesystem inode as necessary. */ int -zfsctl_snapdir_lookup(struct inode *dip, char *name, struct inode **ipp, +zfsctl_snapdir_lookup(struct inode *dip, const char *name, struct inode **ipp, int flags, cred_t *cr, int *direntflags, pathname_t *realpnp) { zfsvfs_t *zfsvfs = ITOZSB(dip); @@ -815,8 +815,8 @@ zfsctl_snapdir_lookup(struct inode *dip, char *name, struct inode **ipp, * to the '.zfs/snapshot' directory snapshots cannot be moved elsewhere. */ int -zfsctl_snapdir_rename(struct inode *sdip, char *snm, - struct inode *tdip, char *tnm, cred_t *cr, int flags) +zfsctl_snapdir_rename(struct inode *sdip, const char *snm, + struct inode *tdip, const char *tnm, cred_t *cr, int flags) { zfsvfs_t *zfsvfs = ITOZSB(sdip); char *to, *from, *real, *fsname; @@ -893,7 +893,8 @@ out: * the removal of the snapshot with the given name. */ int -zfsctl_snapdir_remove(struct inode *dip, char *name, cred_t *cr, int flags) +zfsctl_snapdir_remove(struct inode *dip, const char *name, cred_t *cr, + int flags) { zfsvfs_t *zfsvfs = ITOZSB(dip); char *snapname, *real; @@ -941,7 +942,7 @@ out: * the creation of a new snapshot with the given name. */ int -zfsctl_snapdir_mkdir(struct inode *dip, char *dirname, vattr_t *vap, +zfsctl_snapdir_mkdir(struct inode *dip, const char *dirname, vattr_t *vap, struct inode **ipp, cred_t *cr, int flags) { zfsvfs_t *zfsvfs = ITOZSB(dip); @@ -1001,7 +1002,7 @@ exportfs_flush(void) * it's in use, the unmount will fail harmlessly. */ int -zfsctl_snapshot_unmount(char *snapname, int flags) +zfsctl_snapshot_unmount(const char *snapname, int flags) { char *argv[] = { "/usr/bin/env", "umount", "-t", "zfs", "-n", NULL, NULL }; diff --git a/module/os/linux/zfs/zfs_dir.c b/module/os/linux/zfs/zfs_dir.c index 383657208df3..207a51d75bc9 100644 --- a/module/os/linux/zfs/zfs_dir.c +++ b/module/os/linux/zfs/zfs_dir.c @@ -60,8 +60,9 @@ * of names after deciding which is the appropriate lookup interface. */ static int -zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, char *name, matchtype_t mt, - boolean_t update, int *deflags, pathname_t *rpnp, uint64_t *zoid) +zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, const char *name, + matchtype_t mt, boolean_t update, int *deflags, pathname_t *rpnp, + uint64_t *zoid) { boolean_t conflict = B_FALSE; int error; @@ -139,8 +140,8 @@ zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, char *name, matchtype_t mt, * but return znode pointers to a single match. */ int -zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp, - int flag, int *direntflags, pathname_t *realpnp) +zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, + znode_t **zpp, int flag, int *direntflags, pathname_t *realpnp) { zfsvfs_t *zfsvfs = ZTOZSB(dzp); zfs_dirlock_t *dl; diff --git a/module/os/linux/zfs/zfs_vfsops.c b/module/os/linux/zfs/zfs_vfsops.c index 15ec7b91b001..b218237d07ff 100644 --- a/module/os/linux/zfs/zfs_vfsops.c +++ b/module/os/linux/zfs/zfs_vfsops.c @@ -352,6 +352,7 @@ acltype_changed_cb(void *arg, uint64_t newval) zfsvfs_t *zfsvfs = arg; switch (newval) { + case ZFS_ACLTYPE_NFSV4: case ZFS_ACLTYPE_OFF: zfsvfs->z_acl_type = ZFS_ACLTYPE_OFF; zfsvfs->z_sb->s_flags &= ~SB_POSIXACL; diff --git a/module/os/linux/zfs/zfs_vnops.c b/module/os/linux/zfs/zfs_vnops.c index 2d104a5001ec..b668c7dff013 100644 --- a/module/os/linux/zfs/zfs_vnops.c +++ b/module/os/linux/zfs/zfs_vnops.c @@ -1234,8 +1234,8 @@ zfs_access(struct inode *ip, int mode, int flag, cred_t *cr) */ /* ARGSUSED */ int -zfs_lookup(znode_t *zdp, char *nm, znode_t **zpp, int flags, - cred_t *cr, int *direntflags, pathname_t *realpnp) +zfs_lookup(znode_t *zdp, char *nm, znode_t **zpp, int flags, cred_t *cr, + int *direntflags, pathname_t *realpnp) { zfsvfs_t *zfsvfs = ZTOZSB(zdp); int error = 0; @@ -2543,7 +2543,7 @@ zfs_setattr_dir(znode_t *dzp) zap_cursor_t zc; zap_attribute_t zap; zfs_dirlock_t *dl; - znode_t *zp; + znode_t *zp = NULL; dmu_tx_t *tx = NULL; uint64_t uid, gid; sa_bulk_attr_t bulk[4]; |