svn commit: r239112 - projects/fuse/sys/fs/fuse

Attilio Rao attilio at FreeBSD.org
Mon Aug 6 22:58:47 UTC 2012


Author: attilio
Date: Mon Aug  6 22:58:46 2012
New Revision: 239112
URL: http://svn.freebsd.org/changeset/base/239112

Log:
  libfuse caches dot and dotdot entries, not passing through the normal
  lookup path. This means that in order to keep nlookup counter consistent
  the bumping for dot and dotdot entries must not be performed.
  
  In collaboration with:	pho
  Reported by:	flo, gustau

Modified:
  projects/fuse/sys/fs/fuse/fuse_node.c

Modified: projects/fuse/sys/fs/fuse/fuse_node.c
==============================================================================
--- projects/fuse/sys/fs/fuse/fuse_node.c	Mon Aug  6 22:54:10 2012	(r239111)
+++ projects/fuse/sys/fs/fuse/fuse_node.c	Mon Aug  6 22:58:46 2012	(r239112)
@@ -252,7 +252,16 @@ fuse_vnode_get(struct mount *mp,
 		ASSERT_VOP_LOCKED(dvp, "fuse_vnode_get");
 		cache_enter(dvp, *vpp, cnp);
 	}
-	VTOFUD(*vpp)->nlookup++;
+
+	/*
+	 * In userland, libfuse uses cached lookups for dot and dotdot entries,
+	 * thus it does not really bump the nlookup counter for forget.
+	 * Follow the same semantic and avoid tu bump it in order to keep
+	 * nlookup counters consistent.
+	 */
+	if (cnp == NULL || ((cnp->cn_flags & ISDOTDOT) == 0 &&
+	    (cnp->cn_namelen != 1 || cnp->cn_nameptr[0] != '.')))
+		VTOFUD(*vpp)->nlookup++;
 
 	return 0;
 }


More information about the svn-src-projects mailing list