Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Aug 2012 22:58:47 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r239112 - projects/fuse/sys/fs/fuse
Message-ID:  <201208062258.q76MwlBA092522@svn.freebsd.org>

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



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