Bug 218636 - [fuse] [bug] kernel_cache is enabled by default
Summary: [fuse] [bug] kernel_cache is enabled by default
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Conrad Meyer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-13 16:55 UTC by Ben RUBSON
Modified: 2017-04-22 14:57 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben RUBSON 2017-04-13 16:55:26 UTC
Hello,

From MOUNT_FUSEFS(8) :
     kernel_cache
             By default cached buffers of a given file are flushed at each
             open(2).  This option disables this behaviour

From sys/fs/fuse/fuse_kernel.h :
FOPEN_KEEP_CACHE: don't invalidate the data cache on open

However, looking at sys/fs/fuse/fuse_node.c, FOPEN_KEEP_CACHE is never used !

Adding the following in the else{} of fuse_vnode_open() corrected the issue :
if (!(fuse_open_flags & FOPEN_KEEP_CACHE)) {
	fuse_io_invalbuf(vp, td);
}

Issue found investigating this bug :
https://github.com/vgough/encfs/issues/315

Many thanks !

Ben
Comment 1 Conrad Meyer freebsd_committer 2017-04-20 03:12:54 UTC
https://reviews.freebsd.org/D10434
Comment 2 Ben RUBSON 2017-04-20 05:47:24 UTC
Many thanks Conrad !
Comment 3 commit-hook freebsd_committer 2017-04-21 22:01:28 UTC
A commit references this bug:

Author: cem
Date: Fri Apr 21 22:00:22 UTC 2017
New revision: 317273
URL: https://svnweb.freebsd.org/changeset/base/317273

Log:
  fuse: Implement FOPEN_KEEP_CACHE flag

  Implement FUSE open flag FOPEN_KEEP_CACHE.  Without this flag, cached file
  contents should be invalidated on open.  Apparently, fusefs-encfs relies
  upon this behavior.

  PR:		218636
  Submitted by:	Ben RUBSON <ben.rubson at gmail.com>

Changes:
  head/sys/fs/fuse/fuse_node.c
Comment 4 Ben RUBSON 2017-04-22 06:46:32 UTC
Thank you very much Conrad !
After how many days / weeks do you think we could MFC this patch ?
Comment 5 Conrad Meyer freebsd_committer 2017-04-22 14:57:49 UTC
I'm the wrong person to ask :-).