aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-03-25 17:23:31 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-03-27 12:39:37 -0400
commit9e1681c2e74bdd84bad6f74b47a4d88ad2f433df (patch)
tree8c515f73cb471a2839876228dad497001d6440f0 /fs/nfs
parentNFS: File unlock needs to be a metadata synchronisation point (diff)
downloadlinux-dev-9e1681c2e74bdd84bad6f74b47a4d88ad2f433df.tar.xz
linux-dev-9e1681c2e74bdd84bad6f74b47a4d88ad2f433df.zip
NFSv4: Truncating file opens should also sync O_DIRECT writes
We don't just want to sync out buffered writes, but also O_DIRECT ones. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/inode.c3
-rw-r--r--fs/nfs/nfs4file.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 60f907666697..f1fc0e4c1c02 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -133,11 +133,12 @@ void nfs_evict_inode(struct inode *inode)
nfs_clear_inode(inode);
}
-static int nfs_sync_inode(struct inode *inode)
+int nfs_sync_inode(struct inode *inode)
{
nfs_inode_dio_wait(inode);
return nfs_wb_all(inode);
}
+EXPORT_SYMBOL_GPL(nfs_sync_inode);
/**
* nfs_sync_mapping - helper to flush all mmapped dirty data to disk
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 0de62f7cfebf..8da5409e6f1a 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -59,7 +59,7 @@ nfs4_file_open(struct inode *inode, struct file *filp)
if (openflags & O_TRUNC) {
attr.ia_valid |= ATTR_SIZE;
attr.ia_size = 0;
- nfs_wb_all(inode);
+ nfs_sync_inode(inode);
}
inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, &opened);