summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2018-01-28 17:29:41 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-02-16 22:06:46 +0300
commit782b4e79ceaaf787b0fc05ee5fac7017f5c0a997 (patch)
tree8b74ceab3e84fdc326910d865fa13810167d96c4
parent0645878a34d02aeb55aaccd9ba6fe0b39b55f83a (diff)
downloadlinux-782b4e79ceaaf787b0fc05ee5fac7017f5c0a997.tar.xz
NFS: Fix a race between mmap() and O_DIRECT
commit e231c6879cfd44e4fffd384bb6dd7d313249a523 upstream. When locking the file in order to do O_DIRECT on it, we must unmap any mmapped ranges on the pagecache so that we can flush out the dirty data. Fixes: a5864c999de67 ("NFS: Do not serialise O_DIRECT reads and writes") Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/nfs/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/io.c b/fs/nfs/io.c
index 20fef85d2bb1..9034b4926909 100644
--- a/fs/nfs/io.c
+++ b/fs/nfs/io.c
@@ -99,7 +99,7 @@ static void nfs_block_buffered(struct nfs_inode *nfsi, struct inode *inode)
{
if (!test_bit(NFS_INO_ODIRECT, &nfsi->flags)) {
set_bit(NFS_INO_ODIRECT, &nfsi->flags);
- nfs_wb_all(inode);
+ nfs_sync_mapping(inode->i_mapping);
}
}