Skip to content

Commit

Permalink
FreeBSD: Initialize/destroy zp->z_lock
Browse files Browse the repository at this point in the history
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 openzfs#12003
  • Loading branch information
Ryan Moeller authored and RageLtMan committed May 31, 2021
1 parent c461951 commit 7362048
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions module/os/freebsd/zfs/zfs_znode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_named(&zp->z_rangelock, zfs_rangelock_cb, zp,
Expand All @@ -162,6 +163,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);

Expand Down

0 comments on commit 7362048

Please sign in to comment.