aboutsummaryrefslogtreecommitdiffstats
path: root/module/os
diff options
context:
space:
mode:
authorMateusz Guzik <[email protected]>2022-09-21 00:21:30 +0200
committerGitHub <[email protected]>2022-09-20 15:21:30 -0700
commit3e5caef4c5b0cca3a892b92217955178ae8652bc (patch)
treea2703e09df699b9825b0950b5dc8fa26f261fdbf /module/os
parent7c6d94728c9f5deef7e7cc0bf4320385345de5bd (diff)
FreeBSD: catch up to 1400068
Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Mateusz Guzik <[email protected]> Closes #13909
Diffstat (limited to 'module/os')
-rw-r--r--module/os/freebsd/zfs/zfs_vnops_os.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/module/os/freebsd/zfs/zfs_vnops_os.c b/module/os/freebsd/zfs/zfs_vnops_os.c
index e2222df12..fae390a14 100644
--- a/module/os/freebsd/zfs/zfs_vnops_os.c
+++ b/module/os/freebsd/zfs/zfs_vnops_os.c
@@ -970,13 +970,17 @@ zfs_lookup(vnode_t *dvp, const char *nm, vnode_t **vpp,
case RENAME:
if (error == ENOENT) {
error = EJUSTRETURN;
+#if __FreeBSD_version < 1400068
cnp->cn_flags |= SAVENAME;
+#endif
break;
}
zfs_fallthrough;
case DELETE:
+#if __FreeBSD_version < 1400068
if (error == 0)
cnp->cn_flags |= SAVENAME;
+#endif
break;
}
}
@@ -1326,7 +1330,10 @@ zfs_lookup_internal(znode_t *dzp, const char *name, vnode_t **vpp,
cnp->cn_nameptr = __DECONST(char *, name);
cnp->cn_namelen = strlen(name);
cnp->cn_nameiop = nameiop;
- cnp->cn_flags = ISLASTCN | SAVENAME;
+ cnp->cn_flags = ISLASTCN;
+#if __FreeBSD_version < 1400068
+ cnp->cn_flags |= SAVENAME;
+#endif
cnp->cn_lkflags = LK_EXCLUSIVE | LK_RETRY;
cnp->cn_cred = kcred;
#if __FreeBSD_version < 1400037
@@ -4590,7 +4597,9 @@ zfs_freebsd_create(struct vop_create_args *ap)
znode_t *zp = NULL;
int rc, mode;
+#if __FreeBSD_version < 1400068
ASSERT(cnp->cn_flags & SAVENAME);
+#endif
vattr_init_mask(vap);
mode = vap->va_mode & ALLPERMS;
@@ -4620,7 +4629,9 @@ static int
zfs_freebsd_remove(struct vop_remove_args *ap)
{
+#if __FreeBSD_version < 1400068
ASSERT(ap->a_cnp->cn_flags & SAVENAME);
+#endif
return (zfs_remove_(ap->a_dvp, ap->a_vp, ap->a_cnp->cn_nameptr,
ap->a_cnp->cn_cred));
@@ -4642,7 +4653,9 @@ zfs_freebsd_mkdir(struct vop_mkdir_args *ap)
znode_t *zp = NULL;
int rc;
+#if __FreeBSD_version < 1400068
ASSERT(ap->a_cnp->cn_flags & SAVENAME);
+#endif
vattr_init_mask(vap);
*ap->a_vpp = NULL;
@@ -4668,7 +4681,9 @@ zfs_freebsd_rmdir(struct vop_rmdir_args *ap)
{
struct componentname *cnp = ap->a_cnp;
+#if __FreeBSD_version < 1400068
ASSERT(cnp->cn_flags & SAVENAME);
+#endif
return (zfs_rmdir_(ap->a_dvp, ap->a_vp, cnp->cn_nameptr, cnp->cn_cred));
}
@@ -4922,8 +4937,10 @@ zfs_freebsd_rename(struct vop_rename_args *ap)
vnode_t *tvp = ap->a_tvp;
int error;
+#if __FreeBSD_version < 1400068
ASSERT(ap->a_fcnp->cn_flags & (SAVENAME|SAVESTART));
ASSERT(ap->a_tcnp->cn_flags & (SAVENAME|SAVESTART));
+#endif
error = zfs_do_rename(fdvp, &fvp, ap->a_fcnp, tdvp, &tvp,
ap->a_tcnp, ap->a_fcnp->cn_cred);
@@ -4959,7 +4976,9 @@ zfs_freebsd_symlink(struct vop_symlink_args *ap)
#endif
int rc;
+#if __FreeBSD_version < 1400068
ASSERT(cnp->cn_flags & SAVENAME);
+#endif
vap->va_type = VLNK; /* FreeBSD: Syscall only sets va_mode. */
vattr_init_mask(vap);
@@ -5053,7 +5072,9 @@ zfs_freebsd_link(struct vop_link_args *ap)
if (tdvp->v_mount != vp->v_mount)
return (EXDEV);
+#if __FreeBSD_version < 1400068
ASSERT(cnp->cn_flags & SAVENAME);
+#endif
return (zfs_link(VTOZ(tdvp), VTOZ(vp),
cnp->cn_nameptr, cnp->cn_cred, 0));
@@ -5325,10 +5346,10 @@ zfs_getextattr_dir(struct vop_getextattr_args *ap, const char *attrname)
NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp);
#endif
error = vn_open_cred(&nd, &flags, 0, VN_OPEN_INVFS, ap->a_cred, NULL);
- vp = nd.ni_vp;
- NDFREE_PNBUF(&nd);
if (error != 0)
return (SET_ERROR(error));
+ vp = nd.ni_vp;
+ NDFREE_PNBUF(&nd);
if (ap->a_size != NULL) {
error = VOP_GETATTR(vp, &va, ap->a_cred);
@@ -5470,12 +5491,10 @@ zfs_deleteextattr_dir(struct vop_deleteextattr_args *ap, const char *attrname)
UIO_SYSSPACE, attrname, xvp);
#endif
error = namei(&nd);
- vp = nd.ni_vp;
- if (error != 0) {
- NDFREE_PNBUF(&nd);
+ if (error != 0)
return (SET_ERROR(error));
- }
+ vp = nd.ni_vp;
error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd);
NDFREE_PNBUF(&nd);
@@ -5615,10 +5634,10 @@ zfs_setextattr_dir(struct vop_setextattr_args *ap, const char *attrname)
#endif
error = vn_open_cred(&nd, &flags, 0600, VN_OPEN_INVFS, ap->a_cred,
NULL);
- vp = nd.ni_vp;
- NDFREE_PNBUF(&nd);
if (error != 0)
return (SET_ERROR(error));
+ vp = nd.ni_vp;
+ NDFREE_PNBUF(&nd);
VATTR_NULL(&va);
va.va_size = 0;
@@ -5802,10 +5821,10 @@ zfs_listextattr_dir(struct vop_listextattr_args *ap, const char *attrprefix)
UIO_SYSSPACE, ".", xvp);
#endif
error = namei(&nd);
- vp = nd.ni_vp;
- NDFREE_PNBUF(&nd);
if (error != 0)
return (SET_ERROR(error));
+ vp = nd.ni_vp;
+ NDFREE_PNBUF(&nd);
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;