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>
This commit is contained in:
Conrad Meyer 2017-04-21 22:00:22 +00:00
parent e96af29419
commit ef3c43b4e3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317273

View File

@ -272,8 +272,6 @@ fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags, struct thread *td)
/*
* Funcation is called for every vnode open.
* Merge fuse_open_flags it may be 0
*
* XXXIP: Handle FOPEN_KEEP_CACHE
*/
/*
* Ideally speaking, direct io should be enabled on
@ -293,6 +291,8 @@ fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags, struct thread *td)
VTOFUD(vp)->flag |= FN_DIRECTIO;
fuse_io_invalbuf(vp, td);
} else {
if ((fuse_open_flags & FOPEN_KEEP_CACHE) == 0)
fuse_io_invalbuf(vp, td);
VTOFUD(vp)->flag &= ~FN_DIRECTIO;
}