diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-03-25 18:58:53 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-03-27 12:39:37 -0400 |
commit | a0815d556d1cfb686b46995f86fb081f623fa720 (patch) | |
tree | fd6edd1d18bc1a6633a7e968089d089dd4aec6cd /fs | |
parent | 9e1681c2e74bdd84bad6f74b47a4d88ad2f433df (diff) |
NFSv4.1/pnfs: Ensure that writes respect the O_SYNC flag when doing O_DIRECT
If the caller does not specify the O_SYNC flag, then it is legitimate
to return from O_DIRECT without doing a pNFS layoutcommit operation.
However if the file is opened O_DIRECT|O_SYNC then we'd better get it
right.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/direct.c | 1 | ||||
-rw-r--r-- | fs/nfs/file.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4file.c | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 51f617e45fd1..018a06a062bd 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -1034,6 +1034,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter, | |||
1034 | if (i_size_read(inode) < iocb->ki_pos) | 1034 | if (i_size_read(inode) < iocb->ki_pos) |
1035 | i_size_write(inode, iocb->ki_pos); | 1035 | i_size_write(inode, iocb->ki_pos); |
1036 | spin_unlock(&inode->i_lock); | 1036 | spin_unlock(&inode->i_lock); |
1037 | generic_write_sync(file, pos, result); | ||
1037 | } | 1038 | } |
1038 | } | 1039 | } |
1039 | nfs_direct_req_release(dreq); | 1040 | nfs_direct_req_release(dreq); |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 6959cb76744b..28228f381266 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -281,6 +281,7 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
281 | 281 | ||
282 | trace_nfs_fsync_enter(inode); | 282 | trace_nfs_fsync_enter(inode); |
283 | 283 | ||
284 | nfs_inode_dio_wait(inode); | ||
284 | do { | 285 | do { |
285 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 286 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
286 | if (ret != 0) | 287 | if (ret != 0) |
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 8da5409e6f1a..befe7a2c6284 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c | |||
@@ -104,6 +104,7 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
104 | 104 | ||
105 | trace_nfs_fsync_enter(inode); | 105 | trace_nfs_fsync_enter(inode); |
106 | 106 | ||
107 | nfs_inode_dio_wait(inode); | ||
107 | do { | 108 | do { |
108 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 109 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
109 | if (ret != 0) | 110 | if (ret != 0) |