aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2016-05-15 00:45:17 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2016-05-15 00:45:17 +0000
commit72393e3d803d048f990d374a2e681925325317e7 (patch)
tree8da465e67aabda3b743bf8a64717cc09abfb31d5
parent99ca491ca67b987e5deac7610fa49fb7cb7c9b89 (diff)
downloadsrc-72393e3d803d048f990d374a2e681925325317e7.tar.gz
src-72393e3d803d048f990d374a2e681925325317e7.zip
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
Notes
Notes: svn path=/head/; revision=299816
-rw-r--r--sys/fs/fuse/fuse_node.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/fs/fuse/fuse_node.c b/sys/fs/fuse/fuse_node.c
index 2d9a53833c57..421461d02ad0 100644
--- a/sys/fs/fuse/fuse_node.c
+++ b/sys/fs/fuse/fuse_node.c
@@ -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;
}