HomeFreeBSD

[FreeBSD] zfs_znode_alloc: lock the vnode earlier

Description

[FreeBSD] zfs_znode_alloc: lock the vnode earlier

This is needed because of a possible error path where zfs_vnode_forget()
is called. That function calls vgone() and vput(), the former requires
the vnode to be exclusively locked and the latter expects it to be
locked.

It should be safe to lock the vnode as early as possible because it is
not yet visible, so there is no interaction with other locks.

While here, remove a tautological assignment to 'vp'.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Andriy Gapon <avg@FreeBSD.org>
Closes #14565

Details

Provenance
avgAuthored on Mar 7 2023, 12:30 AM
GitHub <noreply@github.com>Committed on Mar 7 2023, 12:30 AM
Parents
rGca9e32d3a7f4: Optimize the is_l2cacheable functions
Branches
Unknown
Tags
Unknown