From 381048869ce2d7037d1ee78a4220869eb299cfbd Mon Sep 17 00:00:00 2001 From: hannken Date: Thu, 27 Aug 2020 09:57:33 +0000 Subject: [PATCH] Enable NCLOOKUP for ZFS. --- .../cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c | 4 ++-- .../cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c | 11 +++++++++-- .../cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c index 76f8c7a57b4d..907ce273ffb4 100644 --- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c +++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c @@ -1517,7 +1517,7 @@ zfs_domount(vfs_t *vfsp, char *osname) #endif #ifdef __NetBSD__ vfsp->mnt_flag |= MNT_LOCAL; - vfsp->mnt_iflag |= IMNT_MPSAFE; + vfsp->mnt_iflag |= IMNT_MPSAFE | IMNT_NCLOOKUP; #endif /* @@ -2078,7 +2078,7 @@ zfs_mount(vfs_t *vfsp, const char *path, void *data, size_t *data_len) vfsp->vfs_flag |= MNT_NFS4ACLS; #endif #ifdef __NetBSD__ - vfsp->mnt_iflag |= IMNT_MPSAFE; + vfsp->mnt_iflag |= IMNT_MPSAFE | IMNT_NCLOOKUP; #endif /* diff --git a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c index ae095faf3ac8..d988eafdbbb0 100644 --- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c +++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c @@ -1354,6 +1354,10 @@ zfs_write(vnode_t *vp, uio_t *uio, int ioflag, cred_t *cr, caller_context_t *ct) newmode = zp->z_mode; (void) sa_update(zp->z_sa_hdl, SA_ZPL_MODE(zfsvfs), (void *)&newmode, sizeof (uint64_t), tx); +#ifdef __NetBSD__ + cache_enter_id(vp, zp->z_mode, zp->z_uid, zp->z_gid, + true); +#endif } mutex_exit(&zp->z_acl_lock); @@ -5645,8 +5649,11 @@ zfs_netbsd_setattr(void *v) } error = zfs_setattr(vp, (vattr_t *)&xvap, flags, cred, NULL); - if (error == 0) - VN_KNOTE(vp, NOTE_ATTRIB); + if (error) + return error; + + VN_KNOTE(vp, NOTE_ATTRIB); + cache_enter_id(vp, zp->z_mode, zp->z_uid, zp->z_gid, true); return error; } diff --git a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c index 7e99a889ec1c..4d3ab49393d7 100644 --- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c +++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c @@ -871,6 +871,7 @@ zfs_loadvnode(struct mount *mp, struct vnode *vp, return (SET_ERROR(ENOENT)); } ASSERT(zp == VTOZ(vp)); + cache_enter_id(vp, zp->z_mode, zp->z_uid, zp->z_gid, true); ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); @@ -891,6 +892,8 @@ zfs_newvnode(struct mount *mp, vnode_t *dvp, vnode_t *vp, vattr_t *vap, zfs_mknode1(dzp, vap, tx, cr, flag, &zp, acl_ids, vp); ASSERT(zp == VTOZ(vp)); + cache_enter_id(vp, zp->z_mode, zp->z_uid, zp->z_gid, true); + *key_len = sizeof(zp->z_id); *new_key = &zp->z_id;