Skip to content

Commit 591c1a7

Browse files
Ryan Moellerbehlendorf
authored andcommitted
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
1 parent 2ad4cb1 commit 591c1a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

module/os/freebsd/zfs/zfs_znode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ zfs_znode_cache_constructor(void *buf, void *arg, int kmflags)
143143

144144
list_link_init(&zp->z_link_node);
145145

146+
mutex_init(&zp->z_lock, NULL, MUTEX_DEFAULT, NULL);
146147
mutex_init(&zp->z_acl_lock, NULL, MUTEX_DEFAULT, NULL);
147148

148149
zfs_rangelock_init(&zp->z_rangelock, zfs_rangelock_cb, zp);
@@ -161,6 +162,7 @@ zfs_znode_cache_destructor(void *buf, void *arg)
161162
ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs));
162163
ASSERT3P(zp->z_vnode, ==, NULL);
163164
ASSERT(!list_link_active(&zp->z_link_node));
165+
mutex_destroy(&zp->z_lock);
164166
mutex_destroy(&zp->z_acl_lock);
165167
zfs_rangelock_fini(&zp->z_rangelock);
166168

0 commit comments

Comments
 (0)