NFS: Fix a race between mmap() and O_DIRECT
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sun, 28 Jan 2018 14:29:41 +0000 (09:29 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Feb 2018 12:21:14 +0000 (13:21 +0100)
commitb79d8854ee0e222c5beb52fc50246ad0b6d9088e
treeb07cb5af096953372b712976bb9b06d84c6435bf
parent967f650f8835012e9d8bf96bdace29a6b84b43db
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>
fs/nfs/io.c