git: 8f7859e800d9 - main - vfs: retire the now unused SAVESTART flag

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Mon, 19 Dec 2022 08:14:43 UTC
The branch main has been updated by mjg:

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

commit 8f7859e800d998e5518b4f0d6c9545106dc96f68
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-12-14 09:40:20 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-12-19 08:11:08 +0000

    vfs: retire the now unused SAVESTART flag
    
    Bump __FreeBSD_version to 1400075
    
    Tested by:      pho
---
 sys/fs/msdosfs/msdosfs_vnops.c |  3 +--
 sys/fs/smbfs/smbfs_vnops.c     |  3 +--
 sys/fs/unionfs/union_subr.c    |  5 ++---
 sys/kern/vfs_cache.c           | 20 ++------------------
 sys/kern/vfs_lookup.c          | 11 -----------
 sys/sys/namei.h                |  2 +-
 sys/sys/param.h                |  2 +-
 7 files changed, 8 insertions(+), 38 deletions(-)

diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 9084c1829acc..f095a4abea62 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -127,8 +127,7 @@ static vop_vptofh_t	msdosfs_vptofh;
 /*
  * Create a regular file. On entry the directory to contain the file being
  * created is locked.  We must release before we return. We must also free
- * the pathname buffer pointed at by cnp->cn_pnbuf, always on error, or
- * only if the SAVESTART bit in cn_flags is clear on success.
+ * the pathname buffer pointed at by cnp->cn_pnbuf, always on error.
  */
 static int
 msdosfs_create(struct vop_create_args *ap)
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c
index 044745111543..1b1bb35e9749 100644
--- a/sys/fs/smbfs/smbfs_vnops.c
+++ b/sys/fs/smbfs/smbfs_vnops.c
@@ -528,8 +528,7 @@ smbfs_write(ap)
  * smbfs_create call
  * Create a regular file. On entry the directory to contain the file being
  * created is locked.  We must release before we return. We must also free
- * the pathname buffer pointed at by cnp->cn_pnbuf, always on error, or
- * only if the SAVESTART bit in cn_flags is clear on success.
+ * the pathname buffer pointed at by cnp->cn_pnbuf, always on error.
  */
 static int
 smbfs_create(ap)
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c
index 29e18b355f68..b84da505507a 100644
--- a/sys/fs/unionfs/union_subr.c
+++ b/sys/fs/unionfs/union_subr.c
@@ -675,9 +675,8 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp,
 	refstart = false;
 	if (nameiop == DELETE) {
 		cn->cn_flags |= (cnp->cn_flags & DOWHITEOUT);
-		refstart = (cnp->cn_flags & SAVESTART) != 0;
-	} else if (RENAME == nameiop) {
-		refstart = (cnp->cn_flags & SAVESTART) != 0;
+	} else if (nameiop == RENAME) {
+		refstart = true;
 	} else if (nameiop == CREATE) {
 		cn->cn_flags |= NOCACHE;
 	}
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 08d7ab2895cd..d7b235c12f7b 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -4188,7 +4188,7 @@ cache_fpl_terminated(struct cache_fpl *fpl)
 
 #define CACHE_FPL_SUPPORTED_CN_FLAGS \
 	(NC_NOMAKEENTRY | NC_KEEPPOSENTRY | LOCKLEAF | LOCKPARENT | WANTPARENT | \
-	 FAILIFEXISTS | FOLLOW | EMPTYPATH | LOCKSHARED | SAVESTART | WILLBEDIR | \
+	 FAILIFEXISTS | FOLLOW | EMPTYPATH | LOCKSHARED | WILLBEDIR | \
 	 ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2 | NOCAPCHECK | OPENREAD | \
 	 OPENWRITE | WANTIOCTLCAPS)
 
@@ -4424,7 +4424,7 @@ cache_fplookup_final_child(struct cache_fpl *fpl, enum vgetstate tvs)
 static int __noinline
 cache_fplookup_final_modifying(struct cache_fpl *fpl)
 {
-	struct nameidata *ndp;
+	struct nameidata *ndp __diagused;
 	struct componentname *cnp;
 	enum vgetstate dvs;
 	struct vnode *dvp, *tvp;
@@ -4539,10 +4539,6 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl)
 	fpl->tvp = tvp;
 
 	if (tvp == NULL) {
-		if ((cnp->cn_flags & SAVESTART) != 0) {
-			ndp->ni_startdir = dvp;
-			vrefact(ndp->ni_startdir);
-		}
 		MPASS(error == EJUSTRETURN);
 		if ((cnp->cn_flags & LOCKPARENT) == 0) {
 			VOP_UNLOCK(dvp);
@@ -4599,11 +4595,6 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl)
 		VOP_UNLOCK(dvp);
 	}
 
-	if ((cnp->cn_flags & SAVESTART) != 0) {
-		ndp->ni_startdir = dvp;
-		vrefact(ndp->ni_startdir);
-	}
-
 	return (cache_fpl_handled(fpl));
 }
 
@@ -4758,8 +4749,6 @@ cache_fplookup_degenerate(struct cache_fpl *fpl)
 		return (cache_fpl_handled_error(fpl, EISDIR));
 	}
 
-	MPASS((cnp->cn_flags & SAVESTART) == 0);
-
 	if ((cnp->cn_flags & (LOCKPARENT|WANTPARENT)) != 0) {
 		return (cache_fplookup_final_withparent(fpl));
 	}
@@ -4880,8 +4869,6 @@ cache_fplookup_noentry(struct cache_fpl *fpl)
 		return (cache_fplookup_modifying(fpl));
 	}
 
-	MPASS((cnp->cn_flags & SAVESTART) == 0);
-
 	/*
 	 * Only try to fill in the component if it is the last one,
 	 * otherwise not only there may be several to handle but the
@@ -6060,9 +6047,6 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status,
 	KASSERT ((cnp->cn_flags & CACHE_FPL_INTERNAL_CN_FLAGS) == 0,
 	    ("%s: internal flags found in cn_flags %" PRIx64, __func__,
 	    cnp->cn_flags));
-	if ((cnp->cn_flags & SAVESTART) != 0) {
-		MPASS(cnp->cn_nameiop != LOOKUP);
-	}
 	MPASS(cnp->cn_nameptr == cnp->cn_pnbuf);
 
 	if (__predict_false(!cache_can_fplookup(&fpl))) {
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index a5f73676d308..d6e0c824a323 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -800,9 +800,6 @@ vfs_lookup_degenerate(struct nameidata *ndp, struct vnode *dp, int wantparent)
 
 	if (!(cnp->cn_flags & (LOCKPARENT | LOCKLEAF)))
 		VOP_UNLOCK(dp);
-	/* XXX This should probably move to the top of function. */
-	if (cnp->cn_flags & SAVESTART)
-		panic("lookup: SAVESTART");
 	return (0);
 bad:
 	VOP_UNLOCK(dp);
@@ -1208,10 +1205,6 @@ unionlookup:
 		 * doesn't currently exist, leaving a pointer to the
 		 * (possibly locked) directory vnode in ndp->ni_dvp.
 		 */
-		if (cnp->cn_flags & SAVESTART) {
-			ndp->ni_startdir = ndp->ni_dvp;
-			VREF(ndp->ni_startdir);
-		}
 		goto success;
 	}
 
@@ -1366,10 +1359,6 @@ nextname:
 		error = EROFS;
 		goto bad2;
 	}
-	if (cnp->cn_flags & SAVESTART) {
-		ndp->ni_startdir = ndp->ni_dvp;
-		VREF(ndp->ni_startdir);
-	}
 	if (!wantparent) {
 		ni_dvp_unlocked = 2;
 		if (ndp->ni_dvp != dp)
diff --git a/sys/sys/namei.h b/sys/sys/namei.h
index eafb23ed0929..fb709b8713d7 100644
--- a/sys/sys/namei.h
+++ b/sys/sys/namei.h
@@ -161,7 +161,7 @@ int	cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status,
  */
 #define	RDONLY		0x00000200 /* lookup with read-only semantics */
 /* UNUSED		0x00000400 */
-#define	SAVESTART	0x00000800 /* save starting directory */
+/* UNUSED		0x00000800 */
 #define	ISWHITEOUT	0x00001000 /* found whiteout */
 #define	DOWHITEOUT	0x00002000 /* do whiteouts */
 #define	WILLBEDIR	0x00004000 /* new files will be dirs; allow trailing / */
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 6fcf15101bcb..bb56fe1140cf 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -76,7 +76,7 @@
  * cannot include sys/param.h and should only be updated here.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1400074
+#define __FreeBSD_version 1400075
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,