Fix fuse so that stale buffer cache data isn't read.

When I/O on a file under fuse is switched from buffered to DIRECT_IO,
it was possible to read stale (before a recent modification) data from
the buffer cache. This patch invalidates the buffer cache for the
file to fix this.

PR:		194293
MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2016-05-15 00:45:17 +00:00
parent 99ca491ca6
commit 72393e3d80
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299816

View File

@ -289,7 +289,9 @@ fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags, struct thread *td)
* XXXIP: Handle fd based DIRECT_IO
*/
if (fuse_open_flags & FOPEN_DIRECT_IO) {
ASSERT_VOP_ELOCKED(vp, __func__);
VTOFUD(vp)->flag |= FN_DIRECTIO;
fuse_io_invalbuf(vp, td);
} else {
VTOFUD(vp)->flag &= ~FN_DIRECTIO;
}