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 <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #12003
This commit is contained in:
Ryan Moeller 2021-05-06 12:45:16 -04:00 committed by Brian Behlendorf
parent 1a0ce3d5ef
commit 85071b2ff5
1 changed files with 2 additions and 0 deletions

View File

@ -143,6 +143,7 @@ zfs_znode_cache_constructor(void *buf, void *arg, int kmflags)
list_link_init(&zp->z_link_node); 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); mutex_init(&zp->z_acl_lock, NULL, MUTEX_DEFAULT, NULL);
zfs_rangelock_init(&zp->z_rangelock, zfs_rangelock_cb, zp); 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)); ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs));
ASSERT3P(zp->z_vnode, ==, NULL); ASSERT3P(zp->z_vnode, ==, NULL);
ASSERT(!list_link_active(&zp->z_link_node)); ASSERT(!list_link_active(&zp->z_link_node));
mutex_destroy(&zp->z_lock);
mutex_destroy(&zp->z_acl_lock); mutex_destroy(&zp->z_acl_lock);
zfs_rangelock_fini(&zp->z_rangelock); zfs_rangelock_fini(&zp->z_rangelock);