Bug 235775

Summary: [FUSEFS]: Reuse cached attributes, when available and valid
Product: Base System Reporter: Conrad Meyer <cem>
Component: kernAssignee: Alan Somers <asomers>
Status: In Progress ---    
Severity: Affects Some People CC: acid, asomers, ben.rubson, freebsd, jSML4ThWwBID69YC, markj, piotr.konopelko
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Bug Depends on: 230258    
Bug Blocks: 236136    

Description Conrad Meyer freebsd_committer 2019-02-16 00:51:39 UTC
When cached attributes are valid, save a round-trip through FUSE and return the cached values in VOP_GETATTR.

(Ditto: use cache_enter and keep lookup dentries cached.)

This is a performance optimization rather than a correctness issue.

+++ This bug was initially created as a clone of Bug #230258 +++
Comment 1 commit-hook freebsd_committer 2019-03-01 23:53:33 UTC
A commit references this bug:

Author: asomers
Date: Fri Mar  1 23:53:07 UTC 2019
New revision: 344715
URL: https://svnweb.freebsd.org/changeset/base/344715

Log:
  Begin a fuse(4) test suite

  It only tests the kernel portion of fuse, not the userspace portion (which
  comes from sysutils/fusefs-libs).  The kernel-userspace interface is
  de-facto standardized, and this test suite seeks to validate FreeBSD's
  implementation.

  It uses GoogleMock to substitute for a userspace daemon and validate the
  kernel's behavior in response to filesystem access.  GoogleMock is
  convenient because it can validate the order, number, and arguments of each
  operation, and return canned responses.

  But that also means that the test suite must use GoogleTest, since
  GoogleMock is incompatible with atf-c++ and atf.test.mk does not allow C++
  programs to use atf-c.

  This commit adds the first 10 test cases out of an estimated 130 total.

  PR:		235775, 235773
  Sponsored by:	The FreeBSD Foundation

Changes:
  projects/fuse2/etc/mtree/BSD.tests.dist
  projects/fuse2/tests/sys/fs/Makefile
  projects/fuse2/tests/sys/fs/fuse/
  projects/fuse2/tests/sys/fs/fuse/Makefile
  projects/fuse2/tests/sys/fs/fuse/getattr.cc
  projects/fuse2/tests/sys/fs/fuse/lookup.cc
  projects/fuse2/tests/sys/fs/fuse/mockfs.cc
  projects/fuse2/tests/sys/fs/fuse/mockfs.hh
  projects/fuse2/tests/sys/fs/fuse/utils.cc
  projects/fuse2/tests/sys/fs/fuse/utils.hh
Comment 2 commit-hook freebsd_committer 2019-03-04 22:08:31 UTC
A commit references this bug:

Author: asomers
Date: Mon Mar  4 22:07:34 UTC 2019
New revision: 344785
URL: https://svnweb.freebsd.org/changeset/base/344785

Log:
  fuse(4): add tests for CREATE, OPEN, READLINK, SETATTR and SYMLINK

  The new SETATTR tests deal with already-open files.

  PR:		235775
  PR:		236231
  Sponsored by:	The FreeBSD Foundation

Changes:
  projects/fuse2/tests/sys/fs/fuse/Makefile
  projects/fuse2/tests/sys/fs/fuse/create.cc
  projects/fuse2/tests/sys/fs/fuse/mockfs.hh
  projects/fuse2/tests/sys/fs/fuse/open.cc
  projects/fuse2/tests/sys/fs/fuse/readlink.cc
  projects/fuse2/tests/sys/fs/fuse/setattr.cc
  projects/fuse2/tests/sys/fs/fuse/symlink.cc
Comment 3 commit-hook freebsd_committer 2019-04-08 18:46:21 UTC
A commit references this bug:

Author: asomers
Date: Mon Apr  8 18:45:45 UTC 2019
New revision: 346043
URL: https://svnweb.freebsd.org/changeset/base/346043

Log:
  fusefs: cache file attributes

  FUSE_LOOKUP, FUSE_GETATTR, FUSE_SETATTR, FUSE_MKDIR, FUSE_LINK,
  FUSE_SYMLINK, FUSE_MKNOD, and FUSE_CREATE all return file attributes with a
  cache validity period.  fusefs will now cache the attributes, if the server
  returns a non-zero cache validity period.

  This change does _not_ implement finite attr cache timeouts.  That will
  follow as part of PR 235773.

  PR:		235775
  Reported by:	cem
  Sponsored by:	The FreeBSD Foundation

Changes:
  projects/fuse2/sys/fs/fuse/fuse_internal.c
  projects/fuse2/sys/fs/fuse/fuse_internal.h
  projects/fuse2/sys/fs/fuse/fuse_node.c
  projects/fuse2/sys/fs/fuse/fuse_node.h
  projects/fuse2/sys/fs/fuse/fuse_vnops.c
  projects/fuse2/tests/sys/fs/fusefs/allow_other.cc
  projects/fuse2/tests/sys/fs/fusefs/create.cc
  projects/fuse2/tests/sys/fs/fusefs/default_permissions.cc
  projects/fuse2/tests/sys/fs/fusefs/flush.cc
  projects/fuse2/tests/sys/fs/fusefs/fsync.cc
  projects/fuse2/tests/sys/fs/fusefs/getattr.cc
  projects/fuse2/tests/sys/fs/fusefs/locks.cc
  projects/fuse2/tests/sys/fs/fusefs/lookup.cc
  projects/fuse2/tests/sys/fs/fusefs/open.cc
  projects/fuse2/tests/sys/fs/fusefs/read.cc
  projects/fuse2/tests/sys/fs/fusefs/release.cc
  projects/fuse2/tests/sys/fs/fusefs/setattr.cc
  projects/fuse2/tests/sys/fs/fusefs/unlink.cc
  projects/fuse2/tests/sys/fs/fusefs/utils.cc
  projects/fuse2/tests/sys/fs/fusefs/write.cc
Comment 4 Alan Somers freebsd_committer 2019-04-19 22:34:31 UTC
This is complete on the fuse2 branch.