svn commit: r364631 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Mon Aug 24 08:55:04 UTC 2020


Author: mjg
Date: Mon Aug 24 08:55:04 2020
New Revision: 364631
URL: https://svnweb.freebsd.org/changeset/base/364631

Log:
  cache: populate v_cache_dd for non-VDIR entries
  
  It makes v_cache_dd into a little bit of a misnomer and it may be addressed later.
  
  Tested by:	pho

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Mon Aug 24 08:41:22 2020	(r364630)
+++ head/sys/kern/vfs_cache.c	Mon Aug 24 08:55:04 2020	(r364631)
@@ -2003,24 +2003,22 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, 
 	}
 
 	if (vp != NULL) {
-		if (vp->v_type == VDIR) {
-			if (flag != NCF_ISDOTDOT) {
-				/*
-				 * For this case, the cache entry maps both the
-				 * directory name in it and the name ".." for the
-				 * directory's parent.
-				 */
-				vn_seqc_write_begin(vp);
-				if ((ndd = vp->v_cache_dd) != NULL) {
-					if ((ndd->nc_flag & NCF_ISDOTDOT) != 0)
-						cache_zap_locked(ndd);
-					else
-						ndd = NULL;
-				}
-				vp->v_cache_dd = ncp;
-				vn_seqc_write_end(vp);
+		if (flag != NCF_ISDOTDOT) {
+			/*
+			 * For this case, the cache entry maps both the
+			 * directory name in it and the name ".." for the
+			 * directory's parent.
+			 */
+			vn_seqc_write_begin(vp);
+			if ((ndd = vp->v_cache_dd) != NULL) {
+				if ((ndd->nc_flag & NCF_ISDOTDOT) != 0)
+					cache_zap_locked(ndd);
+				else
+					ndd = NULL;
 			}
-		} else {
+			vp->v_cache_dd = ncp;
+			vn_seqc_write_end(vp);
+		} else if (vp->v_type != VDIR) {
 			if (vp->v_cache_dd != NULL) {
 				vn_seqc_write_begin(vp);
 				vp->v_cache_dd = NULL;


More information about the svn-src-head mailing list