aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2021-01-23 13:46:32 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2021-01-23 15:04:43 +0000
commit3110d4ebd6c0848cf5e25890d01791bb407e2a9b (patch)
treea15d51b7109af15d5dfe0620b2baa7daba12c289 /sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c
parent618029af508be2c01a84162c1bad02bfd000db27 (diff)
downloadsrc-3110d4ebd6c0848cf5e25890d01791bb407e2a9b.tar.gz
src-3110d4ebd6c0848cf5e25890d01791bb407e2a9b.zip
zfs: add support for lockless symlink lookup
Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D27488
Diffstat (limited to 'sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c')
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c
index 6a21623c5f67..f9a0820eda2d 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c
@@ -444,6 +444,7 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
zp->z_blksz = blksz;
zp->z_seq = 0x7A4653;
zp->z_sync_cnt = 0;
+ atomic_store_ptr((uintptr_t *)&zp->z_cached_symlink, (uintptr_t)NULL);
vp = ZTOV(zp);
@@ -1237,6 +1238,7 @@ void
zfs_znode_free(znode_t *zp)
{
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
+ char *symlink;
ASSERT(zp->z_sa_hdl == NULL);
zp->z_vnode = NULL;
@@ -1245,6 +1247,11 @@ zfs_znode_free(znode_t *zp)
list_remove(&zfsvfs->z_all_znodes, zp);
zfsvfs->z_nr_znodes--;
mutex_exit(&zfsvfs->z_znodes_lock);
+ symlink = atomic_load_ptr(&zp->z_cached_symlink);
+ if (symlink != NULL) {
+ atomic_store_rel_ptr((uintptr_t *)&zp->z_cached_symlink, (uintptr_t)NULL);
+ cache_symlink_free(symlink, strlen(symlink) + 1);
+ }
if (zp->z_acl_cached) {
zfs_acl_free(zp->z_acl_cached);