aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2021-05-06 12:45:16 -0400
committerTony Hutter <[email protected]>2021-06-23 13:22:15 -0700
commitfd8ccce07b56272134306d505748295c95964721 (patch)
treed0f0059b78d0ea97cf75ef4673ac08b89ddd4f10
parentc2a3bcc91d780aad197f9e1dfb8cf76cad7cf949 (diff)
FreeBSD: Initialize/destroy zp->z_lock
zp->z_lock is used in shared code for protecting projid and scantime. We don't exercise these paths much if at all on FreeBSD, so have been lucky enough not to have issues with the uninitialized locks so far. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #12003
-rw-r--r--module/os/freebsd/zfs/zfs_znode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/module/os/freebsd/zfs/zfs_znode.c b/module/os/freebsd/zfs/zfs_znode.c
index 6a21623c5..50d63b9c0 100644
--- a/module/os/freebsd/zfs/zfs_znode.c
+++ b/module/os/freebsd/zfs/zfs_znode.c
@@ -143,6 +143,7 @@ zfs_znode_cache_constructor(void *buf, void *arg, int kmflags)
list_link_init(&zp->z_link_node);
+ mutex_init(&zp->z_lock, NULL, MUTEX_DEFAULT, NULL);
mutex_init(&zp->z_acl_lock, NULL, MUTEX_DEFAULT, NULL);
zfs_rangelock_init(&zp->z_rangelock, zfs_rangelock_cb, zp);
@@ -161,6 +162,7 @@ zfs_znode_cache_destructor(void *buf, void *arg)
ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs));
ASSERT3P(zp->z_vnode, ==, NULL);
ASSERT(!list_link_active(&zp->z_link_node));
+ mutex_destroy(&zp->z_lock);
mutex_destroy(&zp->z_acl_lock);
zfs_rangelock_fini(&zp->z_rangelock);