git: 0724cf3862e6 - main - vfs: whack dpunlocked var in vfs_lookup

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Wed, 05 Jul 2023 21:55:46 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=0724cf3862e6fa607efdb18df85d9ef58bfb7464

commit 0724cf3862e6fa607efdb18df85d9ef58bfb7464
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-07-05 21:52:07 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-07-05 21:55:24 +0000

    vfs: whack dpunlocked var in vfs_lookup
    
    It is redundant given the bad_unlocked goto label.
---
 sys/kern/vfs_lookup.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 44fc91c1bd11..588ef88d24df 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -926,7 +926,6 @@ vfs_lookup(struct nameidata *ndp)
 	int wantparent;			/* 1 => wantparent or lockparent flag */
 	int rdonly;			/* lookup read-only flag bit */
 	int error = 0;
-	int dpunlocked = 0;		/* dp has already been unlocked */
 	int relookup = 0;		/* do not consume the path component */
 	struct componentname *cnp = &ndp->ni_cnd;
 	int lkflags_save;
@@ -1342,10 +1341,8 @@ good:
 			vput(dp);
 		if (vn_lock(vp_crossmp, LK_SHARED | LK_NOWAIT))
 			panic("vp_crossmp exclusively locked or reclaimed");
-		if (error != 0) {
-			dpunlocked = 1;
-			goto bad2;
-		}
+		if (error != 0)
+			goto bad_unlocked;
 		ndp->ni_vp = dp = tdp;
 	} while ((vn_irflag_read(dp) & VIRF_MOUNTPOINT) != 0);
 
@@ -1457,8 +1454,7 @@ bad2:
 			vrele(ndp->ni_dvp);
 	}
 bad:
-	if (!dpunlocked)
-		vput(dp);
+	vput(dp);
 bad_unlocked:
 	ndp->ni_vp = NULL;
 	return (error);