svn commit: r364858 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Thu Aug 27 06:31:56 UTC 2020


Author: mjg
Date: Thu Aug 27 06:31:55 2020
New Revision: 364858
URL: https://svnweb.freebsd.org/changeset/base/364858

Log:
  cache: don't update timestmaps on found entry

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Thu Aug 27 06:31:27 2020	(r364857)
+++ head/sys/kern/vfs_cache.c	Thu Aug 27 06:31:55 2020	(r364858)
@@ -1925,7 +1925,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, 
 {
 	struct celockstate cel;
 	struct namecache *ncp, *n2, *ndd;
-	struct namecache_ts *ncp_ts, *n2_ts;
+	struct namecache_ts *ncp_ts;
 	struct nchashhead *ncpp;
 	uint32_t hash;
 	int flag;
@@ -2013,6 +2013,17 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, 
 				KASSERT(n2->nc_vp == vp,
 				    ("%s: found entry pointing to a different vnode (%p != %p)",
 				    __func__, n2->nc_vp, vp));
+			/*
+			 * Entries are supposed to be immutable unless in the
+			 * process of getting destroyed. Accommodating for
+			 * changing timestamps is possible but not worth it.
+			 * This should be harmless in terms of correctness, in
+			 * the worst case resulting in an earlier expiration.
+			 * Alternatively, the found entry can be replaced
+			 * altogether.
+			 */
+			MPASS((n2->nc_flag & (NCF_TS | NCF_DTS)) == (ncp->nc_flag & (NCF_TS | NCF_DTS)));
+#if 0
 			if (tsp != NULL) {
 				KASSERT((n2->nc_flag & NCF_TS) != 0,
 				    ("no NCF_TS"));
@@ -2024,6 +2035,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, 
 					n2_ts->nc_nc.nc_flag |= NCF_DTS;
 				}
 			}
+#endif
 			goto out_unlock_free;
 		}
 	}


More information about the svn-src-head mailing list