Skip to content

Commit e231c68

Browse files
committed
NFS: Fix a race between mmap() and O_DIRECT
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: a5864c9 ("NFS: Do not serialise O_DIRECT reads and writes") Signed-off-by: Trond Myklebust <[email protected]> Cc: [email protected] # v4.8+
1 parent 128159f commit e231c68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/nfs/io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void nfs_block_buffered(struct nfs_inode *nfsi, struct inode *inode)
9999
{
100100
if (!test_bit(NFS_INO_ODIRECT, &nfsi->flags)) {
101101
set_bit(NFS_INO_ODIRECT, &nfsi->flags);
102-
nfs_wb_all(inode);
102+
nfs_sync_mapping(inode->i_mapping);
103103
}
104104
}
105105

0 commit comments

Comments
 (0)