Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Aug 2020 06:31:56 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364858 - head/sys/kern
Message-ID:  <202008270631.07R6Vudd051193@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008270631.07R6Vudd051193>