From owner-svn-src-projects@FreeBSD.ORG Mon Aug 6 22:58:47 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 884EF106566C; Mon, 6 Aug 2012 22:58:47 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73B338FC19; Mon, 6 Aug 2012 22:58:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q76Mwl1k092524; Mon, 6 Aug 2012 22:58:47 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q76MwlBA092522; Mon, 6 Aug 2012 22:58:47 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201208062258.q76MwlBA092522@svn.freebsd.org> From: Attilio Rao Date: Mon, 6 Aug 2012 22:58:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239112 - projects/fuse/sys/fs/fuse X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2012 22:58:47 -0000 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; }