From 7df5c003ed6eb17a693d67ffdfc0556f0c569cc1 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Sun, 12 Apr 2020 22:40:14 -0500 Subject: [PATCH] FBSD: Remove unused 'wantparent' logic In afs_vop_lookup, the 'wantparent' variable doesn't actually change any logic in the function. In the if() clause that it's used, the value of 'wantparent' is only ever used if cnp->cn_nameiop is RENAME and ISLASTCN is set. But if both of those are true, then the second half of the if() conditional will always be true, so the value of 'wantparent' doesn't matter. So to remove this confusing unused logic, remove the 'wantparent' local var, and all its associated logic. Issue spotted by kaduk@mit.edu. Change-Id: Ia63b88d67d21cc2b81a0c25aa31ea60ab202b0a7 Reviewed-on: https://gerrit.openafs.org/14143 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- src/afs/FBSD/osi_vnodeops.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c index dc901c58c7..d68e804c17 100644 --- a/src/afs/FBSD/osi_vnodeops.c +++ b/src/afs/FBSD/osi_vnodeops.c @@ -203,7 +203,6 @@ afs_vop_lookup(ap) struct vnode *vp, *dvp; int flags = ap->a_cnp->cn_flags; int lockparent; /* 1 => lockparent flag is set */ - int wantparent; /* 1 => wantparent or lockparent flag */ dvp = ap->a_dvp; if (dvp->v_type != VDIR) { @@ -216,7 +215,6 @@ afs_vop_lookup(ap) GETNAME(); lockparent = flags & LOCKPARENT; - wantparent = flags & (LOCKPARENT | WANTPARENT); #if __FreeBSD_version < 1000021 cnp->cn_flags |= MPSAFE; /* steel */ @@ -267,8 +265,7 @@ afs_vop_lookup(ap) } *ap->a_vpp = vp; - if ((cnp->cn_nameiop == RENAME && wantparent && (flags & ISLASTCN)) - || (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))) + if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; DROPNAME();