git: 8d97282a3942 - main - fdesc_lookup(): no need to vhold the dvp vnode

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 24 Mar 2023 17:47:42 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=8d97282a394278d29883e7afa98ed6294efab35e

commit 8d97282a394278d29883e7afa98ed6294efab35e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-03-22 13:36:00 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-03-24 17:47:07 +0000

    fdesc_lookup(): no need to vhold the dvp vnode
    
    It is already referenced by the VOP_LOOKUP() caller, otherwise vdrop()
    after vn_lock() is invalid anyway.
    
    Reviewed by:    markj
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D39207
---
 sys/fs/fdescfs/fdesc_vnops.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
index afefaff8acf4..beef9295f11b 100644
--- a/sys/fs/fdescfs/fdesc_vnops.c
+++ b/sys/fs/fdescfs/fdesc_vnops.c
@@ -363,13 +363,11 @@ fdesc_lookup(struct vop_lookup_args *ap)
 		 * In case we're holding the last reference to the file, the dvp
 		 * will be re-acquired.
 		 */
-		vhold(dvp);
 		VOP_UNLOCK(dvp);
 		fdrop(fp, td);
 		fdropped = true;
 
 		vn_lock(dvp, LK_RETRY | LK_EXCLUSIVE);
-		vdrop(dvp);
 		fvp = dvp;
 		if (error == 0 && VN_IS_DOOMED(dvp))
 			error = ENOENT;