]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix several bugs in the FreeBSD rename VOP implementation
authorMark Johnston <markjdb@gmail.com>
Fri, 19 Nov 2021 22:26:39 +0000 (17:26 -0500)
committerTony Hutter <hutter2@llnl.gov>
Mon, 13 Dec 2021 21:22:54 +0000 (13:22 -0800)
commit19337332cc89cb121ecae0218e80e0dc42440c02
treeb4115773012ae2d9b84ccdc49bfd41a1ad69e55c
parentb96737b83e040fc14a60dd264c72031ab5eb166f
Fix several bugs in the FreeBSD rename VOP implementation

- To avoid a use-after-free, zfsvfs->z_log needs to be loaded after the
  teardown lock is acquired with ZFS_ENTER().
- Avoid leaking vnode locks in zfs_rename_relock() and zfs_rename_()
  when the ZFS_ENTER() macros forces an early return.

Refactor the rename implementation so that ZFS_ENTER() can be used
safely.  As a bonus, this lets us use the ZFS_VERIFY_ZP() macro instead
of open-coding its implementation.

Reported-by: Peter Holm <pho@FreeBSD.org>
Tested-by: Peter Holm <pho@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Sponsored-by: The FreeBSD Foundation
Closes #12717
module/os/freebsd/zfs/zfs_vnops_os.c